1456d6eebb9c3177932e4e8cf775d3f1bafd529b
[openwrt.git] / target / linux / ar71xx / base-files / etc / diag.sh
1 #!/bin/sh
2 # Copyright (C) 2009-2013 OpenWrt.org
3
4 . /lib/functions/leds.sh
5 . /lib/ar71xx.sh
6
7 get_status_led() {
8         case $(ar71xx_board_name) in
9         alfa-nx)
10                 status_led="alfa:green:led_8"
11                 ;;
12         all0305)
13                 status_led="eap7660d:green:ds4"
14                 ;;
15         ap132)
16                 status_led="ap132:green:status"
17                 ;;
18         ap136-010|\
19         ap136-020)
20                 status_led="ap136:green:status"
21                 ;;
22         ap135-020)
23                 status_led="ap135:green:status"
24                 ;;
25         ap81)
26                 status_led="ap81:green:status"
27                 ;;
28         ap83)
29                 status_led="ap83:green:power"
30                 ;;
31         ap96)
32                 status_led="ap96:green:led2"
33                 ;;
34         aw-nr580)
35                 status_led="aw-nr580:green:ready"
36                 ;;
37         bullet-m | rocket-m | nano-m | nanostation-m)
38                 status_led="ubnt:green:link4"
39                 ;;
40         cap4200ag)
41                 status_led="senao:green:pwr"
42                 ;;
43         db120)
44                 status_led="db120:green:status"
45                 ;;
46         dir-505-a1 |\
47         dir-600-a1 |\
48         dir-615-e4)
49                 status_led="d-link:green:power"
50                 ;;
51         dir-615-c1)
52                 status_led="d-link:green:status"
53                 ;;
54         dir-825-b1 |\
55         dir-835-a1)
56                 status_led="d-link:orange:power"
57                 ;;
58         dir-825-c1)
59                 status_led="d-link:orange:power"
60                 ;;
61         eap7660d)
62                 status_led="eap7660d:green:ds4"
63                 ;;
64         hornet-ub)
65                 status_led="alfa:blue:wps"
66                 ;;
67         ja76pf | \
68         ja76pf2)
69                 status_led="jjplus:green:led1"
70                 ;;
71         ls-sr71)
72                 status_led="ubnt:green:d22"
73                 ;;
74         mr600)
75                 status_led="mr600:orange:power"
76                 ;;
77         mr600v2)
78                 status_led="mr600:blue:power"
79                 ;;
80         mzk-w04nu | \
81         mzk-w300nh)
82                 status_led="planex:green:status"
83                 ;;
84         nbg460n_550n_550nh)
85                 status_led="nbg460n:green:power"
86                 ;;
87         om2p | \
88         om2p-hs | \
89         om2p-lc)
90                 status_led="om2p:blue:power"
91                 ;;
92         pb44)
93                 status_led="pb44:amber:jump1"
94                 ;;
95         rb-411 | rb-411u | rb-433 | rb-433u | rb-450 | rb-450g | rb-493)
96                 status_led="rb4xx:yellow:user"
97                 ;;
98        rb-750)
99                status_led="rb750:green:act"
100                ;;
101         routerstation | routerstation-pro)
102                 status_led="ubnt:green:rf"
103                 ;;
104         rw2458n)
105                 status_led="rw2458n:green:d3"
106                 ;;
107         tew-632brp)
108                 status_led="tew-632brp:green:status"
109                 ;;
110         tew-673gru)
111                 status_led="trendnet:blue:wps"
112                 ;;
113         tew-712br)
114                 status_led="trendnet:green:power"
115                 ;;
116         tl-mr3020)
117                 status_led="tp-link:green:wps"
118                 ;;
119         tl-mr3220 | \
120         tl-mr3220-v2 | \
121         tl-mr3420 | \
122         tl-mr3420-v2 | \
123         tl-wa901nd | \
124         tl-wa901nd-v2 | \
125         tl-wdr3500 | \
126         tl-wr1041n-v2 | \
127         tl-wr1043nd | \
128         tl-wr741nd | \
129         tl-wr741nd-v4 | \
130         tl-wr841n-v1 | \
131         tl-wr841n-v7 | \
132         tl-wr841n-v8 | \
133         tl-wr941nd)
134                 status_led="tp-link:green:system"
135                 ;;
136         archer-c7 | \
137         tl-mr10u | \
138         tl-mr13u | \
139         tl-wdr4300 | \
140         tl-wr703n | \
141         tl-wr710n | \
142         tl-wr720n-v3)
143                 status_led="tp-link:blue:system"
144                 ;;
145         tl-wr2543n)
146                 status_led="tp-link:green:wps"
147                 ;;
148         unifi)
149                 status_led="ubnt:green:dome"
150                 ;;
151         uap-pro)
152                 status_led="ubnt:white:dome"
153                 ;;
154         whr-g301n | \
155         whr-hp-g300n | \
156         whr-hp-gn | \
157         wzr-hp-g300nh)
158                 status_led="buffalo:green:router"
159                 ;;
160         wlae-ag300n)
161                 status_led="buffalo:green:status"
162                 ;;
163         wzr-hp-ag300h | \
164         wzr-hp-g300nh2)
165                 status_led="buffalo:red:diag"
166                 ;;
167         wndap360)
168                 status_led="wndap360:green:power"
169                 ;;
170         wndr3700)
171                 status_led="wndr3700:green:power"
172                 ;;
173         wndr4300)
174                 status_led="netgear:green:power"
175                 ;;
176         wnr2000)
177                 status_led="wnr2000:green:power"
178                 ;;
179         wnr2200)
180                 status_led="wnr2200:amber:power"
181                 ;;
182         wnr612-v2)
183                 status_led="wnr612v2:green:power"
184                 ;;
185         wp543)
186                 status_led="wp543:green:diag"
187                 ;;
188         wrt400n)
189                 status_led="wrt400n:blue:wps"
190                 ;;
191         wrt160nl)
192                 status_led="wrt160nl:blue:wps"
193                 ;;
194         zcn-1523h-2 | zcn-1523h-5)
195                 status_led="zcn-1523h:amber:init"
196                 ;;
197         esac
198 }
199
200 set_state() {
201         get_status_led
202
203         case "$1" in
204         preinit)
205                 status_led_blink_preinit
206                 ;;
207         failsafe)
208                 status_led_blink_failsafe
209                 ;;
210         done)
211                 status_led_on
212                 ;;
213         esac
214 }