LED devices

Richard Purdie rpurdie at openedhand.com
Wed May 30 05:02:43 PDT 2007


On Wed, 2007-05-30 at 12:35 +0100, Richard Hughes wrote:
> More and more drivers are exporting LED devices using the kernel led
> class framework.

Yes!

> In particular, soon the thinkpad_acpi driver will export the thinklight
> over the led framework. I want to toggle this led in low ambient light
> conditions from the session in gnome-power-manager. Other system and
> session stuff will be wanting to control LED devices on embedded devices
> (think OLPC) and so I think this trivial sysfs to hal device mapping
> should be done in HAL in my opinion.

Yes, LED support in HAL would be great.

> Should HAL control these devices? Adding them as devices in the HAL tree
> is trivial, and we probably done want GetLedState and SetLedState(i)
> methods on each one. We could even just use properties to convey state
> which might be more efficient.
> 
> The led framework (as is) is pretty sparse on information, and we can't
> really get many capabilities (if the light can flash, what colour the
> light is) although I'm prepared to code the kernel changes if need be.

The LED framework is simple but should be very powerful. In answer to
your specific questions:

1. colour information should be in the LED name (see
Documentation/leds-class.txt in the kernel)
2. Blinking or any other LED control is handled by the idea of LED
'triggers'.

We have software flashing working fine at the moment but hardware
assisted blinking is an issue that needs careful though. I've gone into
that several times in the past so I'd recommend searching the LKML
archives on that subject. I will merge some patches soon that will make
machine specific triggers possible and then hardware assisted blinking
would be the next step.

I'd suggest experimenting a bit manually poking files in sysfs to get a
feel for the way things work. If you then have any questions or problems
with the framework, let me know! :)

Cheers,

Richard





More information about the hal mailing list