On Sun, 25 Oct 2020 18:36:42 +0100 Marcin Kocur <marcin2006@xxxxxxxxx> wrote: > Hello, > > as the topic states, I want to know which action(s) from "add", > "remove", "change", "move", "online", "offline", "bind", and "unbind" > were triggered on my device. Is there any way to check that? > > At the beginning of /usr/lib/udev/rules.d/49-sane.rules there is: > > ACTION!="add", GOTO="libsane_rules_end" > > Udevadm info doesn't show libsane_matched property for my scanner. > > If I trigger the device manually with action "change", the variable is > still not there, as per the rule. > > But if I trigger it with "add", the variable is there and also uaccess > rule gets executed. > > So the ultimate quesiton is: what kind of trigger was executed on my > device on boot time? > Hi, FWIW, I was totally baffled by a similar problem with a DRM device. My rule was doing the same thing: match to "add" and skip otherwise. My rule did not appear to take effect at boot. The problem was not that "add" was not emitted - it was and processed with my rule. The problem was that the DRM driver then shortly after emitted also "changed" (this is how DRM communicates monitor hotplug events). Because my rule did not match "change", the udev property I was adding was effectively *removed*. IOW, any monitor hotplug would cause my udev setting to disappear. Therefore I concluded that if you want your rule to apply always (e.g. set a property that you expect to always find on the device), do not filter it with ACTION at all. New actions could be added any time, and then your rule breaks. At most, maybe it is safe to skip if ACTION=="remove", but I'm not sure about even that. The way I figured this out was adding udev.log_priority=debug to the kernel command line and looking at the resulting flood in the system log. Thanks, pq
Attachment:
pgpWMKmVmmDW6.pgp
Description: OpenPGP digital signature
_______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel