lantiq: diag.sh with both red and green power LEDs
authorJohn Crispin <john@openwrt.org>
Mon, 10 Jun 2013 08:25:02 +0000 (08:25 +0000)
committerJohn Crispin <john@openwrt.org>
Mon, 10 Jun 2013 08:25:02 +0000 (08:25 +0000)
This provides a boot LED sequence suitable for devices with both red and
green LEDs for power. This assumes no "default-on" settings in the
device tree.

Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
SVN-Revision: 36899

target/linux/lantiq/base-files/etc/diag.sh

index 9e0e1701cb62025e5fb896891ada43f8cba20d98..a6cb823581a3a99e365cf8773d56ff8007853572 100644 (file)
@@ -6,6 +6,26 @@
 status_led="power"
 
 set_state() {
+       [ -d /sys/class/leds/power2/ ] && {
+
+               case "$1" in
+               preinit)
+                       led_set_attr "power2" "trigger" "heartbeat"
+                       ;;
+               init)
+                       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