Also attach a log of `udevadm monitor` for your reference.

On 1 September 2015 at 11:32, Tom Yan <[email protected]> wrote:
> Is it a limitation or bug that I can only capture remove events with
> purely SUBSYSTEM or KENREL match, but not with ATTR{*} or even DRIVER?
>
> I unplugged and re-plugged the specific device once before each `cat test`:
>
> [tom@localhost ~]$ cat /etc/udev/rules.d/usb.rules
> KERNEL=="1-14", RUN+="/usr/bin/bash -c 'echo $DEVPATH $ACTION >>
> /home/tom/test'"
> [tom@localhost ~]$ sudo systemctl restart systemd-udevd systemd-udev-trigger
> [tom@localhost ~]$ cat test
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 remove
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> [tom@localhost ~]$ sudo rm test
>
> [tom@localhost ~]$ cat /etc/udev/rules.d/usb.rules
> SUBSYSTEM=="usb", ATTR{busnum}=="1", ATTR{devpath}=="14",
> RUN+="/usr/bin/bash -c 'echo $DEVPATH $ACTION >> /home/tom/test'"
> [tom@localhost ~]$ sudo systemctl restart systemd-udevd systemd-udev-trigger
> [tom@localhost ~]$ cat test
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> [tom@localhost ~]$ sudo rm test
>
> [tom@localhost ~]$ cat /etc/udev/rules.d/usb.rules
> SUBSYSTEM=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c52e",
> RUN+="/usr/bin/bash -c 'echo $DEVPATH $ACTION >> /home/tom/test'"
> [tom@localhost ~]$ sudo systemctl restart systemd-udevd systemd-udev-trigger
> [tom@localhost ~]$ cat test
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> [tom@localhost ~]$ sudo rm test
>
> [tom@localhost ~]$ cat /etc/udev/rules.d/usb.rules
> KERNEL=="2-6", RUN+="/usr/bin/bash -c 'echo $DEVPATH $ACTION >> 
> /home/tom/test'"
> [tom@localhost ~]$ sudo systemctl restart systemd-udevd systemd-udev-trigger
> [tom@localhost ~]$ cat test
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 remove
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 add
> [tom@localhost ~]$ sudo rm test
>
> [tom@localhost ~]$ cat /etc/udev/rules.d/usb.rules
> ATTR{serial}=="AA011214140810091125", RUN+="/usr/bin/bash -c 'echo
> $DEVPATH $ACTION >> /home/tom/test'"
> [tom@localhost ~]$ sudo systemctl restart systemd-udevd systemd-udev-trigger
> [tom@localhost ~]$ cat test
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 add
> [tom@localhost ~]$ sudo rm test
>
> [tom@localhost ~]$ cat /etc/udev/rules.d/usb.rules
> SUBSYSTEM=="usb", RUN+="/usr/bin/bash -c 'echo $DEVPATH $ACTION >>
> /home/tom/test'"
> [tom@localhost ~]$ sudo systemctl restart systemd-udevd systemd-udev-trigger
> [tom@localhost ~]$ cat test
> /devices/pci0000:00/0000:00:14.0/usb1 add
> /devices/pci0000:00/0000:00:14.0/usb2 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-1 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-0:1.0 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-6/2-6:1.0 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-0:1.0 add
> /devices/pci0000:00/0000:00:1a.0/usb3 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> /devices/pci0000:00/0000:00:1d.0/usb4 add
> /devices/pci0000:00/0000:00:1d.0/usb4/4-0:1.0 add
> /devices/pci0000:00/0000:00:1a.0/usb3/3-0:1.0 add
> /devices/pci0000:00/0000:00:1d.0/usb4/4-1 add
> /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1:1.0 add
> /devices/pci0000:00/0000:00:1a.0/usb3/3-1 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14/1-14:1.1 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14/1-14:1.0 add
> /devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.0 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14/1-14:1.0 remove
> /devices/pci0000:00/0000:00:14.0/usb1/1-14/1-14:1.1 remove
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 remove
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14/1-14:1.0 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14/1-14:1.1 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-6/2-6:1.0 remove
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 remove
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-6/2-6:1.0 add
> [tom@localhost ~]$ sudo rm test
>
> [tom@localhost ~]$ cat /etc/udev/rules.d/usb.rules
> DRIVER=="usb", RUN+="/usr/bin/bash -c 'echo $DEVPATH $ACTION >> 
> /home/tom/test'"
> [tom@localhost ~]$ sudo systemctl restart systemd-udevd systemd-udev-trigger
> [tom@localhost ~]$ cat test
> /devices/pci0000:00/0000:00:14.0/usb1 add
> /devices/pci0000:00/0000:00:14.0/usb2 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 add
> /devices/pci0000:00/0000:00:1a.0/usb3 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-1 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> /devices/pci0000:00/0000:00:1a.0/usb3/3-1 add
> /devices/pci0000:00/0000:00:1d.0/usb4 add
> /devices/pci0000:00/0000:00:1d.0/usb4/4-1 add
> /devices/pci0000:00/0000:00:14.0/usb1/1-14 add
> /devices/pci0000:00/0000:00:14.0/usb2/2-6 add
>
> Attached are the outputs of `udevadm info -a` on the two devices used
> in the trials.

Attachment: monitor_log
Description: Binary data

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to