I have a script which is run whenever a usb device by vendor 1004 is connected. The udev rule I am using works and looks like this.
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", RUN+="/var/www/beta/trigger.php"
Now I would like to have this script run whenever ANY usb device is connected, and pass the Vendor ID as parameter. (So the script can decide whether it has to be run or not.)
Adding a parameter which can be accessed in the script has worked so far:
SUBSYSTEM=="usb", RUN+="/var/www/beta/trigger.php myparam"
Can someone please tell me how to replace “myparam” with the value of ATTR{idVendor}? I have tried all kinds of combinations, but I never got the expected result…
Thanks a lot!
udevsets for you several environmental variables that you can use, among othersID_VENDOR. Try that little script:Put it in a rule, and you will see how much things are set up for you.