LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-24-2006, 01:31 PM   #1
rhardy
LQ Newbie
 
Registered: Oct 2006
Posts: 2

Rep: Reputation: 0
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 02:03 PM.
 
Old 10-25-2006, 08:31 AM   #2
SCerovec
Member
 
Registered: Oct 2006
Location: Cp6uja
Distribution: Slackware and Porteus
Posts: 648

Rep: Reputation: 45
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
user-space notification of USB device attached/detached rhardy Linux - Software 1 10-24-2006 03:17 PM
Retrieve write protect state of USB device in user space GeertPh Linux - Software 0 10-03-2006 01:25 AM
GMplayer Attached/Detached Skin sadarax Linux - Software 1 04-24-2006 07:15 AM
dm does not load if usb device attached grey man Mandriva 1 03-17-2006 10:48 AM
callback or notification from kernel to user space yhus Programming 5 09-18-2005 09:41 PM


All times are GMT -5. The time now is 10:49 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration