Re: Three different LED brightnesses (was Re: PM regression with LED changes in next-20161109)

From: Pavel Machek
Date: Sun Nov 13 2016 - 15:46:00 EST


Hi!

> >No, that's just adding more mess on the system.
> >
> >Here's better proposal:
> >
> >brightness (write): what we do today. (Mess, but too late to change it)
> > (read): -Esomething or what we do today (if someone
> > acutally uses it)
>
> As said Jacek has already nacked any changes to read behavior.
>
> > (poll): -Esomething
>
> Making poll() on sysfs attributes return -Esomething is not possible,
> the internal sysfs API does not allow this.
>
> >current_brightness (write): -Esomething, or maybe change brightness
> > for triggers that can work with that
> > (read, poll): if the current trigger can get current
> > state of led, do it, otherwise -Esomething...
> > or maybe file should be simply hidden from sysfs.
>
> So write is -EINVAL and read is the same as what brightness currently does,
> so I see no use in introducing this new file.

No, read is not same as current brightness file. Currently, reading
brightness file returns either current brightness or maximum
brightness, and userspace can't tell which is which.

> >trigger_max_brightness (read,write): change the maximum brightness for
> > a trigger.
> > (poll): -Esomething
>
> The write behavior here is the same as what brightness currently does
> and the read behavior is that of what I suggested for

No, it is not. "brightness" behaviour is currently broken, as it sets
either current brightness or maximum trigger brightness.

> We've 2 sorts of brightness really:
>
> 1) transient brightness, aka current brightness, when blinking or
> triggers are used this will switch many times a second
> between off and some on level.
>
> 2) non-transient brightness, for non blinking leds this is the
> actual brightness, for blinking leds this is the brightness
> level used when the led is on.

Yes, and we want reasonable interface where userspace sees those two
brightnesses.

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

Attachment: signature.asc
Description: Digital signature