LED devices

Richard Hughes hughsient at gmail.com
Fri Jun 1 05:04:49 PDT 2007


On Fri, 2007-06-01 at 12:56 +0100, Richard Purdie wrote:
> > Richard, would you let me write a patch to fix this or are you already
> > doing this? Thanks.
> 
> I'd started something, I've finished it off and added it to the LEDs
> tree:
> 
> http://git.o-hand.com/?p=linux-rpurdie-leds;a=shortlog;h=for-mm

Cool, but rather than doing:

+       /* skip first field */
+       while (*str != ':' && *str != '\0')
+               str++;
+
+       if (*str == ':') {
+               str++;
+               colour = str;
+               while (*str != ':' && *str != '\0') {
+                       str++;
+                       len++;
+               }
+               memcpy(buf, colour, len);
+       }

Why not just add to the API to do:

static struct led_classdev standby_led = {
	.name			= "thinkpad_standby",
	.color			= "green",
	.default_trigger	= "none",
	.brightness_set		= led_standby_set,
};

Richard.




More information about the hal mailing list