aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/base-files
diff options
context:
space:
mode:
authorMathias Kresin <dev@kresin.me>2018-08-28 06:54:27 +0200
committerMathias Kresin <dev@kresin.me>2018-10-07 11:34:18 +0200
commit8f4dfadd5a4370e455f08967bfe9b7c9125576e8 (patch)
tree9d6e6865be40a071ada8650a241e4740b01d61d8 /target/linux/ramips/base-files
parent772b27c207364f31f8b34b80a94647810fdb581c (diff)
downloadupstream-8f4dfadd5a4370e455f08967bfe9b7c9125576e8.tar.gz
upstream-8f4dfadd5a4370e455f08967bfe9b7c9125576e8.tar.bz2
upstream-8f4dfadd5a4370e455f08967bfe9b7c9125576e8.zip
ramips: add support for indicating the boot state using multiple leds
Use diag.sh version used for other targets supporting different leds for the different boot states. The existing led sequences should be the same as before. Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'target/linux/ramips/base-files')
-rw-r--r--target/linux/ramips/base-files/etc/diag.sh29
1 files changed, 25 insertions, 4 deletions
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index d4318b61a7..3ea7ac1a1d 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -1,24 +1,45 @@
#!/bin/sh
-# Copyright (C) 2010-2013 OpenWrt.org
. /lib/functions/leds.sh
-status_led="$(get_dt_led status)"
+boot="$(get_dt_led boot)"
+failsafe="$(get_dt_led failsafe)"
+running="$(get_dt_led running)"
+upgrade="$(get_dt_led upgrade)"
set_state() {
+ status_led="$boot"
+
case "$1" in
preinit)
status_led_blink_preinit
;;
failsafe)
+ status_led_off
+ [ -n "$running" ] && {
+ status_led="$running"
+ status_led_off
+ }
+ status_led="$failsafe"
status_led_blink_failsafe
;;
- upgrade | \
preinit_regular)
status_led_blink_preinit_regular
;;
+ upgrade)
+ [ -n "$running" ] && {
+ status_led="$running"
+ status_led_off
+ }
+ status_led="$upgrade"
+ status_led_blink_preinit_regular
+ ;;
done)
- status_led_on
+ status_led_off
+ [ -n "$running" ] && {
+ status_led="$running"
+ status_led_on
+ }
;;
esac
}