diff options
author | John Crispin <blogic@openwrt.org> | 2016-04-26 07:52:00 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2016-04-26 07:52:00 +0000 |
commit | cfd76783d2012fc2c5241456bb5d57702ead9aaa (patch) | |
tree | 8d452e48af716eab6755167881c81f165d695ed5 | |
parent | 420cb24d41fcd650795f09d2b26e0e1d2cf21165 (diff) | |
download | upstream-cfd76783d2012fc2c5241456bb5d57702ead9aaa.tar.gz upstream-cfd76783d2012fc2c5241456bb5d57702ead9aaa.tar.bz2 upstream-cfd76783d2012fc2c5241456bb5d57702ead9aaa.zip |
lantiq: Fix LED handling.
Backport of r47914 to CC.
Without this patch the TDW8970 is left without any status LED at all,
even during preinit and failsafe.
Signed-off-by: Vittorio Gambaletta <openwrt@vittgam.net>
git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@49230 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r-- | target/linux/lantiq/base-files/etc/diag.sh | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/target/linux/lantiq/base-files/etc/diag.sh b/target/linux/lantiq/base-files/etc/diag.sh index 26f0a3c8a9..57a7055127 100644 --- a/target/linux/lantiq/base-files/etc/diag.sh +++ b/target/linux/lantiq/base-files/etc/diag.sh @@ -3,40 +3,48 @@ . /lib/functions/leds.sh -status_led="power" +status_led=power +[ ! -d /sys/class/leds/power/ ] && [ ! -d /sys/class/leds/power1/ ] && [ ! -d /sys/class/leds/power2/ ] && [ -d /sys/class/leds/wps/ ] && status_led=wps set_state() { - [ -d /sys/class/leds/power2/ ] && { - - case "$1" in - preinit) - led_set_attr "power2" "trigger" "heartbeat" - status_led_on - ;; - failsafe) - led_off "power2" - status_led_set_timer 100 100 - ;; - done) - led_off "power2" - ;; - esac - return - } - case "$1" in preinit) - status_led_set_heartbeat + if [ -d /sys/class/leds/power2/ ]; then + status_led_on + status_led=power2 + status_led_blink_preinit + status_led=power + else + status_led_blink_preinit + fi ;; failsafe) - [ -d /sys/class/leds/power1 ] && { + if [ -d /sys/class/leds/power2/ ]; then + led_off power2 + status_led_blink_failsafe + elif [ -d /sys/class/leds/power1/ ]; then status_led_off - led_timer "power1" 100 100 - } || status_led_set_timer 100 100 + status_led=power1 + status_led_blink_failsafe + status_led=power + else + status_led_blink_failsafe + fi + ;; + preinit_regular) + if [ -d /sys/class/leds/power2/ ]; then + status_led_on + status_led=power2 + status_led_blink_preinit_regular + status_led=power + else + status_led_blink_preinit_regular + fi ;; done) status_led_on - led_off "power1" + led_off power1 + led_off power2 ;; esac } |