aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/base-files/etc/diag.sh
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2016-01-01 21:18:47 +0000
committerJohn Crispin <blogic@openwrt.org>2016-01-01 21:18:47 +0000
commit1351936e19016ff3d93fc1fd8e8e0201a4d07c2e (patch)
treee2d01b54481f0d40ffddc82eb8d0da07adf15df0 /target/linux/lantiq/base-files/etc/diag.sh
parent729c6ff67429d3f5ee50d825333f6e2e6c2dcb70 (diff)
downloadmaster-187ad058-1351936e19016ff3d93fc1fd8e8e0201a4d07c2e.tar.gz
master-187ad058-1351936e19016ff3d93fc1fd8e8e0201a4d07c2e.tar.bz2
master-187ad058-1351936e19016ff3d93fc1fd8e8e0201a4d07c2e.zip
lantiq: add support for indicating the boot state using three leds
The BTHOMEHUBV5A has a RGB power led, where every colour is perfect to indicate the current boot state. This patch adds support for such cases. The existing led sequences should be the same as before. Boards which are using a led different from power (like TDW89x0) are changed to switch of the led after boot Signed-off-by: Mathias Kresin <openwrt@kresin.me> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48041 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/lantiq/base-files/etc/diag.sh')
-rw-r--r--target/linux/lantiq/base-files/etc/diag.sh52
1 files changed, 16 insertions, 36 deletions
diff --git a/target/linux/lantiq/base-files/etc/diag.sh b/target/linux/lantiq/base-files/etc/diag.sh
index 0e65e6133b..8356bcda69 100644
--- a/target/linux/lantiq/base-files/etc/diag.sh
+++ b/target/linux/lantiq/base-files/etc/diag.sh
@@ -1,54 +1,34 @@
#!/bin/sh
-# Copyright (C) 2012-2013 OpenWrt.org
+# Copyright (C) 2010-2015 OpenWrt.org
. /lib/functions/leds.sh
. /lib/functions/lantiq.sh
-power="$(lantiq_get_dt_led_chosen power)"
-power1="$(lantiq_get_dt_led_chosen power1)"
-power2="$(lantiq_get_dt_led_chosen power2)"
-
-status_led="$power"
+boot="$(lantiq_get_dt_led_chosen boot)"
+failsafe="$(lantiq_get_dt_led_chosen failsafe)"
+running="$(lantiq_get_dt_led_chosen running)"
set_state() {
+ status_led="$boot"
+
case "$1" in
preinit)
- if [ -n "$power2" ]; then
- status_led_on
- status_led="$power2"
- status_led_blink_preinit
- status_led="$power"
- else
- status_led_blink_preinit
- fi
+ status_led_blink_preinit
;;
failsafe)
- if [ -n "$power2" ]; then
- led_off "$power2"
- status_led_blink_failsafe
- elif [ -n "$power1" ]; then
- status_led_off
- status_led="$power1"
- status_led_blink_failsafe
- status_led="$power"
- else
- status_led_blink_failsafe
- fi
+ status_led_off
+ status_led="$failsafe"
+ status_led_blink_failsafe
;;
preinit_regular)
- if [ -n "$power2" ]; then
- status_led_on
- status_led="$power2"
- status_led_blink_preinit_regular
- status_led="$power"
- else
- status_led_blink_preinit_regular
- fi
+ status_led_blink_preinit_regular
;;
done)
- status_led_on
- led_off "$power1"
- led_off "$power2"
+ status_led_off
+ [ -n "$running" ] & {
+ status_led="$running"
+ status_led_on
+ }
;;
esac
}