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 |
Hi,rhardy
Make use of code in my project if you will... there is a thread: http://www.linuxquestions.org/questi...=1#post2476569 where you can find link to SF ... or see the hotplug hooks mentioned in this thread (There is a nifty script you could use?) http://www.slackbasics.org/html/init...n-init-hotplug |
All times are GMT -5. The time now is 08:01 PM. |