LED naming standard for LED class

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Henrique de Moraes Holschuh
Date: Sunday, March 16, 2008 - 8:34 pm

(changing the subject.  Newcomers, the context is given by commit
6c152beefbf90579d21afc4f7e075b1f801f9a75).

On Sun, 16 Mar 2008, Henrique de Moraes Holschuh wrote:

Ok, I looked at it from various angles, and did some heavy thinking about
it.

Richard, isn't there *any* way to change this new ABI?  It has not been in
any stable mainline release yet, so it is not too late if we do it now.

Even if the lenght limit for sysfs entries (19 chars + NULL) is lifted in
2.6.26, the current proposal that would become stable in 2.6.25 is still
ugly, and not nearly close to the best we could do, IMHO.

The only technical reason I can see for the "devicename" part of the LED
name is to avoid clashes (or as a placeholder when you have no function).
However, it is the least important information for any sort of generic LED
tool (which is the only reason to even bother with a LED naming standard to
begin with), so it certainly should not come first in the name.  And there
are other ways to avoid clashes that waste far less real state than the
device name.

Can't we have "function[:color].<number>" instead?   And allow for a choice
of "devicename" or simply "led" instead of "function" for leds with no
defined or implied function?

It places fields in order of importance (thus it is far more user-friendly),
it wastes less real state (typically just two chars) to avoid clashes, and
it also follows what we already have on other sysfs subsystems (except for
the :color part, and I agree with you that it is a desireable thing to have
in there).

The clash-avoiding ".%d" postfix would be taken care of by the class.  If
two devices are registered with a "battery:green" name, you'd end up with
"battery:green.0" and "battery:green.1".  If just one device tries to
register "battery:yellow", you'd get "battery:yellow.0".

Later (for 2.6.26) I'd also suggest adding the color notion to the *class*
itself, including the notion of "undefined" color.  The class would take
care to add the ":color" part of the node name (when it is not "undefined")
and *also* export the color as an attribute. I can write this patch too, if
you want.

Would you take patches to implement the "function[:color].<ordinal>" naming
scheme, and try to merge them into 2.6.25?  Avoiding a bad ABI becoming
stable *is* an acceptable reason for a late merge.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT PULL] LED updates, Richard Purdie, (Thu Feb 7, 3:35 am)
Re: [GIT PULL] LED updates, Henrique de Moraes H ..., (Thu Feb 7, 2:38 pm)
Re: [GIT PULL] LED updates, Richard Purdie, (Thu Feb 7, 3:13 pm)
[PATCH] leds: disable triggers on brightness set, Henrique de Moraes H ..., (Thu Feb 7, 4:23 pm)
Re: [GIT PULL] LED updates, Németh Márton, (Fri Feb 8, 12:03 am)
Re: [GIT PULL] LED updates, Henrique de Moraes H ..., (Fri Feb 8, 4:20 am)
Re: [GIT PULL] LED updates, Németh Márton, (Sun Feb 10, 4:52 am)
Re: [PATCH] leds: disable triggers on brightness set, Németh Márton, (Sun Feb 10, 4:52 am)
Re: [PATCH] leds: disable triggers on brightness set, Richard Purdie, (Sun Feb 17, 4:30 pm)
Re: [PATCH] leds: disable triggers on brightness set, Henrique de Moraes H ..., (Sun Feb 17, 6:59 pm)
Re: [GIT PULL] LED updates, Henrique de Moraes H ..., (Sun Mar 16, 11:18 am)
Re: [GIT PULL] LED updates, Richard Purdie, (Sun Mar 16, 12:29 pm)
Re: [GIT PULL] LED updates, Henrique de Moraes H ..., (Sun Mar 16, 12:48 pm)
LED naming standard for LED class, Henrique de Moraes H ..., (Sun Mar 16, 8:34 pm)
Re: LED naming standard for LED class, Richard Purdie, (Mon Mar 17, 2:51 am)
Re: LED naming standard for LED class, Henrique de Moraes H ..., (Mon Mar 17, 8:35 pm)
Re: LED naming standard for LED class, Henrique de Moraes H ..., (Mon Mar 17, 9:55 pm)