USB devices, udev, modules, and such

Udev (was Hotplug)

The basic idea here is that when you plug in a removeable device (like a USB device), the proper driver modules get loaded, and entries in /dev get created. Some user process gets notification events from the kernel when removeable devices come and go. This process then can run shell scripts to do the right thing. The files that control one aspect of how all this works are in /etc/udev.

You may very likely read about something called hotplug in connection with all this. This went away back around 2006, being replaced by udev in 2.6 linux kernels.
The following fine essay looks like a friendly introduction to the new world order:

The udev scheme works hand in hand with /sys and the sysfs. In addition modprobe plays a vital role (see below).

Kernel drivers

The command uname -r will at any time yield the name of the kernel version you are running. At the time of this writing (November, 2008), this yields: 2.6.27.5-37.fc9.x86_64. In the discussion that follows, I will just use the symbol VERSION since this is always changing.

The usb drivers for my present kernel are found in /lib/modules/VERSION/kernel/drivers/usb

There is a number of files in /lib/modules/VERSION that are generated by depmod (maybe when the kernel boots?) and used by modprobe as part of the game when removable devices get inserted. Also modprobe is controlled by the file /etc/modprobe.conf and the files in /etc/modprobe.d.

  ls /lib/modules/2.6.27.5-37.fc9.x86_64
modules.alias
modules.block
modules.ccwmap
modules.dep
modules.ieee1394map
modules.inputmap
modules.isapnpmap
modules.networking
modules.ofmap
modules.order
modules.pcimap
modules.seriomap
modules.symbols
modules.usbmap

Have any comments? Questions? Drop me a line!

Adventures in Computing / [email protected]