register to get notified with hotplug?
hello,
i want to write a program that get notified when a usb device (exactly a usb memory key) is plugged into the usb port of the machine. i guess hotplug fits this job well.
but i dont know how to register my program to hotplug, so it can be notified. may you please show me the way? (it is best to have some examples or source codes)
thank you and regards,
Nguyen
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 9 lines · Quynh Nguyen Anh
hello,
i want to write a program that get notified when a usb device (exactly a usb memory key) is plugged into the usb port of the machine. i guess hotplug fits this job well.
but i dont know how to register my program to hotplug, so it can be notified. may you please show me the way? (it is best to have some examples or source codes)
Just put two files into /etc/hotplug/usb/*. Hotplug will read the *.usermap and if it matches the USB device it calls given script. Here is a simple example i use for my DigiCam.
Kay
canon 0x0003 0x04a9 0x3056 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
#!/bin/sh
/usr/bin/logger -t $0 "found Canon $PRODUCT at $DEVICE" chown kay:kay $DEVICE