I have a USB device and I need to execute a "infinite" script when I plug in this device and pass the /dev/... path as an argument.
The real example is: The device is RFID reader (0403:6001), which works as tty device. I need to run a script, which reads data from /dev/ttyUSBx and via xdotool prints them into opened web browser. As there could be potentially more devices evaluated as /dev/ttyUSBx, I need to pass the correct one to the script.
The classic way seems to be by udev rule, but I read [1], that the "RUN" parameter is not for long time running scripts. Other than that, I cannot find env variable or %variable that would contain the "ttyUSBx".
Another way I found is by systemd, but the classification of device looks like /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2 which depends on the USB port...
I am running Debian 8 Jessie.
[1] https://www.freedesktop.org/software/systemd/man/udev.html
0 Answers