Differences between revisions 4 and 5
Revision 4 as of 2006-02-22 13:06:53
Size: 1382
Editor: ?HugoVanwoerkom
Comment:
Revision 5 as of 2006-02-26 20:18:11
Size: 2510
Editor: ?DavidBerg
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
This page was created in the hopes that some kinds soul would fill it out to give an overview of how devices are managed in linux and Debian in particular. What I have written is a rough sketch of my understanding which is lacking greatly. = Device Management Overview =
Line 3: Line 3:
I'd like to see questions like "where can I specify a script to be run when I plug in my camera or flash drive?" answered here. Is this best handled by in the hal or with the hotplug subsystem. 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 & Modules
  * sysfs
  * hotplug
   * udev
   * hal
  * /dev
Line 6: Line 15:

= Device Management Overview =
Line 12: Line 19:
== /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 a automated utility such as DevFS or ["udev"].

What should be accomplished in DevFS/["udev"] configurations?

== hal ==
["hal"] provides an abstraction layer to the hardware so that programs can refer to a device type instead of specific device. Eg digital camera as opposed to Sony DSC-08

== sysfs ==
=== -sysfs ===
Line 26: Line 25:
== hotplug ==
manages usb, pcmcia and other hotpluggable devices.
==== --hotplug ====
The kernel calls the /sbin/hotplug script when it sees new hardware passing several arguments. The scripts load kernel modules and 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 it 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 a automated utility such as DevFS or ["udev"].

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 & Modules

    • sysfs
    • hotplug
      • udev
      • hal
    • /dev

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 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 it 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 a automated utility such as DevFS or ["udev"].


CategoryHardware