Minor patch to the AR7 diag.sh to make the status LED a bit more useful. From the...
[openwrt-10.03/.git] / target / linux / ar7 / base-files / etc / diag.sh
1 #!/bin/sh
2 # Copyright (C) 2007 OpenWrt.org
3
4 # This setup gives us 3.5 distinguishable states:
5 #
6 # Solid OFF:  Bootloader running, or kernel hung (timer task stalled)
7 # Solid ON:   Kernel hung (timer task stalled)
8 # 5Hz blink:  preinit
9 # Heartbeat:  normal operation
10
11 set_state() {
12         case "$1" in
13                 preinit)
14                         [ -d /sys/class/leds/status ] && {
15                                 echo timer >/sys/class/leds/status/trigger
16                                 echo 100 >/sys/class/leds/status/delay_on
17                                 echo 100 >/sys/class/leds/status/delay_off
18                         }
19                 ;;
20                 done)
21                         [ -d /sys/class/leds/status ] && {
22                                 echo heartbeat >/sys/class/leds/status/trigger
23                         }
24                 ;;
25         esac
26 }