Question about USB hotplug in Ubuntu

Simon Guo wei.guo.simon at gmail.com
Sun Jun 15 13:34:26 UTC 2014


(repost since it looks my previous mail was pending)

Hi, dear list,

I want to be clear about the USB hotplug procedure in Ubuntu.

I read "Linux Device Driver" and "Documentation/usb/hotplug.txt", and
google much. Per my understanding, the USB hotplug generally works as
following in linux:
1) Insertion of physical U-disk will trigger a hardware interrupt. And
interrupt handler (installed by USB bus driver?) will create kobj at /sys.
2) According to Linux device model, the creation of kobj will raise
hotplug event (implemented in USB bus driver).
3) user space hotplug helper is invoked to handle hotplug event. Hotplug
helper will read "modules.usbmaps" and decide to load which USB driver.
If there are many drivers matching the device, they will all be loaded?
4) udev will create approparite dev under /dev according to rules defined.
Please correct me if I am wrong in the above.

I am using Ubuntu 11, and with my own build kernel version 3.15.0.
Currently a new plugged USB disk can be recognized by my Ubuntu.
But I didn't see "modules.usbmaps" file under /lib/modules/`uname -r`
root at thunderCat:/mnt/data# ls /lib/modules/`uname -r`
build   modules.alias      modules.builtin      modules.dep
modules.devname  modules.softdep  modules.symbols.bin
kernel  modules.alias.bin  modules.builtin.bin  modules.dep.bin
modules.order    modules.symbols  source

And there is no /proc/sys/kernel/hotplug
root at thunderCat:/mnt/data# cat /proc/sys/kernel/hotplug

root at thunderCat:/mnt/data# file /sbin/hotplug
/sbin/hotplug: ERROR: cannot open `/sbin/hotplug' (No such file or
directory)

My Question is:
1) How can my Ubuntu hotplug work without "modules.usbmaps" and
"/sbin/hotplug"? Anything special procedure was used for Ubuntu hotplug?
2) Is there any tech I can use to "trace" the kernel/driver behavior of
the USB hotplug procedure? (for example, kernel functions traversed)

Thanks,
Simon






More information about the ubuntu-users mailing list