LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   user-space notification of USB device attached/detached (https://www.linuxquestions.org/questions/linux-newbie-8/user-space-notification-of-usb-device-attached-detached-495173/)

rhardy 10-24-2006 01:31 PM

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

SCerovec 10-25-2006 08:31 AM

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.