[OpenWrt-Devel] [PATCH 05/13] ramips: use consistent naming scheme for LEDs, for various manufacturers

Piotr Dymacz pepe2k at gmail.com
Mon Jul 27 05:05:00 EDT 2015


2015-07-26 23:59 GMT+02:00 Jonas Gorski <jogo at openwrt.org>:
> On Sun, Jul 26, 2015 at 9:34 PM, Piotr Dymacz <pepe2k at gmail.com> wrote:
>> 2015-07-26 21:16 GMT+02:00 Imre Kaloz <kaloz at openwrt.org>:
>>>
>>> On Sun, 26 Jul 2015 18:24:30 +0200, Piotr Dymacz <pepe2k at gmail.com> wrote:
>>>
>>>> For some boards in ramips (and other targets) naming scheme for LEDs is:
>>>> "manufacturer:color:led-name", but there are many other boards which don't
>>>> follow this approach.
>>>
>>>
>>> The upstream convention is "device:color:led-name". So actually, the wrong way is where we do the other way around.

[...]

>> And, when the convention was changed?
>
> It has always been this way since 2006:
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=75c1d31d9ea71025b73430c696b727e8aa15872d
>
> only the ":function" part was added a year later.

I asked the wrong question - I missed the "upstream" word, sorry for that.

I always thought that OpenWrt uses its own naming scheme
("manufacturer:color:led-name"), for a specific reason.
There are many boards, for example in ar71xx target, with same LED
name for the "status LED", for a long time now:

[...]
    tl-wa830re-v2 | \
    tl-wr842n-v2 | \
    tl-wr941nd | \
    tl-wr941nd-v5)
        status_led="tp-link:green:system"
[...]

With the current approach, with common diag.sh script for all boards
in same target, switching to upstream convention will give there
hundreds of new lines of code (every board will get its own unique
name for LED).
I know about plans to make board detection with JSON data [1], but
maybe till it's done, we could do that:

1. Fix LEDs naming scheme for boards and use the upstream convention
("device:color:led-name").
2. Make "small" optimization in diag.sh and 01_leds scripts and instead of this:

[...]
case $(ramips_board_name) in
[...]
    boardX)
        status_led="boardX:green:power"
        ;;
    boardY)
        status_led="boardY:green:power"
        ;;
    boardZ)
        status_led="boardZ:green:power"
        ;;
[...]

Make it that way:

case $(ramips_board_name) in
[...]
    boardX|\
    boardY|\
    boardZ\)
        status_led="$(ramips_board_name):green:power"
        ;;
[...]

That would allow to combine together boards with same LEDs
colors/names (which is common for boards from same manufacturer) and
in result - shrink the code.

>> That's bad news... I will fix it.
>> But, why then patches with wrong convention are still accepted?
[...]
> Sometimes things slip through. People do mistakes.

Sure, nobody's perfect.

Cheers,
Piotr

[1] https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg32357.html
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list