aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/apm821xx/base-files
diff options
context:
space:
mode:
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
}