usb dongle / udev-rule
Hello,
I try to create a very simple kind of usb-dongle. Just a usb stick with one special file on it. When the usb-stick is connected to the computer there should be a script executed. The same thing if someone removes the stick. I tried and tried, but it didn't work. I just created a file '/etc/udev/rules.d/10-dongle.rules' with the following content: Code:
SUBSYSTEM=="usb", KERNEL=="sd?1", ATTR{idVendor}=="1307", ATTR{idProduct}=="0165", RUN+="date>>/tmp/out" best regards toredo |
Two doubts.
IDK if the RUN string can do redirection. You could try writing a script that does what your existing RUN string does and give the full path to it in the RUN string. For good measure give the full path to the date command in the script -- probably not necessary but does no harm. Might be useful to make the script log the $PATH value too. IDK if the ? wildcard in KERNEL=="sd?1" is valid. Apart from that, assuming you used udevadm info to get the listed attributes, it looks good. |
Ok, now it works. I've got the attributes from the internet (every usb device should have a product- and vendorid), but i'll check them with udevadm.
I use now this line: Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="1307", ATTR{idProduct}=="0165", RUN+="/root/test.sh" Best regards toredo |
All times are GMT -5. The time now is 10:00 PM. |