[OpenWrt-Devel] [PATCH] lantiq: fix led setup after switch to uci-defaults-new.sh

Mathias Kresin openwrt at kresin.me
Tue Dec 8 16:52:13 EST 2015


The switch to uci-defaults-new.sh revealed a bug in the former used
uci-defaults.sh, which failed to add leds with colons in the led name.

This bug isn't any longer present in uci-defaults-new.sh and therefore
all via DT defined leds will be added to /etc/config/system with their initial
on/off state, regardless whether they are already added by the board specific
led mappings.

This results for a BTHOMEHUBV5A into the following led configuration:

- soc:blue:power is added as led_power with the initial state "switched on"
- soc:blue:power is added as led_soc_blue_power with the initial state "switched off"

With the final result of a switched off power led after boot.

The only led that needs to be added is the BTHOMEHUBV5A specific dimmed led.

Signed-off-by: Mathias Kresin <openwrt at kresin.me>
---

The loop was introduced with r34698 to compact the leds file. The mentioned bug
of uci-defaults.sh can be seen in paste [1].

Based on the commit diff and the current device tree files of the boards that
where removed with r34698 from the leds file, I'm sure the
ucidef_set_led_default calls where used to initially switch off active_low
leds.

Nowdays this isn't needed, as GPIO active_low/active_high is set via DT and
the default state for leds is "switched off".

The "default" leds power, power1, power2 and dsl do not have to be added. They
are hardcoded in the platform specific scripts. I will fix this hardcoding
after this patch is merged.

[1] http://paste.debian.net/hidden/13e5218b/

 target/linux/lantiq/base-files/etc/board.d/01_leds | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/target/linux/lantiq/base-files/etc/board.d/01_leds b/target/linux/lantiq/base-files/etc/board.d/01_leds
index 2dc641e..74d74c4 100755
--- a/target/linux/lantiq/base-files/etc/board.d/01_leds
+++ b/target/linux/lantiq/base-files/etc/board.d/01_leds
@@ -27,11 +27,17 @@ BTHOMEHUBV2B)
 	ucidef_set_led_netdev "internet" "internet" "soc:blue:broadband" "pppoa-wan"
 	ucidef_set_led_usbdev "usb" "usb" "soc:blue:phone" "1-1"
 	;;
-BTHOMEHUBV3A|BTHOMEHUBV5A)
+BTHOMEHUBV3A)
 	ucidef_set_led_default "power" "power" "soc:blue:power" "1"
 	ucidef_set_led_wlan "wifi" "wifi" "soc:blue:wireless" "phy0tpt"
 	ucidef_set_led_netdev "internet" "internet" "soc:blue:broadband" "pppoa-wan"
 	;;
+BTHOMEHUBV5A)
+	ucidef_set_led_default "power" "power" "soc:blue:power" "1"
+	ucidef_set_led_wlan "wifi" "wifi" "soc:blue:wireless" "phy0tpt"
+	ucidef_set_led_netdev "internet" "internet" "soc:blue:broadband" "pppoa-wan"
+	ucidef_set_led_default "dimmed" "dimmed" "dimmed" "0"
+	;;
 VGV7510KW22)
 	ucidef_set_led_default "power" "power" "power" "1"
 	ucidef_set_led_default "power2" "power2" "power2" "0"
@@ -69,11 +75,6 @@ ARV8539PW22)
 	;;
 esac
 
-for a in `ls /sys/class/leds/`; do
-	grep -q "\[none\]" /sys/class/leds/$a/trigger
-	[ $? -eq 0 ] && ucidef_set_led_default $a $a $a `cat /sys/class/leds/$a/brightness`
-done
-
 board_config_flush
 
 exit 0
-- 
1.9.1
_______________________________________________
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