How to detect usb device insertioin and removal event ?

Submitted by Anonymous
on October 3, 2008 - 8:05am

Hi

I need to write a user application that detects Usb device ( disc or printer) insertion and removal

How to achieve that?

Does inotify allow to detect usb device insertion and removal?

Or is there others ways to do that ?

Any comment sis welcome

Hello, I think you can start

Anonymous (not verified)
on
October 7, 2008 - 12:41am

Hello,

I think you can start with udevadm application - just like that:

udevadm monitor

While you insert or remove usb device you'll be seeing messages from udev printed by this programm.
Then you can dig on your own how it's done in sources code of udevadm.

sdrb

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.