Getting started with HAL?

David Zeuthen david at fubar.dk
Sun Jan 4 17:14:17 EET 2004


On Sat, 2004-01-03 at 20:39, Matthew Mastracci wrote:
> (please ignore my previous message - I've subscribed to the list so that the 
> mail can go through without moderator approval)
> 
> I'm looking for some more information on getting started with HAL
> hacking.  Robert Love's gnome-volume-manager screenshot has inspired me
> to get my Atech 9-in-1 card reader to work flawlessly under linux.  ;)
> 

Great, more help is always welcome!

> So far, it looks like this effort might lay in a number of different
> places:
> 
>  - HAL, for setting up the appropriate device files and media change
> notification (would this be in the agents directory)?

The agent directory is not used anymore - all this functionality is
moved over to the HAL daemon to keep it more simple. Look in and around
hald/linux/linux_class_block.c.

Also, udev should create the device nodes and send out a D-BUS event.
HAL uses this information to set the block.device property. The CVS
version of HAL won't add the device (e.g. move it from the staging area
to the global device list) before block.device is properly set.

To use the HAL from CVS (which I strongly suggest) you'll need udev-012
built with D-BUS events.

>  - Possibly: Linux Kernel, for creating a driver specific to the
> hardware (for device media change notification)
> 

Ok, my card reader (Lexar CF) uses usb-storage. Also, when I unplug the
CF card the USB device powers down and thus disappear; in other words my
device doesn't appear to support removable storage (in a strict
technical sense). Is this also the case with your device?

Also, I would guess that multiple devices (in HAL) stems from this
device (the metal)? Is it possible you can post a screenshot from
hal-device-manager with virtual devices also shown (Ctrl+V) and the
output from lspci or lsusb.

Btw, HAL doesn't yet support remove storage device very well. I'm
currently working on this (for optical drives) such that volume devices
will appear as children of e.g. optical drives.

> It looks like the the SCSI support in HAL might not be as fleshed out as
> the IDE SCSI support.  I can't seem to get the volumes to show in
> hal-device-manager under the PRO-IX node (the device itself).  I don't
> seem to see any "PropertyModified" entries for SCSI devices on higher
> LUNs either.  I'm investigating hal_block.c to see if I can figure out
> where things might be going wrong.
> 
> For inspiration, I tested the card reader out under Windows - it's not
> the smoothest experience.  I don't think Windows even realizes when I
> insert/remove a media card.  I'm hoping to have a system that beats the
> pants off Windows for reacting to media insertion/removal events.
> 
> Can anyone point me in the right direction for what I'm looking to
> accomplish?

It's useful to look at the hotplug events that the kernel generates and
the nodes that udev creates. I have a script in /etc/hotplug.d/default 

#!/bin/sh 
echo >> /tmp/hal.txt
echo >> /tmp/hal.txt
echo >> /tmp/hal.txt
echo >> /tmp/hal.txt
echo "----------------------------------------" >> /tmp/hal.txt
echo `date` >> /tmp/hal.txt
echo "----------------------------------------" >> /tmp/hal.txt
echo $1 >> /tmp/hal.txt
echo "----------------------------------------" >> /tmp/hal.txt
env >> /tmp/hal.txt
#echo "----------------------------------------" >> /tmp/hal.txt
#ls -R /sys$DEVPATH >> /tmp/hal.txt
#tree /sys$DEVPATH >> /tmp/hal.txt
echo "----------------------------------------" >> /tmp/hal.txt
echo "----------------------------------------" >> /tmp/hal.txt

to look at all the events. It's also useful to run the hal daemon as
'hald --daemon=no' to inspect debug output.

Thanks,
David





More information about the xdg mailing list