> I wrote: > > Jacek Anaszewski wrote: > > > > On 08/04/2015 05:56 AM, Craig McQueen wrote: > > > I've written a udev rule to catch uevent "change" events, with the > > > goal of > > setting LED user/group/permissions whenever trigger settings are > changed. > > > > > > http://unix.stackexchange.com/a/202870/34376 > > > > > > However, I've noticed that a TRIGGER uevent "change" event is > > > generated > > every time an LED is turned off. > > > > > > E.g. in one terminal: > > > udevadm monitor -p > > > > > > In another terminal: > > > echo 0 > /sys/class/leds/beaglebone:green:usr3/brightness > > > > > > The first terminal shows: > > > > > > KERNEL[15446.374466] change > > /devices/leds/leds/beaglebone:green:usr3 (leds) > > > ACTION=change > > > DEVPATH=/devices/leds/leds/beaglebone:green:usr3 > > > SEQNUM=39147 > > > SUBSYSTEM=leds > > > TRIGGER=none > > > > > > This behaviour is not ideal, because I really only want this uevent > > > if the > > trigger really has changed. > > > > > > I presume this is due to these two lines in brightness_store() in led- > class.c: > > > if (state == LED_OFF) > > > led_trigger_remove(led_cdev); > > > > > > What would be the recommended way to improve this, so a TRIGGER > > uevent "change" event is only generated if the trigger is actually > > reset to 'none' in this scenario? > > > > > > I've noticed this on kernel 3.14.48 running on BeagleBone Black. > > > > > > > You can define your rule so that it would not be matched when > > TRIGGER=none. > > I tried adding TRIGGER!="none" as in this rule: > > SUBSYSTEM=="leds", ACTION=="change", TRIGGER!="none", > RUN+="/bin/chgrp -R leds /sys%p", RUN+="/bin/chmod -R g=u /sys%p" > > But the rule never seems to run. I can't figure out why not. Unless the older > version of udev I'm using (182) doesn't support !=. I figured it out. I need ENV{TRIGGER} and not just TRIGGER. SUBSYSTEM=="leds", ACTION=="change", ENV{TRIGGER}!="none", RUN+="/bin/chgrp -R leds /sys%p", RUN+="/bin/chmod -R g=u /sys%p" -- Craig McQueen -- To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html