PDA

View Full Version : displaying detected USB devices like an SD card reader and card


KB1LQC
27th June 2008, 06:40 AM
I was informed that when you attached a USB device a file is changed or something like that and information on the USB device is writted to it. Is this true? I need to be able to detect when a USB device is attached to the computer. I am trying to write a script to perform a certain function when the storage device is attached.




Thanks
KB1LQC

stevea
27th June 2008, 07:01 AM
Uhh - you'll find that a msg is written to dmesg (the kernel log) but that's no way to detect.

On any hotplug the kernel notifies the udevd process, and udevd uses it's configuration tables to determine what to do. ((under /etc/udev).). You can make your own udevd rules for your devce and execute what you need with the RUN=script option (for your script).

man udev
man udevd
man udevadm