HAL 0.2.95

David Zeuthen


Table of Contents
Introduction
Overview
Device Objects
D-BUS Network API
Using devices
Capabilities
Properties of a device
Specification of device info files

Introduction

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.


Version control

VersionDateComment
0.1September 28, 2003Still important things missing. Released with version 0.1 of the implementation
0.2December 22, 2003A major rewrite.
0.3-betaJuly 21, 2004Updated to reflect the state of the code.


Acknowledgement

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.


Overview

Architecture of HAL

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.


Scope of HAL

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.

HAL is not concerned with

  • 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).


Device Objects

It is important to precisely define the term ''device object'' - it is actually intended to mean two things:

Note there is not necessarily a one-to-one relationship between physical devices attached to a computer system and ''device objects''. A multi-function device, which appears (and is marketed) to users as a multi-function printer may show up as several device objects; e.g. printer, scanner, fax and storage. On the other hand, an USB keyboard with a scroll-wheel may appear as a single USB device with multiple USB interfaces.

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

Properties of a device object carry all the important information about a device object; for example

This specification is concerned with precisely defining several properties; see the Section called Properties of a device and onwards for more information.

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.


D-BUS Network API

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.


Interface org.freedesktop.Hal.Manager

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)


Interface org.freedesktop.Hal.Device

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.


Interface org.freedesktop.Hal.AgentManager

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.


Using devices

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

Note that there are other ways of dealing with device-specific operations - this list is not exhaustive.


Capabilities

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.

CapabilityDescriptionExample Devices
inputA human input deviceKeyboard, Mouse
input.mouseA pointing device, such as a mouse 
input.keyboardA keyboard 
storageA storage deviceHarddisk, USB storage
storage.removableA storage device with removable mediaCD-ROM, CR-R, Floppy, DVD, Zip-drive
storage_controllerA device for controlling storage devicesUSB storage, IDE, SCSI, RAID controller
storage_controller.ideA device for controlling IDE storage devices 
storage_controller.scsiA device for controlling SCSI storage devices 
storage_controller.floppyA device for controlling floppy storage devices 
storage_controller.raidA device for controlling RAID storage devices 
bridgeThe device is bridging one bus to anotherFound in many PC's today
bridge.cardbusPCI to CardBus bridgeThe standard interface for PCMCIA formfactor cards
bridge.pcmciaPCI to PCMCIA bridgeUsed in old laptops, not very common anymore
bridge.pciPCI to PCI bridgeFound in many PC's today
bridge.hostPCI host bridgeFound in many PC's today
videoVideo adaptorFound in many PC's today
video.vgaVGA comptible video adaptorAlmost all graphics adaptors in the market
multimediaMultimedia deviceSound cards etc.
multimedia.audioSound card 
commCommunication adaptorsSerial and parallel port adaptors
comm.serialSerial port adaptor 
comm.parallelParallel port adaptor 
modemA PSTN modem 
modem.hayesA PSTN modem compatible with the Hayes command protocol 
serial_controllerModern serial communication controllersUSB, IEEE1394 (Firewire, i.Link)
serial_controller.ieee1394IEEE1394 controller 
serial_controller.usbUSB controller 
netNetworking controllerEthernet, ATM etc. controllers
net.ethernetEthernet controller 
net.atmATM controller 
net.tokenringToken Ring controller 
printerPrinter 
hubA device for multiplexing a number of devices of same bus-type on a single port USB hub
bluetooth_adaptorBluetooth adaptor 
blockDevice represents a block device 
volumeDevice represents a partition of a block device that can be mounted in the filesystem 
cameraDevice 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 of a device

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.


info namespace

The info namespace of the properties can be considered meta-data about a device. The following properties are defined:

Key (type)ValuesMandatoryDescription
info.bus (string)pci, usb, ide_host, ide, block, usb, usbif, scsi_host, scsi_deviceYesDescribes what ''physical'' bus the device is on
info.udi (string)example: /org/freedesktop/Hal/devices/block_22_0YesThe HAL unique device id
info.persistent (bool) No, but required if info.not_available is set to trueIf this property is set, the device will remain in the the GDL even if the device is unplugged
info.not_available (bool) NoThe device is currently not available (it may be unplugged or powered down)
info.capabilities (string)example: block storage storage.removableNoA white-space separated list of capabilities describing what the devices does
info.category (string)example: storage.removableNoThe prominent capability describing what the device is
info.product (string)examples: SleekKeyboard, MouseMan 2003, Volume, LS-120 SLIM3 00 UHD FloppyNoThe name of the product or class, the device is an instance of
info.vendor (string)example: LogitchNoThe name of the vendor of the device
info.parent (string)example: /org/freedesktop/Hal/devices/ide_1_0Yes, for all non-root devicesThe UDI of the parent of the device, connection-wise; see screenshots of device manager
info.virtual (bool) NoIf 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 trueThe 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).


linux namespace

