HAL is a hardware abstraction layer that aims to provide a list of devices present in the system. Physical devices are in the list stored in the form of device objects. The device object can be any addressable part of the device.
HAL provides a network API through D-BUS for querying devices and notifying when things change. Finally, HAL provides some nonintrusive monitoring of devices. Presently, ethernet link detection and volume mounts are monitored.
The central component of the HAL is the HAL daemon, hald. It is a system daemon that maintains a database of device objects. The daemon also contains detection and monitoring code for buses, like PCI and USB buses, and devices, like networking and storage devices. hald is responsible for managing the life cycle of device objects.
A device object consists of a unique device identifier (UDI) and a set of
properties in key and value pairs. Properties are defined in the HAL
specification (refer to Section 5.3, “For More Information”).
You can add new properties or adjust
them through device information files, which are stored in the directory
/usr/share/hal/fdi.
When the device object list is modified or when a device property changes, hald invokes callouts. Callouts are programs that can be used to maintain system policy, for example, changing device permissions or updating the system files. There are three types of callouts:
All your callouts of this type should be located in
/etc/hal/device.d. The Device Add
callout is invoked after a device has entered the global device list
(GDL) and before it is announced through D-BUS. The Device
Remove callout is invoked when a device is removed. The device
is not removed until the last callout has finished.
All your callouts of this type should be located in
/etc/hal/capability.d. This callout is invoked when
a capability has been added or removed.
All your callouts of this type should be located in /etc/hal/property.d. This callout is invoked when a device property has been added, removed, or modified.
hal-resmgr (package hal-resmgr) is an example Device Add
Remove callout. The hal-resmgr callout is used by hald to notify
resmgrd of new and
removed devices. The fdi file of hal-resmgr is
/usr/share/hal/fdi/policy/10osvendor/80-resmgr.fdi.