Linux LED subsystem development
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Craig McQueen <craig.mcqueen@innerrange.com>,
	"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>
Subject: Re: Change uevent whenever brightness is set to 0
Date: Tue, 04 Aug 2015 12:52:28 +0200	[thread overview]
Message-ID: <55C0996C.6020905@gmail.com> (raw)
In-Reply-To: <5500469A22567C4BAF673A6E86AFA3A40227C1D640EC@IR-CENTRAL.corp.innerrange.com>

Hi Craig,

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.

-- 
Best Regards,
Jacek Anaszewski

  reply	other threads:[~2015-08-04 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04  3:56 Change uevent whenever brightness is set to 0 Craig McQueen
2015-08-04 10:52 ` Jacek Anaszewski [this message]
2015-08-05  1:08   ` Craig McQueen
2015-08-05  1:42     ` Craig McQueen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55C0996C.6020905@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=craig.mcqueen@innerrange.com \
    --cc=linux-leds@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox