treewide: use the generic board_name function
[openwrt/openwrt.git] / target / linux / mxs / base-files / etc / diag.sh
1 #!/bin/sh
2 # Copyright (C) 2013-2014 OpenWrt.org
3
4 . /lib/functions.sh
5 . /lib/functions/leds.sh
6
7 get_status_led() {
8 case $(board_name) in
9 duckbill)
10 status_led="duckbill:green:status"
11 ;;
12 olinuxino)
13 status_led="green"
14 ;;
15 *)
16 status_led=$(cd /sys/class/leds && ls -1d *:status 2> /dev/null | head -n 1)
17 ;;
18 esac
19 }
20
21 set_state() {
22 get_status_led
23
24 case "$1" in
25 preinit)
26 status_led_blink_preinit
27 ;;
28 failsafe)
29 status_led_blink_failsafe
30 ;;
31 preinit_regular)
32 status_led_blink_preinit_regular
33 ;;
34 done)
35 status_led_on
36 ;;
37 esac
38 }