This namespace is used to store Linux-specific information about the device and is such only required on Linux.

Key (type)ValuesMandatoryDescription
linux.sysfs_path (string)examples: /sys/block/sda/sda1, /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0YesA fully-qualified path into the sysfs filesystem for the physical device
linux.sysfs_path_device (string) YesNormally 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, hidNoName of the driver bound to this device
linux.sysfs_bus_id (string) NoThe part of linux.sysfs_path after last /. Used internally in HAL
linux.kernel_devname (string)example: usb-0000:00:07.2-1.2NoA name specifically used by the kernel to identify the device. Used internally in HAL


pci namespace

If a device is on a PCI bus, then these properties are available:

Key (type)ValuesMandatoryDescription
pci.device_class (int)example: 3YesDevice class
pci.device_subclass (int)example: 0YesDevice subclass
pci.device_protocol (int)example: 0YesDevice protocol
pci.product_id (int)example: 0x4c4dYesProduct ID
pci.vendor_id (int)example: 0x1002YesVendor ID
pci.subsys_product_id (int)example: 0x009eYesSubsystem product id
pci.subsys_vendor_id (int)example: 0x1028YesSubsystem vendor id
pci.linux.sysfs_path (string)example: /sys/devices/pci0000:00/0000:00:01/0000:01:00.0YesEquals linux.sysfs_path
pci.product (string)Rage Mobility P/M AGP 2xNoName of the product per the PCI database
pci.vendor (string)ATI Technologies IncNoName of the vendor per the PCI database
pci.subsys_product (string)Inspiron 7500NoName of the subsystem product per the PCI database
pci.subsys_vendor (string)Dell Computer CorporationNoName 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)


usb, usbif namespace

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)ValuesMandatoryDescription
usb.bus_number (int)example: 1YesThe USB bus the device is attached to
usb.configuration_value (int) example: 1YesThe current configuration the USB device is in, starting from 1
usb.num_configurations (int)example: 1YesNumber of configurations this USB device can assume
usb.device_class (int)example: 0YesDevice class
usb.device_subclass (int)example: 0YesDevice sub class
usb.device_protocol (int)example: 0YesDevice protocol
usb.is_self_powered (bool)example: falseYesThe device, in this configuration, is self powered
usb.can_wake_up (bool)example: trueYesThe device, in this configuration, can wake up
usb.max_power (int)example: 98YesMax power drain of device, in mA
usb.num_interfaces (int)example: 1YesNumber of interfaces in current configuration
usb.num_ports (int)example: 0YesNumber of ports on a hub. Zero for non-hubs
usb.port_number (int)example: 1YesThe port number on the parent hub, starting from 1
usb.speed_bcd (int)examples: 0x00150, 0x01200, 0x48000YesSpeed of device in BCD
usb.version_bcd (int)examples: 0x0100, 0x0110, 0x0200YesUSB version of device in BCD
usb.level_number (int)example: 2YesDepth in physical USB tree, where the virtual root hub is at depth 0
usb.linux.device_number (string)example: 19Yes (only on Linux)Device number assigned by the Linux kernel
usb.linux.parent_number (string)example: 19Yes (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.1Yes (only on Linux)Equal to linux.sysfs_path
usb.product_id (int)example: 0x3005YesUSB product ID
usb.vendor_id (int)example: 0x04b3YesUSB vendor ID
usb.device_revision_bcd (int)example: 0x0100YesRevision number of device, in BCD
usb.serial (string) NoA 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 KEYBOARDNoName of the product per the USB database
usb.vendor (string)example: IBM Corp.NoName of the vendor per the USB database

And these are the properties for an USB interface

Key (type)ValuesMandatoryDescription
usbif.device_product_id (int)example: 0x3005YesUSB product ID of the device this interface belongs to
usbif.device_vendor_id (int)example: 0x04b3YesUSB vendor ID of the device this interface belongs to
usbif.interface_class (int)example: 0x03YesClass of this interface
usbif.interface_subclass (int)example: 0x01YesSubclass of this interface
usbif.interface_protocol (int)example: 0x01YesProtocol for this interface
usbif.number (int)example: 1YesNumber 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.0YesEquals linux.sysfs_path


ide, ide_host namespace

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)ValuesMandatoryDescription
ide_host.number (int) YesA unique number identifying the IDE host adaptor

Key (type)ValuesMandatoryDescription
ide.channel (int) YesCorresponds to ide_host.number of the ide_host device that is the parent of this device
ide.sub_channel (int) YesIdentifies the IDE channel of this interface


scsi_host, scsi_device namespace

(FIXME: Need to populate these namespaces with some interesting information such as SCSI LUN address and so on.)


