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

From: Pavel Machek
Date: Sun Apr 30 2006 - 06:20:26 EST


Hi!

> When I store something into the brightness sysfs attribute of an LED, it
> will accept the value but return -EINVAL:
>
> johannes:/sys/class/leds/pmu-front-led# echo 255 > brightness
> bash: echo: write error: Invalid argument
>
> (yet the LED turns on)
>
> This happens because the store callback doesn't consume all the input.

Well, I'd argue current behaviour is okay... can you strace it? It
should accept the number (return 3) then return -EINVAL.

> There are two possible ways to handle this:
> a) accept anything that begins with a valid number.
> b) reject anything that isn't *only* a number

c) accept anything that is number, ignore newlines.

a) is just way too ugly...
Pavel

--
Thanks, Sharp!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/