This is a specification of a hardware abstraction layer (HAL) that allows applications to enumerate and use devices present in a typical desktop system, in an operating system independent way.
A device, in the context of the HAL, is identified by a unique id and a set of properties (key/value pairs). This document specifies a set of known properties and gives them well-defined meaning. This enables applications and desktop environments to make a distinction between the different device objects and use the devices based on certain well-known properties.
For instance, the info.category property specifies what the device is (such as a digital camera or an audio device), and the block.mount_point property specifies where in the filesystem a storage device is mounted.
In addition, the HAL provides generic device operations such as locking devices for exclusive access. Furthermore, hooks for non-generic operations (such as retrieve pictures from a camera) is also provided.
Finally, this specification is concerned with so called device information files. A device info file matches a subset of devices (from properties derived from the physical bus the device is on) and populates them with other, often well-defined, properties. Device info files are by no means a substitute for driver software, they are simply hints to the desktop environment / applications about what the device is, what it does and how it can be used.
The HAL is built upon D-BUS which is a framework that, among other things, provides a message-bus that allows applications to talk to one another. Apart from D-BUS, HAL has no other major dependencies which, in theory, allows it to work on many UNIX-like systems. The major focus, initially, is systems running the Linux 2.6 kernel.
Havoc Pennington's article "Making Hardware Just Work" motivated this specification. This specification would not exist without all the useful suggestions and comments on the Free Desktop mailing list.
All trademarks mentioned belong to their respective owners.
The HAL consists of a number of components as outlined in the diagram below
Detail on components
HAL daemon
A system-wide daemon that maintains a persistent database of device objects. It is also responsible for merging information from the device info file repository and managing the life cycle of device objects. The HAL daemon also contains detection and monitoring code for standard busses (PCI, USB etc.) and devices.
HAL agents
The term HAL agent is used to characterize programs that is involved in the detection and monitoring of devices not supported directly by the HAL daemon.
Any program can be a HAL agent; all it means is that the program communicates with the HAL daemon using a specific interface. Examples of use that come to mind are prototypes for supporting new busses/devices, integration of existing device detection/monitoring frameworks etc.
Applications
This represents the end consumers of the HAL and comprises both applications that need to search for a device, but also (existing) device specific libraries and/or services that provide operations on devices using HAL objects.
In addition, this group include desktop environments such as GNOME or KDE. Specifically, using HAL, desktop environments may include system- or session-daemons enforcing certain policies when the device database managed by the HAL daemon changes.
Such policies may include starting a photo management application when a camera is plugged in, assisting the user in finding driver software and device information files for a new device, displaying link information about network devices, mounting removable storage and so on.
The HAL uses D-BUS to provide a ''network API'' to both desktop applications and the aforementioned HAL agents. As D-BUS is designed to be language independent, potentially many languages / runtime systems will be able to easily access the services offered by HAL.
It is important to emphasize that both the HAL daemon and programs acting as HAL agents are responsible for both adding/creating device objects and monitoring devices. Examples of monitoring includes network device link detection, optical disc change detection, storage volume mount point detection etc.
This section attempts to draw some line in the sand in terms of what HAL is supposed to do and not to do. First of all, HAL is concerned with
Maintaining a live list of device objects that correspond to the list maintained by the operating system kernel. This include bus specific information such as the PCI slot location etc.
Merging class device information (derived from the hardware) into a device object. For example, for an USB mouse HAL will merge well-defined properties describing the input-related capabilities of the mouse (e.g. how many buttons etc.)
As device classes are mostly related to the nature of the device rather than operating system, HAL can still be OS independent. For example, both the USB and PCI standards discuss devices classes.
Merging information (produced by human beings) into a device from device information files. This allows applications to think in terms of ''capabilities'' rather than relying on device class information derived from the hardware.
For example, this allows PIM applications to define a capability called 'pda', define properties that characterizes different PDA's they happen to support in their PIM library, and finally (either the PIM authors or the PDA vendors) provide device information files describing the particular PDA being plugged in.
Provide monitoring of detected devices in a non-intrusive way.
Provide space, such that applications can store data per device.
Providing a simple to use query/notification API for use in applications.
Device configuration; that is the task of loading an operating system driver, uploading firmware, mounting a disk or configure/initiate a network connection. It should be noted, though, that HAL provides excellent infrastructure for doing some of these tasks in an operating system independent way.
Providing device-specific operations such as extracting pictures from a digital camera. Naturally, there already exists libraries and frameworks for dealing with hardware. The motivation behind HAL is to get authors of said libraries/frameworks to integrate HAL into their software (see PIM example above).
It is important to precisely define the term ''device object'' - it is actually intended to mean two things:
A device as recognized by the USB, PCI etc. standards and treated as such by the operating system kernel and base OS.
Storage volumes - e.g. partitions on a storage device. While partitions are not real devices (they lend space on a real device such as a hard disk or an optical disc), they are on the same conceptual level as hard disks or optical discs.
HAL is not concerned with this duality of either one-to-one or many-to-one relationships between ''device objects'' and the actual iron constituting what users normally understand as a single device.
A device object consist of the following information
Unique Device ID (referred to as the UDI in the following)
This is an identifier that is unique for a device object - that is, no other device object can have this ID at the same time. This ID is computed from bus-specific information so it is unique across device insertions and when multiple instances of the same kind of device is plugged in.
Properties
Each device got a set of properties which are key/value pairs. The key is an ASCII string while the value can be one of several types
string - UTF8 string
int - 32-bit signed integer
bool - truth value
double - IEEE754 double precision floating point number
Bus specific information - vendor, product ID etc.
Network link status, Storage mount location etc.
User or application information related to the device, for instance which account to hotsync a PDA device with.
Below is a screenshot of a device manager application communicating with the HAL daemon and displaying the devices. The shown properties are for a device representing a partition on a harddisk:
Note that HAL also support device objects which doesn't represent a device; these are marked with the boolean property info.virtual and always contain a link to the physical device in question using the property info.physical_device. For USB devices, for instance, the USB interfaces are represented as separate virtual devices. The following screenshot shows a software SCSI host adaptor sitting in the chain between USB storage and a storage volume.
The reason for supporting virtual devices is that it greatly simplies the implementation.
The HAL daemon is a system-wide process that keeps track of a number of device objects. It communicates with the operating system and intercepts hotplug events as devices are plugged in and removed. The daemon is also responsible for providing services to applications that wants to locate devices and perform generic operations them such as obtaining exclusive access. Non-generic operations, such as obtaining pictures from a camera device, is outside the scope of the HAL daemon; see the Section called Using devices for more information.
Note that the HAL daemon has the concept of a Global Device List (GDL in the following) that contains the devices that the clients can search and subscribe on changes to. When a device have been detected, either from inside the HAL daemon or from an HAL agent, devices are not initially in the GDL; instead, they are added later when a number of properties have been merged.
Using D-BUS terminology, the HAL daemon provides the D-BUS service org.freedesktop.Hal. This service offers a D-BUS object at a well-known location /org/freedesktop/Hal/Manager. This object offers a D-BUS interface, org.freedesktop.Hal.Manager, for querying device objects with the following methods:
# Return a list of all devices in the GDL # # @return List of UDI's # array{string} GetAllDevices() # Determine if a device with a given Unique Device Id exists in the GDL # # @param udi Device UDI, for example '/org/freedesktop/Hal/devices/pci_8086_7111' # @return TRUE iff the device with the given UDI exists # bool DeviceExists(string udi) # Find the set of devices in the GDL that has a given property matching # a given value # # @param key Key, for example 'block.fstype' # @param value Value, for example 'ext3' # @return List of UDI's # array{string} FindDeviceStringMatch(string key, string value) # Find the set of devices in the GDL that has a given capability # # @param capability Capability, for example 'volume' # @return List of UDI's # array{string} FindDeviceByCapability(string capability) |
This object also emits the following signals on the org.freedesktop.Hal.Manager interface that applications can subscribe to using D-BUS:
# Notification that a new device have been added to the GDL # # @param udi Unique Device Id # void DeviceAdded(string udi) # Notification that a new device have been removed from the GDL. The # application cannot use this UDI anymore. # # @param udi Unique Device Id # void DeviceRemoved(string udi) # Notification that a device in the GDL have got a new capability. Note that # this is emitted even though the device already had the old capability # # @param udi Unique Device Id # void NewCapability(string udi, string capability) |
Applications use the Manager interface to locate the device objects they are interested in. When a device object (which is really a D-BUS object, note that the UDI is the objects object_path) is obtained, the HAL daemon provides the org.freedesktop.Hal.Device interface with the following methods
# Set property # # @param key Property to set # @param value Value to set # @raises org.freedesktop.Hal.(NoSuchDevice|TypeMismatch) # void SetProperty(string key, any value) void SetPropertyString(string key, string value) void SetPropertyInteger(string key, int32 value) void SetPropertyBoolean(string key, bool value) void SetPropertyDouble(string key, double value) # Get property # # @param key Property to get # @return The value of the property # @raises org.freedesktop.Hal.(NoSuchDevice|NoSuchProperty|TypeMismatch) # any GetProperty(string key) string GetPropertyString(string key) int32 GetPropertyInteger(string key) bool GetPropertyBoolean(string key) double GetPropertyDouble(string key) # Get all properties # # @return Dictionary from key to value # @raises org.freedesktop.Hal.NoSuchDevice # map{string, any} GetAllProperties() # Remove a property # # @param key Property to remove # @raises org.freedesktop.Hal.(NoSuchDevice|NoSuchProperty) # void RemoveProperty(string key) # Get the type of a property # # @param key Property # @return D-BUS type of property # @raises org.freedesktop.Hal.(NoSuchDevice|NoSuchProperty) # int32 GetPropertyType(string key) # Determine if a property exists # # @param key Property # @return TRUE iff the property exists # @raises org.freedesktop.Hal.NoSuchDevice # bool PropertyExists(string key) # Add a capability to a device. Note that this will trigger a NewCapability # signal to all client applications subscribing to signals from the Manager # interface. # # @param capability Capability, e.g. 'net.ethernet' # @raises org.freedesktop.Hal.NoSuchDevice # void AddCapability(string capability) # Determine if a device got a given capability # # @param capability Capability, e.g. 'video.vga' # @return TRUE iff the device got the given capability # @raises org.freedesktop.Hal.NoSuchDevice # bool QueryCapability(string capability) |
The device objects also emits the following signals on the org.freedesktop.Hal interface that applications can subscribe to using D-BUS
# Notification that property have been added # # @param key Property # void PropertyAdded(string key) # Notification that property have been removed # # @param key Property # void PropertyRemoved(string key) # Notification that property have changed value # # @param key Property # void PropertyChanged(string key) |
Note that D-BUS supports that applications can opt to receive signals for only a subset of the devices available.
The API described above is available to all applications. There is an additional D-BUS interface on the /org/freedesktop/Hal/Manager object called org.freedesktop.Hal.AgentManager which is only available for processes running with administrative privileges.
# Create a new device object not in the GDL (ie. hidden from # applications). This object can be obtained using the given UDI as # as the D-BUS object reference. # # The object implements the org.freedesktop.Hal.Device interface # # @return Temporary UDI for new device object # string NewDevice() # When a device have been built, an application can add it to the GDL. # # A side-effect of this call, is that the Manager object will emit the # signal DeviceAdded. # # @param tempUdi Temporary UDI as obtained from the NewDevice call # @param newUdi New UDI to use. # @raises org.freedesktop.Hal.(NoSuchDevice|UdiInUse) # void CommitToGDL(string tempUdi, string newUdi) # Remove a device object. # # Depending on the info.persistent property, the device may not be removed but # rather acquire the property info.not_available with value true. # # @param udi UDI of device # @raises org.freedesktop.Hal.NoSuchDevice # void Remove(string udi) # Merge all properties from one device to another device. # # If the source device got any capabilities, then the target device # will acquire these capabilities and a NewCapability signal will be # emitted for the target device for every capability in the source # device. # # @param targetUdi UDI of device to receive properties # @param sourceUdi UDI of device to copy properties from # @raises org.freedesktop.Hal.NoSuchDevice # void MergeProperties(string targetUdi, string sourceUdi) # Checks that all properties where keys, starting with a given value # (namespace), of the first device is present in the second device and that # they got the same value and type. # # Note that the other inclusion isn't tested, so there could be # properties (from the given namespace) in the second device not present # in the first device. # # @param udi1 UDI of device 1 # @param udi2 UDI of device 2 # @param namespace Namespace used for matching, e.g. 'usb' # @return TRUE if, and only if, all properties starting # with the namespace parameter from udi1 is # in udi2 and assume the same value # @raises org.freedesktop.Hal.NoSuchDevice # bool DeviceMatches(string udi1, string udi2, string namespace) |
HAL Agents uses the org.freedesktop.Hal.AgentManager API when discovering devices either through detection, handling hotplug events or through some other way.
One of the goals of the HAL is to provide easy access to devices on a system. This includes obtaining device specific information, such as CPU frequency, and invoking device specific methods such as getting the pictures on a camera or changing the volume on a sound device.
While the HAL daemon provides generic operations that apply to all devices (though some may be no-ops) and provide some level of monitoring for well-know class devices (such as networking devices), it is not concerned with providing non-generic device operations.
The architecture of the HAL allows a number of ways of dealing with specific device information and operations
Out-of-process D-BUS Service
For example, one could write a volume manager that manages the different storage devices present on the system and mount the partitions/volumes available on those into the filesystem according to certain rules. The volume manager would run as a daemon monitoring the device list of the HAL daemon and act appropriately when devices having Storage and StorageVolume in the Capabilitites property appear and disappear.
The volume manager could also offer an operation for writing ISO images to e.g. CD-R devices through a D-BUS interface on HAL device object. In this scenario, a desktop file manager would use the HAL daemon to query for the HAL device object that is a CD recorder and pass the object reference to the D-BUS service offered by the volume manager.
In-process library
Another example is device objects having capability camera. One could use an existing library, such as libgphoto2, and make wrapper functions such that the application programmer simple passes the HAL UDI to the library. The library would then, via D-BUS, acquire the bus-specific information required from the HAL daemon, and then interact with the device.
As previously mentioned the capabilities of a device specify what the device does. For instance, a CompactFlash card reader can be thought of as a camera, a handheld music device and removable storage.
HAL itself, assigns capabilities on device detection time by inspecting the device class (if available, it depends on the bus type) and looking at information from the operating system (most OS'es has a concept of device classes). At this time the category is also determined by selecting the most prominent capability. However, both capabilities and category can be overridden by either device information files or a desktop environment policy daemon. This gives maximum flexibility, while maintaining a base level of capability detection.
Note that, for instance, a number of USB devices doesn't advertise anything in their device class, so a repository of device information files coupled with an interactive dialog (provided by a desktop environment daemon) asking the user what he just plugged in, will probably yield the best experience for users. Incidently, this is how certain non-free operating systems appear to handle hardware.
Returning to the example of the card reader, this might just happen to be a digital camera with the only interface being a card reader - HAL, or the base OS, wouldn't be able to tell the difference - it's just looks like a storage device. So, to handle hardware well to meet the expectation of the users, device information files and desktop environment policy daemons need to be available on top of HAL (notably, the desktop environment daemon might look at the files on the device to infer whether it's music, pictures or something else) and adjust the capabilities and category of certain devices.
Finally, what a given capability means, needs to be precisely defined. The idea of HAL is that existing device capability specific libraries (such as libghoto2), would advertise what kind of HAL capabilities they are able to handle. As this happens over time, this specification will grow to precisely define what a device with a given capability is supposed to do and what library, or service, the application programmer can use to access the device. At some point in time, we may define an uniform in-process extension framework akin to e.g. OpenGL extensions for accessing said libraries and services.
Having a capability also means that part of the property namespace, prefixed with the capability name, can (but it's not a requirement) be populated with more specific information about the capability. Virtual devices will not have any capabilities assigned to them.
The following table define the capabilities supported in HAL at the time of writing.
Capability | Description | Example Devices |
---|---|---|
input | A human input device | Keyboard, Mouse |
input.mouse | A pointing device, such as a mouse | |
input.keyboard | A keyboard | |
storage | A storage device | Harddisk, USB storage |
storage.removable | A storage device with removable media | CD-ROM, CR-R, Floppy, DVD, Zip-drive |
storage_controller | A device for controlling storage devices | USB storage, IDE, SCSI, RAID controller |
storage_controller.ide | A device for controlling IDE storage devices | |
storage_controller.scsi | A device for controlling SCSI storage devices | |
storage_controller.floppy | A device for controlling floppy storage devices | |
storage_controller.raid | A device for controlling RAID storage devices | |
bridge | The device is bridging one bus to another | Found in many PC's today |
bridge.cardbus | PCI to CardBus bridge | The standard interface for PCMCIA formfactor cards |
bridge.pcmcia | PCI to PCMCIA bridge | Used in old laptops, not very common anymore |
bridge.pci | PCI to PCI bridge | Found in many PC's today |
bridge.host | PCI host bridge | Found in many PC's today |
video | Video adaptor | Found in many PC's today |
video.vga | VGA comptible video adaptor | Almost all graphics adaptors in the market |
multimedia | Multimedia device | Sound cards etc. |
multimedia.audio | Sound card | |
comm | Communication adaptors | Serial and parallel port adaptors |
comm.serial | Serial port adaptor | |
comm.parallel | Parallel port adaptor | |
modem | A PSTN modem | |
modem.hayes | A PSTN modem compatible with the Hayes command protocol | |
serial_controller | Modern serial communication controllers | USB, IEEE1394 (Firewire, i.Link) |
serial_controller.ieee1394 | IEEE1394 controller | |
serial_controller.usb | USB controller | |
net | Networking controller | Ethernet, ATM etc. controllers |
net.ethernet | Ethernet controller | |
net.atm | ATM controller | |
net.tokenring | Token Ring controller | |
printer | Printer | |
hub | A device for multiplexing a number of devices of same bus-type on a single port | USB hub |
bluetooth_adaptor | Bluetooth adaptor | |
block | Device represents a block device | |
volume | Device represents a partition of a block device that can be mounted in the filesystem | |
camera | Device is a camera where still pictures can be extracted from |
As evident, most of the capabilities in the above list is derived directly from USB and PCI classes (the careful reader will even note that not all classes from the USB and PCI standards are mentioned), and as such, are not very interesting to desktop applications.
However, if HAL becomes adopted by applications, new and interesting capabilities (for example pda, camera or handheld_music_player), based on what the device is used for, can begin to appear.
Properties are arranged in a namespaces using . (dot) as a separator and are key/value pairs. The value may assume different types; currently int32, double, bool and UTF8 strings are supported. The key of a property is always an ASCII string without any whitespace.
The info namespace of the properties can be considered meta-data about a device. The following properties are defined:
Key (type) | Values | Mandatory | Description |
---|---|---|---|
info.bus (string) | pci, usb, ide_host, ide, block, usb, usbif, scsi_host, scsi_device | Yes | Describes what ''physical'' bus the device is on |
info.udi (string) | example: /org/freedesktop/Hal/devices/block_22_0 | Yes | The HAL unique device id |
info.persistent (bool) | No, but required if info.not_available is set to true | If this property is set, the device will remain in the the GDL even if the device is unplugged | |
info.not_available (bool) | No | The device is currently not available (it may be unplugged or powered down) | |
info.capabilities (string) | example: block storage storage.removable | No | A white-space separated list of capabilities describing what the devices does |
info.category (string) | example: storage.removable | No | The prominent capability describing what the device is |
info.product (string) | examples: SleekKeyboard, MouseMan 2003, Volume, LS-120 SLIM3 00 UHD Floppy | No | The name of the product or class, the device is an instance of |
info.vendor (string) | example: Logitch | No | The name of the vendor of the device |
info.parent (string) | example: /org/freedesktop/Hal/devices/ide_1_0 | Yes, for all non-root devices | The UDI of the parent of the device, connection-wise; see screenshots of device manager |
info.virtual (bool) | No | If available and set to true, it means that the HAL device object doesn't represent a device per se, and as such should be ignored | |
info.physical_device (string) | Must only be set if, and only if, info.virtual is true | The non-virtual device that this device is created for. |
The info.parent property is very significant - for example, it's what allows applications to associate a volume with a device. Consider the following setup of devices
Now, the ''CF Reader'' USB device is an ancestor to the the volume that has highlight. Desktop environments can detect this by traversing from the volume device through parents to find the USB device and either merge more information (such as the capability camera) into the USB device object or extract the capability (a device information file might have merged the capability camera) and act accordingly. Optionally, the DE can make the USB device persistent by setting the property info.persistent to true.
Indeed, this very use-case is one of the reasons that HAL tracks information about volumes (FIXME: HAL should, in a later version, directly support a property in info. that points to the actual device).
This namespace is used to store Linux-specific information about the device and is such only required on Linux.
Key (type) | Values | Mandatory | Description |
---|---|---|---|
linux.sysfs_path (string) | examples: /sys/block/sda/sda1, /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 | Yes | A fully-qualified path into the sysfs filesystem for the physical device |
linux.sysfs_path_device (string) | Yes | Normally this property assumes the same value as linux.sysfs_path, however for some devices it assumes an alternate location in the sysfs filesystem. It is used internally in HAL | |
linux.driver (string) | examples: agpgart-intel, yenta_cardbus, usb, hub, hid | No | Name of the driver bound to this device |
linux.sysfs_bus_id (string) | No | The part of linux.sysfs_path after last /. Used internally in HAL | |
linux.kernel_devname (string) | example: usb-0000:00:07.2-1.2 | No | A name specifically used by the kernel to identify the device. Used internally in HAL |
If a device is on a PCI bus, then these properties are available:
Key (type) | Values | Mandatory | Description |
---|---|---|---|
pci.device_class (int) | example: 3 | Yes | Device class |
pci.device_subclass (int) | example: 0 | Yes | Device subclass |
pci.device_protocol (int) | example: 0 | Yes | Device protocol |
pci.product_id (int) | example: 0x4c4d | Yes | Product ID |
pci.vendor_id (int) | example: 0x1002 | Yes | Vendor ID |
pci.subsys_product_id (int) | example: 0x009e | Yes | Subsystem product id |
pci.subsys_vendor_id (int) | example: 0x1028 | Yes | Subsystem vendor id |
pci.linux.sysfs_path (string) | example: /sys/devices/pci0000:00/0000:00:01/0000:01:00.0 | Yes | Equals linux.sysfs_path |
pci.product (string) | Rage Mobility P/M AGP 2x | No | Name of the product per the PCI database |
pci.vendor (string) | ATI Technologies Inc | No | Name of the vendor per the PCI database |
pci.subsys_product (string) | Inspiron 7500 | No | Name of the subsystem product per the PCI database |
pci.subsys_vendor (string) | Dell Computer Corporation | No | Name of the subsystem vendor per the PCI database |
(FIXME: Some key PCI information (bus, slot, port, function etc.) is missing here, but that is easy to add once someone request it)
If a device is on a USB bus, then these properties areavailable. Note that USB devices and the associated USB interfaces are split onto different devices (and info.bus values). An USB interface is always a child of the corresponding USB device.
Key (type) | Values | Mandatory | Description |
---|---|---|---|
usb.bus_number (int) | example: 1 | Yes | The USB bus the device is attached to |
usb.configuration_value (int) | example: 1 | Yes | The current configuration the USB device is in, starting from 1 |
usb.num_configurations (int) | example: 1 | Yes | Number of configurations this USB device can assume |
usb.device_class (int) | example: 0 | Yes | Device class |
usb.device_subclass (int) | example: 0 | Yes | Device sub class |
usb.device_protocol (int) | example: 0 | Yes | Device protocol |
usb.is_self_powered (bool) | example: false | Yes | The device, in this configuration, is self powered |
usb.can_wake_up (bool) | example: true | Yes | The device, in this configuration, can wake up |
usb.max_power (int) | example: 98 | Yes | Max power drain of device, in mA |
usb.num_interfaces (int) | example: 1 | Yes | Number of interfaces in current configuration |
usb.num_ports (int) | example: 0 | Yes | Number of ports on a hub. Zero for non-hubs |
usb.port_number (int) | example: 1 | Yes | The port number on the parent hub, starting from 1 |
usb.speed_bcd (int) | examples: 0x00150, 0x01200, 0x48000 | Yes | Speed of device in BCD |
usb.version_bcd (int) | examples: 0x0100, 0x0110, 0x0200 | Yes | USB version of device in BCD |
usb.level_number (int) | example: 2 | Yes | Depth in physical USB tree, where the virtual root hub is at depth 0 |
usb.linux.device_number (string) | example: 19 | Yes (only on Linux) | Device number assigned by the Linux kernel |
usb.linux.parent_number (string) | example: 19 | Yes (only on Linux) | Device number of parent device as assigned by the Linux kernel |
usb.linux.sysfs_path (string) | example: /sys/devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1.1 | Yes (only on Linux) | Equal to linux.sysfs_path |
usb.product_id (int) | example: 0x3005 | Yes | USB product ID |
usb.vendor_id (int) | example: 0x04b3 | Yes | USB vendor ID |
usb.device_revision_bcd (int) | example: 0x0100 | Yes | Revision number of device, in BCD |
usb.serial (string) | No | A string uniquely identifying the instance of the device; ie. it will be different for two, otherwise identical devices | |
usb.product (string) | example: IBM USB HUB KEYBOARD | No | Name of the product per the USB database |
usb.vendor (string) | example: IBM Corp. | No | Name of the vendor per the USB database |
And these are the properties for an USB interface
Key (type) | Values | Mandatory | Description |
---|---|---|---|
usbif.device_product_id (int) | example: 0x3005 | Yes | USB product ID of the device this interface belongs to |
usbif.device_vendor_id (int) | example: 0x04b3 | Yes | USB vendor ID of the device this interface belongs to |
usbif.interface_class (int) | example: 0x03 | Yes | Class of this interface |
usbif.interface_subclass (int) | example: 0x01 | Yes | Subclass of this interface |
usbif.interface_protocol (int) | example: 0x01 | Yes | Protocol for this interface |
usbif.number (int) | example: 1 | Yes | Number of this interface |
usbif.linux.sysfs_path (string) | example: /sys/devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1.1/1-1.1:1.0 | Yes | Equals linux.sysfs_path |
These namespaces are used to characterise IDE host adaptors and IDE channels. In a standard PC, there are usually two IDE host adaptors each with two channels (master and slave). Normally, the device chain looks like
storage_controller.ide -> ide_host -> ide -> block -> block |
where the first device represents the IDE controller on the motherboard while the last device represents a partition on a (slave or master) IDE disk, and the device before that represent, e.g. a physical harddisk. Notably, the first block device will have capability storage (maybe even storage.removable) and the last block device will have capability volume.
(FIXME: Is this the right terminology to use?)
Key (type) | Values | Mandatory | Description |
---|---|---|---|
ide_host.number (int) | Yes | A unique number identifying the IDE host adaptor |
Key (type) | Values | Mandatory | Description |
---|---|---|---|
ide.channel (int) | Yes | Corresponds to ide_host.number of the ide_host device that is the parent of this device | |
ide.sub_channel (int) | Yes | Identifies the IDE channel of this interface |
(FIXME: Need to populate these namespaces with some interesting information such as SCSI LUN address and so on.)
This namespace is concerned with input devices such as keyboards, pointing devices and game controllers. If a device has the capability input (USB HID devices normally do), then the folling properties are available
Key (type) | Values | Mandatory | Description |
---|---|---|---|
input.absolute (bool) | Yes | The device is capable of giving absolute device coordinates when motion is detected (such as a tablet or game controller) | |
input.absolute.x (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.y (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.z (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.rx (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.ry (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.rz (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.rz (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.throttle (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.rudder (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.wheel (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.gas (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.brake (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.hat0x (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.hat0y (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.hat1x (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.hat1y (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.hat2x (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.hat2y (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.pressure (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.distance (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.tilt_x (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.tilt_y (bool) | Only if input.absolute is true | WRITEME | |
input.absolute.misc (bool) | Only if input.absolute is true | WRITEME | |
input.relative (bool) | Yes | The device is capable of giving relate device coordinates when motion is detected (such as a mouse) | |
input.relative.x (bool) | Only if input.relative is true | WRITEME | |
input.relative.y (bool) | Only if input.relative is true | WRITEME | |
input.relative.z (bool) | Only if input.relative is true | WRITEME | |
input.relative.hwheel (bool) | Only if input.relative is true | WRITEME | |
input.relative.dial (bool) | Only if input.relative is true | WRITEME | |
input.relative.wheel (bool) | Only if input.relative is true | WRITEME | |
input.relative.misc (bool) | Only if input.relative is true | WRITEME | |
input.led (bool) | Yes | The device has LED indicators that can be on or off | |
input.led.numlock (bool) | Only if input.led is true | WRITEME | |
input.led.capslock (bool) | Only if input.led is true | WRITEME | |
input.led.scrolllock (bool) | Only if input.led is true | WRITEME | |
input.led.compose (bool) | Only if input.led is true | WRITEME | |
input.led.kana (bool) | Only if input.led is true | WRITEME | |
input.led.sleep (bool) | Only if input.led is true | WRITEME | |
input.led.suspend (bool) | Only if input.led is true | WRITEME | |
input.led.mute (bool) | Only if input.led is true | WRITEME | |
input.led.misc (bool) | Only if input.led is true | WRITEME | |
input.led.max (bool) | Only if input.led is true | WRITEME | |
input.force_feedback (bool) | Yes | ||
input.key (bool) | Yes | The device has keys the user can press | |
input.repeat (bool) | Yes | The device sends repeat keypresses if a key is pressed down | |
input.sound (bool) | Yes | The device can emit sounds | |
input.linux.phys (string) | example: usb-0000:00:07.2-1.2 | Yes (Linux only) | The name of the physical device as used by the kernel. Used internally by HAL; see also linux.kernel_devname |
input.linux.handlers (string) | examples: mouse1, kbd | Yes (Linux only) | The Linux input handlers for this device |
input.linux.keybit (string) | examples: 10000 7f ffe7207a c14057ff ffbeffdf ffffffff ffffffff fffffffe, f0000 0 0 0 0 0 0 0 0 | Yes (Linux only) | From device descriptor in the input subsystem (see kernel source) |
input.linux.evbit (int) | Yes (Linux only) | From device descriptor in the input subsystem (see kernel source) | |
input.linux.ledbit (int) | Yes (Linux only) | From device descriptor in the input subsystem (see kernel source) | |
input.linux.relbit (int) | Yes (Linux only) | From device descriptor in the input subsystem (see kernel source) | |
input.linux.absbit (int) | Yes (Linux only) | From device descriptor in the input subsystem (see kernel source) |
(FIXME: Is this too linux specific?)
A block device is either a storage device (such as a harddisk, floppy or optical driver) or a partition on a storage, ie. a volume.
Key (type) | Values | Mandatory | Description |
---|---|---|---|
block.block_size (int) | example: 512 | Yes | Size in octects of every block on the device |
block.size (int) | example: 15584 | Yes | Size of storage area, in blocks |
block.start (int) | example: 32 | Yes | Linear offset, in blocks, where the storage area starts |
block.major (int) | example: 8 | Yes | Major number of special file to interact with the device |
block.minor (int) | example: 1 | Yes | Minor number of special file to interact with the device |
block.is_volume (bool) | Yes | True iff the block device is a volume that can be mounted into the file system | |
block.is_mounted (bool) | Yes | True iff the block device is currently mounted in the file system | |
block.device (string) | example: /udev/sda1 | Mandatory if block.is_volume is true | |
block.fs_type (string) | example: vfat | Mandatory if block.is_mounted is true | |
block.mount_point (string) | example: /mnt/cfreader | Mandatory if block.is_mounted is true |
blabla
The net and net.ethernet namespace contains information about (logicial) network devices and only applies to devices with capability net and/or net.ethernet.
Key (type) | Values | Mandatory | Description |
---|---|---|---|
net.arp_proto_hw_id (int) | examples: 1 (ethernet), 19 (ATM) | Yes | ARP protocol hardware identifier ID; see net/if_arp.h |
net.interface (string) | example: eth0 | Yes | Name of the network interface |
net.media (string) | examples: Ethernet, Frame Relay DLCI | Yes | Description name of the link layer protocol |
net.linux.sysfs_path (string) | example: /sys/class/net/eth0 | Yes (only on Linux) | Sysfs path to (logical) network device object. Is normally NOT equal to linux.sysfs_path |
Key (type) | Values | Mandatory | Description |
---|---|---|---|
net.ethernet.link (bool) | Only if net.arp_proto_hw_id=1 | True iff the ethernet adaptor is connected to a another transceiver | |
net.ethernet.rate (int) | example: 100000000 | Only if net.arp_proto_hw_id=1 | Bandwidth of connection, in bits/s |
net.ethernet.mac_addr (string) | example: 00:10:60:5d:8e:f4 | Only if net.arp_proto_hw_id=1 | Textual representation of MAC address |
net.ethernet.mac_addr_lower24 (int) | example: 0x00001060 | Only if net.arp_proto_hw_id=1 | Binary representation of lower 24 bits of the MAC address |
net.ethernet.mac_addr_upper24 (int) | example: 0x005d8ef4 | Only if net.arp_proto_hw_id=1 | Binary representation of the upper 24 bits of the MAC address |
The format is almost self-explanatory; here's an example
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- --> <deviceinfo version="0.2"> <device> <match key="info.bus" string="usb"> <match key="usb.vendor_id" int="0x04a9"> <match key="usb.product_id" int="0x3052"> <merge key="info.category" type="string">camera</merge> <merge key="info.capabilities" type="string">camera</merge> <merge key="info.persistent" type="bool">true</merge> </match> </match> </match> </device> </deviceinfo> |
This .fdi file matches a Canon Digital IXUS V (for this device no device or interface class is advertised), so we match the USB vendor and product identifers. Then we merge category and capabilities into the device object along with setting the persistent property, and this is what it looks like after being matched
It's important to emphasize that any previously property stemming from device detection can be overridden by a device information file.