input namespace

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)ValuesMandatoryDescription
input.absolute (bool) YesThe 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 trueWRITEME
input.absolute.y (bool) Only if input.absolute is trueWRITEME
input.absolute.z (bool) Only if input.absolute is trueWRITEME
input.absolute.rx (bool) Only if input.absolute is trueWRITEME
input.absolute.ry (bool) Only if input.absolute is trueWRITEME
input.absolute.rz (bool) Only if input.absolute is trueWRITEME
input.absolute.rz (bool) Only if input.absolute is trueWRITEME
input.absolute.throttle (bool) Only if input.absolute is trueWRITEME
input.absolute.rudder (bool) Only if input.absolute is trueWRITEME
input.absolute.wheel (bool) Only if input.absolute is trueWRITEME
input.absolute.gas (bool) Only if input.absolute is trueWRITEME
input.absolute.brake (bool) Only if input.absolute is trueWRITEME
input.absolute.hat0x (bool) Only if input.absolute is trueWRITEME
input.absolute.hat0y (bool) Only if input.absolute is trueWRITEME
input.absolute.hat1x (bool) Only if input.absolute is trueWRITEME
input.absolute.hat1y (bool) Only if input.absolute is trueWRITEME
input.absolute.hat2x (bool) Only if input.absolute is trueWRITEME
input.absolute.hat2y (bool) Only if input.absolute is trueWRITEME
input.absolute.pressure (bool) Only if input.absolute is trueWRITEME
input.absolute.distance (bool) Only if input.absolute is trueWRITEME
input.absolute.tilt_x (bool) Only if input.absolute is trueWRITEME
input.absolute.tilt_y (bool) Only if input.absolute is trueWRITEME
input.absolute.misc (bool) Only if input.absolute is trueWRITEME
input.relative (bool) YesThe 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 trueWRITEME
input.relative.y (bool) Only if input.relative is trueWRITEME
input.relative.z (bool) Only if input.relative is trueWRITEME
input.relative.hwheel (bool) Only if input.relative is trueWRITEME
input.relative.dial (bool) Only if input.relative is trueWRITEME
input.relative.wheel (bool) Only if input.relative is trueWRITEME
input.relative.misc (bool) Only if input.relative is trueWRITEME
input.led (bool) YesThe device has LED indicators that can be on or off
input.led.numlock (bool) Only if input.led is trueWRITEME
input.led.capslock (bool) Only if input.led is trueWRITEME
input.led.scrolllock (bool) Only if input.led is trueWRITEME
input.led.compose (bool) Only if input.led is trueWRITEME
input.led.kana (bool) Only if input.led is trueWRITEME
input.led.sleep (bool) Only if input.led is trueWRITEME
input.led.suspend (bool) Only if input.led is trueWRITEME
input.led.mute (bool) Only if input.led is trueWRITEME
input.led.misc (bool) Only if input.led is trueWRITEME
input.led.max (bool) Only if input.led is trueWRITEME
input.force_feedback (bool) Yes 
input.key (bool) YesThe device has keys the user can press
input.repeat (bool) YesThe device sends repeat keypresses if a key is pressed down
input.sound (bool) YesThe device can emit sounds
input.linux.phys (string)example: usb-0000:00:07.2-1.2Yes (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, kbdYes (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 0Yes (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?)


block namespace

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)ValuesMandatoryDescription
block.block_size (int)example: 512YesSize in octects of every block on the device
block.size (int)example: 15584YesSize of storage area, in blocks
block.start (int)example: 32YesLinear offset, in blocks, where the storage area starts
block.major (int)example: 8YesMajor number of special file to interact with the device
block.minor (int)example: 1YesMinor number of special file to interact with the device
block.is_volume (bool) YesTrue iff the block device is a volume that can be mounted into the file system
block.is_mounted (bool) YesTrue 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


net, net.ethernet namespace

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)ValuesMandatoryDescription
net.arp_proto_hw_id (int)examples: 1 (ethernet), 19 (ATM)YesARP protocol hardware identifier ID; see net/if_arp.h
net.interface (string)example: eth0YesName of the network interface
net.media (string)examples: Ethernet, Frame Relay DLCIYesDescription name of the link layer protocol
net.linux.sysfs_path (string)example: /sys/class/net/eth0Yes (only on Linux)Sysfs path to (logical) network device object. Is normally NOT equal to linux.sysfs_path

Key (type)ValuesMandatoryDescription
net.ethernet.link (bool) Only if net.arp_proto_hw_id=1True iff the ethernet adaptor is connected to a another transceiver
net.ethernet.rate (int)example: 100000000Only if net.arp_proto_hw_id=1Bandwidth of connection, in bits/s
net.ethernet.mac_addr (string)example: 00:10:60:5d:8e:f4Only if net.arp_proto_hw_id=1Textual representation of MAC address
net.ethernet.mac_addr_lower24 (int)example: 0x00001060Only if net.arp_proto_hw_id=1Binary representation of lower 24 bits of the MAC address
net.ethernet.mac_addr_upper24 (int)example: 0x005d8ef4Only if net.arp_proto_hw_id=1Binary representation of the upper 24 bits of the MAC address


Specification of device info files

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.