udev - hal - dbus: how does linux recognize devices?
How does linux interacts with the hardware? What does it happen when we plug an usb device? How are made that nice bubbles in gnome?
References:
UDEV
udev f.a.q. http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ writing udev rules http://www.reactivated.net/writing_udev_rules.html good howto http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html
HAL
the purpose of hal http://www.ometer.com/hardware.html hal web site http://freedesktop.org/wiki/Software_2fhal Mark discovering hal http://www.mythic-beasts.com/~mark/random/hal/ Hal specifications http://webcvs.freedesktop.org/hal/hal/doc/spec/hal-spec.html?view=co#ov_hal_linux26
D-BUS
d-bus f.a.q. http://dbus.freedesktop.org/doc/dbus-faq.html#id2688224
----------------------------------------------------------------------------------------------------------------
Read carefully the guides. They are good but not really great guides. It's almost everything over there but not everything. In particular Mark's guide is very helpful. I miss the time in which the howto's were great documents.
What is Udev
It's the replacement for the old devfs. It's capable to create a /dev/ node when a new hardware is found.
What is Hall
from the f.a.q. :
HAL is *not* concerned with how to use the hardware, nor is HAL concerned with configuring the hardware. However, HAL can be used in applications that needs the hardware by providing the list of devices and space for storing configuration values
It seems that we will see the real power of Hal only when the libraries for the applications will be updated.
What is D-Bus?
In short, it is a system consisting of:
- a wire protocol for exposing a typical object-oriented language/framework to other applications
- a bus daemon that allows applications to find and monitor one another.
Phrased differently, D-Bus is:
- an interprocess communication (IPC) system and
- some higher-level structure (lifecycle tracking, service activation, security policy) provided by two bus daemons, one systemwide and one per-user-session.
HAL & D-BUS
D-BUS provides asynchronous notification such that HAL can notify other peers on the message-bus when devices are added and removed as well as when properties on a device are changing.
So this is should be the flow-chart:
1. user plugs the device
2. kernel intercept it through udev and communicate it to D-Bus
3. udev is notified and creates the device in /dev
4. hal is notified by D-Bus and retrieves informations on the plugged device
5. gnome-volume-manager gets datas from hal and act mounting the device in /media (is it's setup to do this)
If it's wrong somewhere please teach me how it works for real.
It means that there are several steps from the moment in which user plugs the device and the moment in which he can see something on the screen such as a bubble like this or something else.

- dam's blog
- 2443 reads

Post new comment