Re: led_class: storing a value can act but return -EINVAL



On Sun, 2006-04-30 at 12:57 +0100, Richard Purdie wrote:

echo 255> brightness works, returns success.

??
For me (bash) that doesn't do anything useful.
Were you looking for "echo -n 255 > brightness"?

echo 255 > brightness works but then returns -EINVAL.

So we currently do b, quite strictly. Its the trailing space thats the
problem. It also shouldn't have altered the brightness value if it ends
up returning -EINVAL.

Yes, but you do change the actual value, which IMHO you shouldn't when
it will return -EINVAL. I should have said

b) reject anything that isn't *only* a number and take no action

instead.

I've looked around other implementations and it would appear we should
accept an optional space. Most sysfs attributes seem to handle this
differently, each with its own "bugs".

Yeah, unfortunately that is true. Maybe there should've been helper
functions like when you have a sysfs-int attribute that is set directly
without get/set calls. I'd suggest looking at that code.

I've some fixes in mind both for the led and backlight classes which
I'll post once I've done a little more testing. I'd be interested to
know the official view on what the attributes should/shouldn't accept
is.

I have a question about the backlight class: I'm writing a patch
currently to control the *keyboard* backlight on powerbooks, is that
appropriate for the backlight class (setting the fbdev callback to
reject everything)?

johannes

Attachment: signature.asc
Description: This is a digitally signed message part



Relevant Pages

  • Re: no backlight on radeon after recent kernel "upgrade"s
    ... On Wed, 21 Feb 2007, Henrique de Moraes Holschuh wrote: ... And brightness is the one that is buggy. ... I can't think of a reason not to do it for every backlight class device. ...
    (Linux-Kernel)
  • Re: [PATCH] [RESEND] Add Dell laptop backlight brightness display
    ... This is total abuse of the backlight class. ... On AC power it should return the AC brightness value and on ... DC power return the DC value. ... I have a patch in the pipeline to change the backlight class slightly to ...
    (Linux-Kernel)
  • Re: no backlight on radeon after recent kernel "upgrade"s
    ... set the brightness attribute like some of the other drivers have. ... Which is why I wrote a patch right away. ... They should be presenting and registering *one* backlight class ...
    (Linux-Kernel)
  • Re: no backlight on radeon after recent kernel "upgrade"s
    ... And brightness is the one that is buggy. ... Now, that was trivial to fix, and I will reply with a patch (which will have ... I can't think of a reason not to do it for every backlight class device. ... Please ACK the ibm-acpi patch in my next message if you'd like me to submit ...
    (Linux-Kernel)