Re: best way to handle LEDs

Chase Venters
2005-11-02T08:02:23Z

On Tuesday 01 November 2005 06:38 pm, Richard Purdie wrote:
> led triggers would be connected to leds via sysfs. Each trigger would
> probably have a number you could echo into an led's trigger attribute.
> Sensible default mappings could be had by assigning a default trigger to
> a device by name in the platform code that declares the led.
>
> A trigger of "0" would mean the led becomes under userspace control via
> sysfs for whatever userspace wishes to do with it.

Any reason to represent the triggers as numbers in sysfs? I'm a fan of how the
IO scheduler is chosen on a block device. The file looks like:

noop [anticipatory] deadline cfq

You get a list of all available triggers, which one is active (and it's easy
enough for user space code to parse). Obviously, to select a trigger, you
just write its name to the file. Instead of 0, you say user, etc...

Cheers,
Chase Venters