linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	Darren Hart <dvhart@infradead.org>,
	platform-driver-x86@vger.kernel.org
Subject: Re: LED devices & poll() for brightness attribute
Date: Thu, 23 Feb 2017 15:37:26 +0100	[thread overview]
Message-ID: <20170223143726.GB12511@amd> (raw)
In-Reply-To: <201702222216.32131@pali>

[-- Attachment #1: Type: text/plain, Size: 3203 bytes --]

Hi!

> > So... you don't want to use systemd, so don't use systemd. What is
> > the problem? :-)
> > 
> > > And my own application for controlling leds should know current
> > > state of them if it is possible.
> > 
> > If you have at most one application controlling each LED, you are
> > fine. That's quite common situation, serial port can also be opened
> > at most once. Do you actually have two applications accessing one
> > led? If so, what applications?
> 
> First application which controls leds is integrated into desktop 
> environment. In basic/default settings it do nothing automatically, just 
> show GUI bar to user and allow user to adjust LED level.

Ok. Desktop wants to control the backlight, because it makes sense to
turn it off when the screen is blanked, and dim it when screen is
dimmed. Situation is quite similar to display backlight, actually.

> Second one is basic shell script executed at specific situation (e.g. 
> power adapter was unplugged) which changes LED level.

Ok, and this is where the problems start. You are not supposed to
control keyboard backlight like that. (In the same way you can't
control display backlight like that.)

There are numerous problems with the shell script:

1) how to identify the keyboard backlight LED

2) there may be more then one

3) synchronization problems

4) need to be root

Your shell script should talk to the desktop, because it already knows
where the backlight is, and the problems disappear.

> > Yes, we _could_ do that. Would be slightly confusing
> > w.r.t. triggers. But is it good idea?
> 
> Above situation for setting manual level of led is normal. And in this 
> situation setting trigger or blink support does not make sense. 
> Specially when user want to manually set led level.
> 
> I think it is good idea to provide some poll-able sysfs for this change. 
> And if brightness is used for writing, then I would expect that 
> brightness also provide poll() state.
> 
> Yes, it could be little confusing due to triggers/blinking support, but 
> I think it is better as providing new sysfs file and it does not make 
> this interface worse...

I believe the confusion is not worth it. Talk to the desktop people,
there should be good way to control the backlight without reaching
lowlevel interfaces directly.

> > And yes, with three color LEDs, userspace daemon managing LED state
> > will be pretty much mandatory...
> 
> Why it should be running daemon? Script which you start when you want 
> change is also enough... no need to have permanently running process.

Because you want to play multiple patterns on the LED.

You probably also want to automatically control the keyboard backlight
LEDs using ambient light sensor. Shell should not be involved.

This is one example of automatic backlight / keyboard backlight / LED
patterns. And yes, this should be integrated with desktop, not using
/sys/class/leds directly.

https://gitlab.com/tui/tui/blob/master/ofone/mond

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2017-02-23 14:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22  9:06 LED devices & poll() for brightness attribute Pali Rohár
2017-02-22 12:25 ` Pavel Machek
2017-02-22 12:39   ` Pali Rohár
2017-02-22 20:54     ` Pavel Machek
2017-02-22 21:16       ` Pali Rohár
2017-02-23 14:37         ` Pavel Machek [this message]
2017-02-23 14:48           ` Pali Rohár
2017-02-23 20:23             ` Pavel Machek
2017-02-23 20:44               ` Pali Rohár
2017-02-23 21:03                 ` Pavel Machek
2017-02-24  8:50                   ` Pali Rohár
2017-02-24  8:52                     ` Hans de Goede
2017-02-24  8:58                       ` Pali Rohár

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=20170223143726.GB12511@amd \
    --to=pavel@ucw.cz \
    --cc=dvhart@infradead.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /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;
as well as URLs for NNTP newsgroup(s).