Please help me, How can i get the pre notifcation of an inserted usb device, before enumeration starts in linux ?
Asked
Active
Viewed 667 times
1 Answers
0
You can use libudev to get notifications of added/removed devices.
Here's a tutorial for libudev. You can also use the code here to get started.
There's also libusb available for usb events/manipulation.

Community
- 1
- 1

Alexandru C.
- 3,337
- 1
- 25
- 27
-
I am new to Linux, I have a basic question about the above answer, does this libudev usage to detect USB events happens before enumeration? When exactly the enumeration happens ? If I use the udev rules, will that be before enumeration? But if I use udev i cannot print any message on the console, how can i inform the user about usb detection? – 123456 Jul 02 '12 at 13:01
-
Test it for yourself, I don't know if `libudev` or `libusb` is enough, or you have to go down another level. Run the sample code and see what happens. – Alexandru C. Jul 02 '12 at 13:47