which devices will be displayed in hal-device-manager

Kay Sievers kay.sievers at vrfy.org
Wed Sep 7 05:31:31 PDT 2005


On Wed, Sep 07, 2005 at 07:21:32AM -0400, Dan Williams wrote:
> On Wed, 7 Sep 2005 WMWu at Winbond.com.tw wrote:
> > Which device will be displayed in hal-device-manager? My OS is Fedora
> > Core 3, version of hal-device-manager is 0.4.0
> 
> hal-device-manager will display any device that HAL itself knows about.  Another 
> way to see all the devices HAL knows about is the 'lshal' command, which is 
> similar to the standard 'lspci' command.
> 
> HAL finds devices (and information about those devices) in a number of ways:
> 
> 1) Reading various entries in /proc, for example mountpoints and other things.  
> Some device information is found here, but this is historical and most 
> everything for hardware devices should be in /sys already.

This is mostly additional information or a specific device state that is not
available in /sys. All devices are created by searching /sys.

> 2) Reading stuff in /sys.  This is _really_ important, and is highly 
> device-driver dependent.  If a device driver doesn't expose its information via 
> the sysfs filesystem in /sys, then the driver is considered broken and buggy 
> anyway.  For example, network device drivers MUST use the SET_NETDEV_DEV() call 
> to make the link from /sys/class/net/eth[x]/device to their device's entry in 
> /sys/bus/pci or /sys/bus/pcmcia.  If you're writing a driver, make sure that it 
> follows the correct rules for exposing its details via sysfs.  HAL will then be 
> able to see all its details.  The Intel ipw2200 driver is a great example here.

Right, almost all directories in /sys/block/, /sys/class/ and /sys/devices
are kernel devices and also present in HAL as "device objects". HAL searches /sys at
startup for the initial list and listens to events from udev to keep this
list up-to-date.

> 3) .fdi files.  When HAL can't determine details about a particular device from 
> the information in /proc, /sys, or other places, it looks at .fdi files and 
> merges the properties listed in those files onto the device node in the HAL 
> device list.  This allows for detection of certain digital cameras and other 
> devices for which there is not enough identifying information.

These are informations that can be merged into already existing devices from user
supplied information. (The kernel may know that a device is a "hard disk", but
in reality it's a digital camara. A fdi file can mach on USB vendor/product id's
and provide that information to HAL.)

> 4) Reading information from the device (?)  I'm not sure if this is still done 
> for things like file systems, but HAL used to try to read some information from 
> various devices, like disks, to figure out what filesystem type they had, or 
> whether they were encrypted, etc.

Yes, on device discovery, we open the device itself and probe for filesystem labels
or query serial numbers of hard drives...

> If you're wondering why a device doesn't show up in HAL, first make sure that it 
> is listed in sysfs (/sys).  Each device will usually have at least two entries, 
> for example /sys/class/net/eth0 (which is the capability of the device, and is 
> driver-created) and /sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0 (which is 
> from the Linux kernel PCI drivers).  The driver-created entries, ie 
> /sys/class/net/eth0 needs to have a device link pointing to the second entry 
> here, the PCI one.  That's created in the driver by SET_NETDEV_DEV() for 
> example.  Other types of devices, like USB, IDE devices, etc, have similar 
> mechanisms for populating their sysfs directories.

HAL depends on udev to provide the device node and the event for the
device. To be recognized by HAL, udev passes that information to the HAL
daemon. If the devices you are looking for is expected to have a device node,
make sure udev has handled the device properly too.

> In general, the earlier the kernel is in the 2.6 series, the worse the driver 
> support for HAL is.  You should really only use HAL with 2.6.8 and later 
> kernels, and each kernel release after 2.6.8 gets better driver support for 
> sysfs, and therefore also for HAL.

Very true. HAL and modern hardware integration is very young on Linux
and we change a lot in that area from version to version. So older kernels, udev
and HAL versions may not always work as expected.

Kay


More information about the hal mailing list