lantiq: diag - switch off the power led on failsafe
[openwrt/staging/lynxis/omap.git] / target / linux / lantiq / base-files / etc / diag.sh
1 #!/bin/sh
2 # Copyright (C) 2010-2015 OpenWrt.org
3
4 . /lib/functions/leds.sh
5 . /lib/functions/lantiq.sh
6
7 boot="$(lantiq_get_dt_led_chosen boot)"
8 failsafe="$(lantiq_get_dt_led_chosen failsafe)"
9 running="$(lantiq_get_dt_led_chosen running)"
10
11 set_state() {
12 status_led="$boot"
13
14 case "$1" in
15 preinit)
16 status_led_blink_preinit
17 ;;
18 failsafe)
19 status_led_off
20 [ -n "$running" ] && {
21 status_led="$running"
22 status_led_off
23 }
24 status_led="$failsafe"
25 status_led_blink_failsafe
26 ;;
27 preinit_regular)
28 status_led_blink_preinit_regular
29 ;;
30 done)
31 status_led_off
32 [ -n "$running" ] && {
33 status_led="$running"
34 status_led_on
35 }
36 ;;
37 esac
38 }