3

Can anybody recommend materials about device management in the Linux environment? From the point where I insert a cdrom or usb device to the point where it is mounted in /media/somedir.

I know that I must read about hal, dbus, udev but I was wondering is there any material that treats this topic as a whole.

EDIT: Thanks for link but I want explore this topic more deeply, for example: from who udev get message that there is new device. How this process works etc.

2 Answers 2

5

This is Linux specific:

A hotplug event handler will register with the kernel to receive hotplug events either over a netlink socket or by echoing its path to /proc/sys/kernel/hotplug. It will then receive information over the socket (netlink) or via being launched with environment variables (/proc.../hotplug).

Usually, udev is this handler. When udev gets an event, it proceeds through its rules, and processes ones that match. The rules can include loading kernel modules, naming the device, launching programs, and more.

If you want to see exactly what udev might see, you can write a short program to listen to the netlink socket, or you can do this:

#!/bin/sh
exec 1>/tmp/hotplug.log
echo -----
env

Then give the file execute permissions and echo the path to /proc/sys/kernel/hotplug. Insert and remove some devices and check the log.

http://www.kernel.org/doc/pending/hotplug.txt

http://www.mpipks-dresden.mpg.de/~mueller/docs/suse10.2/html/opensuse-manual_en/manual/cha.udev.html

1
  • Thanks. This is very helpful. Good description about udev and finally i understand a bit more :D.
    – PaulP
    Oct 19, 2011 at 14:42
2

Hal is obsolete. It simply didn't make it and got pushed away. Dbus has not much to do with hardware at all - it is a system message bus (a universal means of communication between various system components). The most important general hardware management system for linux desktop systems is currently udev. If you're interested, you can read a very nice guide from gentoo documentation.

2
  • So why is there still a HALD running if UDEV is in use?
    – Nils
    Oct 19, 2011 at 18:48
  • @Nils If it is so on your system, it could mean either that the system is outdated or that some particular program uses the old HAL or that it is simply unneeded and can be removed. Oct 19, 2011 at 19:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .