c330674fe333529e29bc23190979f5f1e0f02171
[openwrt.git] / target / linux / brcm63xx / base-files / etc / diag.sh
1 #!/bin/sh
2 # Copyright (C) 2007-2013 OpenWrt.org
3
4 . /lib/functions/leds.sh
5 . /lib/brcm63xx.sh
6
7 set_state() {
8         case "$(brcm63xx_board_name)" in
9         a4001n1)
10                 status_led="A4001N1:green:power"
11                 ;;
12         a4001n)
13                 status_led="A4001N:green:power"
14                 ;;
15         ar-5381u)
16                 status_led="AR-5381u:green:power"
17                 ;;
18         ar-5387un)
19                 status_led="AR-5387un:green:power"
20                 ;;
21         bcm96348gw)
22                 status_led="96348GW:green:power"
23                 ;;
24         bcm963281tan)
25                 status_led="963281TAN::power"
26                 ;;
27         bcm96328avng)
28                 status_led="96328avng::power"
29                 ;;
30         bcm96348gw-11)
31                 status_led="96348GW-11:green:power"
32                 ;;
33         spw303v)
34                 status_led="spw303v:green:power+adsl"
35                 ;;
36         vr-3025un)
37                 status_led="VR-3025un:green:power"
38                 ;;
39         vr-3025u)
40                 status_led="VR-3025u:green:power"
41                 ;;
42         wap-5813n)
43                 status_led="WAP-5813n:green:power"
44                 ;;
45         ar1004g)
46                 status_led="AR1004G:green:power"
47                 ;;
48         dsl-274xb-c)
49                 status_led="dsl-274xb:green:power"
50                 ;;
51         dsl-275xb-d)
52                 status_led="dsl-275xb:green:power"
53                 ;;
54         cpva642)
55                 status_led="CPVA642:green:power:"
56                 ;;
57         ct536_ct5621)
58                 status_led="CT536_CT5621:green:power"
59                 ;;
60         cvg834g)
61                 status_led="CVG834G:green:power"
62                 ;;
63         dsl-2640b-b)
64                 status_led="D-4P-W:green:power"
65                 ;;
66         dgnd3700v1_dgnd3800b)
67                 status_led="DGND3700v1_3800B:green:power"
68                 ;;
69         fast2504n)
70                 status_led="fast2504n:green:ok"
71                 ;;
72         fast2704v2)
73                 status_led="F@ST2704V2:green:power"
74                 ;;
75         homehub2a)
76                 status_led="HOMEHUB2A:green:upgrading"
77                 status_led2="HOMEHUB2A:blue:upgrading"
78                 ;;
79         gw6200)
80                 status_led="GW6200:green:line1"
81                 status_led2="GW6200:green:tel"
82                 ;;
83         hg553)
84                 status_led="HW553:blue:power"
85                 ;;
86         hg556a_*)
87                 status_led="HW556:red:power"
88                 ;;
89         hg520)
90                 status_led="HW520:green:net"
91                 ;;
92         hg655b)
93                 status_led="HW65x:green:power"
94                 ;;
95         p870hw-51a_v2)
96                 status_led="P870HW-51a:green:power"
97                 ;;
98         rta770bw)
99                 status_led="RTA770BW:green:diag"
100                 ;;
101         rta770w)
102                 status_led="RTA770W:green:diag"
103                 ;;
104         spw500v)
105                 status_led="SPW500V:green:power"
106                 ;;
107         v2110)
108                 status_led="V2110:power:green"
109                 ;;
110         esac
111
112         case "$1" in
113         preinit)
114                 status_led_set_timer 200 200
115                 ;;
116         failsafe)
117                 status_led_set_timer 50 50
118                 ;;
119         preinit_regular)
120                 status_led_set_timer 500 500
121                 ;;
122         done)
123                 if [ "${status_led/power}" != "$status_led" ]; then
124                         status_led_on
125                 else
126                         status_led_off
127                 fi
128                 ;;
129         esac
130 }