aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/apm821xx/base-files
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@gmail.com>2017-11-28 22:51:07 +0100
committerJohn Crispin <john@phrozen.org>2017-12-14 09:29:30 +0100
commit6ad56fb34c7498084659f3bf1b501f104aa76879 (patch)
tree0de5941e0e10963d700f385e4d6848e2104b6413 /target/linux/apm821xx/base-files
parentda6fdce3652529ca255f66293645aeb28ad81eb3 (diff)
downloadupstream-6ad56fb34c7498084659f3bf1b501f104aa76879.tar.gz
upstream-6ad56fb34c7498084659f3bf1b501f104aa76879.tar.bz2
upstream-6ad56fb34c7498084659f3bf1b501f104aa76879.zip
apm821xx: convert to dt based diag LED script
Please note that users with a Netgear WNDR4700 will need to update the device-tree partition manually. For instructions, please refere to commit 49856a4bb581 ("apm821xx: make it possible to update the dtb partition on the WNDR4700") Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/apm821xx/base-files')
-rwxr-xr-xtarget/linux/apm821xx/base-files/etc/diag.sh48
1 files changed, 25 insertions, 23 deletions
diff --git a/target/linux/apm821xx/base-files/etc/diag.sh b/target/linux/apm821xx/base-files/etc/diag.sh
index eb9b04b525..e45f2a8522 100755
--- a/target/linux/apm821xx/base-files/etc/diag.sh
+++ b/target/linux/apm821xx/base-files/etc/diag.sh
@@ -3,40 +3,42 @@
. /lib/functions.sh
. /lib/functions/leds.sh
-get_status_led() {
- local board=$(board_name)
-
- case $board in
- mbl|\
- mr24|\
- mx60|\
- wndr4700)
- status_led="$board:green:power"
- ;;
-
- *)
- ;;
- esac
-}
+boot="$(get_dt_led boot)"
+failsafe="$(get_dt_led failsafe)"
+running="$(get_dt_led running)"
+upgrade="$(get_dt_led upgrade)"
set_state() {
- get_status_led
+ status_led="$boot"
case "$1" in
+ preinit_regular)
+ status_led_blink_preinit_regular
+ ;;
preinit)
status_led_blink_preinit
;;
-
failsafe)
+ status_led_off
+ [ -n "$running" ] && {
+ status_led="$running"
+ status_led_off
+ }
+ status_led="$failsafe"
status_led_blink_failsafe
;;
-
- preinit_regular)
- status_led_blink_preinit_regular
- ;;
-
+ upgrade)
+ [ -n "$running" ] && {
+ status_led="$upgrade"
+ status_led_blink_preinit_regular
+ }
+ ;;
done)
- status_led_on
+ status_led_off
+ [ -n "$running" ] && {
+ status_led="$running"
+ status_led_on
+ }
;;
esac
}