Translation(s) : English - Français - Italiano


Device Management Overview

This page aims to give a rough overview of the various subsystems used in linux to manage devices. It will hopefully give you enough of the big picture to better understand the man pages and documentation for the specific subsystems. It won't tell you how to create devices or have scripts run when new devices are added.

There is a hierarchy to the various systems. It looks something like this:

Kernel

Kernel and kernel modules drive the devices.

-sysfs

Sysfs is a virtual file system provided by the 2.6 Linux kernel. Sysfs exports information about devices and drivers from the kernel device model to userspace, and is also used for configuration.
See http://en.wikipedia.org/wiki/Sysfs

Udev and hal use sysfs to do their work.

--hotplug

The kernel calls the /sbin/hotplug script when it sees new hardware passing several arguments. The scripts load kernel modules and user scripts when new hardware is seen.

---udev

New with the 2.6 kernel, udev automates the creation and removal of devices in /dev. udev replaces the devfs of the 2.4 kernel.

From the udev man page. As part of the hotplug subsystem, udev is executed if a kernel device is added or removed from the system. On device creation, udev reads the sysfs directory of the given device to collect device attributes. These attributes may be used as keys to determine a unique name for the device.

---hal

From the /usr/share/doc/hal/NEWS.gz.

HAL is a hardware abstraction layer and aims to provide a live list of devices present in the system at any point in time. HAL tries to understand both physical devices (such as PCI, USB) and the device classes (such as input, net and block) physical devices have, and allows merging of information from so called device info files specific to a device.

HAL provides a network API through D-BUS for querying devices and notifying when things change. Finally, HAL provides some monitoring (in an unintrusive way) of devices; presently ethernet link detection and volume mounts are monitored.

This, and more, is all described in the HAL specification.

-/dev

Entries in /dev give access to the devices the kernel drives. Entries here can be made by hand using command line utilities, or by an automated utility such as DevFS or udev.


CategoryHardware