user-space notification of USB device attached/detached
I have a user-space application that needs to be notified when a USB device has just been attached or detached (hot plugged/unplugged). Can someone tell me how to setup or register for such a notification? I'm running embedded linux 2.6.
I want to be notified of any type of USB device. But just for starters, I'm using a USB Memory Stick. I've loaded all of the necessary drivers:
modprobe ehci-hcd
modprobe usb-storage
modprobe sg
modprobe sd_mod
modprobe vfat
modprobe msdos
modprobe nls_iso8859-1
modprobe nls_cp437
and when I attach or detach the USB Memory Stick, I do see debug traces indicating the attachment/detachment. I can also manually mount the device (/dev/sda1) and read and write files on it. Now, I just need my user-space app to automatically get the attach/detach notifications so it knows when it can read and write the USB Memory Stick.
Thanks,
Ron
Last edited by rhardy; 10-24-2006 at 03:03 PM.
|