I'm trying to execute a certain Python script on USB devices insertion. I need to handle all kinds of USB devices. I'm using a rule like this:
SUBSYSTEMS=="usb", ENV{DEVTYPE}=="usb_device", RUN+="/.../test.py $devpath"
When I insert a USB flash drive, the test.py
script is not executed. If I use a rule like this:
SUBSYSTEM=="usb", RUN+="/.../test.py $devpath"
I catch events for the /devices/pci0000:00/0000:00:02.1/usb1/1-1/1-1.2/1-1.2:1.0
, which is the default configuration of the device; but I don't get any events for /devices/pci0000:00/0000:00:02.1/usb1/1-1/1-1.2
. I do see such events with udevadm monitor
, though. Why does it happen? Am I missing something?
My distro is current Arch Linux.
I have found the source of the problem. It turned out to be caused by a VirtualBox rule that overrode my own rule.