ar71xx: add status led found on ew-dorin boards
[openwrt/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 | rocket-m-xw | nano-m | nanostation-m | nanostation-m-xw | loco-m-xw)
38 status_led="ubnt:green:link4"
39 ;;
40 bxu2000n-2-a1)
41 status_led="bhu:green:status"
42 ;;
43 cap4200ag)
44 status_led="senao:green:pwr"
45 ;;
46 cpe510)
47 status_led="tp-link:green:link4"
48 ;;
49 db120)
50 status_led="db120:green:status"
51 ;;
52 dgl-5500-a1 |\
53 dhp-1565-a1|\
54 dir-505-a1 |\
55 dir-600-a1 |\
56 dir-615-e1 |\
57 dir-615-e4)
58 status_led="d-link:green:power"
59 ;;
60 dir-615-c1)
61 status_led="d-link:green:status"
62 ;;
63 dir-825-b1)
64 status_led="d-link:orange:power"
65 ;;
66 dir-825-c1 |\
67 dir-835-a1)
68 status_led="d-link:amber:power"
69 ;;
70 dragino2)
71 status_led="dragino2:red:system"
72 ;;
73 eap300v2)
74 status_led="engenius:blue:power"
75 ;;
76 eap7660d)
77 status_led="eap7660d:green:ds4"
78 ;;
79 el-mini | \
80 el-m150)
81 status_led="easylink:green:system"
82 ;;
83 ew-dorin | ew-dorin-router)
84 status_led="dorin:green:status"
85 ;;
86 f9k1115v2)
87 status_led="belkin:blue:status"
88 ;;
89 gl-inet)
90 status_led="gl-connect:green:lan"
91 ;;
92 esr1750)
93 status_led="esr1750:amber:power"
94 ;;
95 esr900)
96 status_led="engenius:amber:power"
97 ;;
98 hiwifi-hc6361)
99 status_led="hiwifi:blue:system"
100 ;;
101 hornet-ub | \
102 hornet-ub-x2)
103 status_led="alfa:blue:wps"
104 ;;
105 ja76pf | \
106 ja76pf2)
107 status_led="jjplus:green:led1"
108 ;;
109 ls-sr71)
110 status_led="ubnt:green:d22"
111 ;;
112 mc-mac1200r)
113 status_led="mercury:green:system"
114 ;;
115 mr600)
116 status_led="mr600:orange:power"
117 ;;
118 mr600v2)
119 status_led="mr600:blue:power"
120 ;;
121 mr900 | \
122 mr900v2)
123 status_led="mr900:blue:power"
124 ;;
125 mynet-n600 | \
126 mynet-n750)
127 status_led="wd:blue:power"
128 ;;
129 mynet-rext)
130 status_led="wd:blue:power"
131 ;;
132 mzk-w04nu | \
133 mzk-w300nh)
134 status_led="planex:green:status"
135 ;;
136 nbg460n_550n_550nh)
137 status_led="nbg460n:green:power"
138 ;;
139 nbg6716)
140 status_led="zyxel:white:power"
141 ;;
142 om2p | \
143 om2pv2 | \
144 om2p-hs | \
145 om2p-hsv2 | \
146 om2p-lc)
147 status_led="om2p:blue:power"
148 ;;
149 om5p | \
150 om5p-an)
151 status_led="om5p:blue:power"
152 ;;
153 pb44)
154 status_led="pb44:amber:jump1"
155 ;;
156 rb-2011l|\
157 rb-2011uas|\
158 rb-2011uas-2hnd)
159 status_led="rb:green:usr"
160 ;;
161 rb-411 | rb-411u | rb-433 | rb-433u | rb-450 | rb-450g | rb-493)
162 status_led="rb4xx:yellow:user"
163 ;;
164 rb-750)
165 status_led="rb750:green:act"
166 ;;
167 rb-911g-2hpnd|\
168 rb-911g-5hpacd|\
169 rb-911g-5hpnd|\
170 rb-912uag-2hpnd|\
171 rb-912uag-5hpnd)
172 status_led="rb:green:user"
173 ;;
174 rb-951ui-2hnd)
175 status_led="rb:green:act"
176 ;;
177 rb-sxt2n|\
178 rb-sxt5n)
179 status_led="rb:green:power"
180 ;;
181 routerstation | routerstation-pro)
182 status_led="ubnt:green:rf"
183 ;;
184 rw2458n)
185 status_led="rw2458n:green:d3"
186 ;;
187 smart-300)
188 status_led="nc-link:green:system"
189 ;;
190 oolite)
191 status_led="oolite:red:system"
192 ;;
193 qihoo-c301)
194 status_led="qihoo:green:status"
195 ;;
196 tew-632brp)
197 status_led="tew-632brp:green:status"
198 ;;
199 tew-673gru)
200 status_led="trendnet:blue:wps"
201 ;;
202 tew-712br|\
203 tew-732br)
204 status_led="trendnet:green:power"
205 ;;
206 tl-mr3020)
207 status_led="tp-link:green:wps"
208 ;;
209 tl-wa750re)
210 status_led="tp-link:orange:re"
211 ;;
212 tl-wa850re)
213 status_led="tp-link:blue:re"
214 ;;
215 tl-wa860re)
216 status_led="tp-link:green:power"
217 ;;
218 tl-mr3220 | \
219 tl-mr3220-v2 | \
220 tl-mr3420 | \
221 tl-mr3420-v2 | \
222 tl-wa701nd-v2 | \
223 tl-wa801nd-v2 | \
224 tl-wa901nd | \
225 tl-wa901nd-v2 | \
226 tl-wa901nd-v3 | \
227 tl-wdr3500 | \
228 tl-wr1041n-v2 | \
229 tl-wr1043nd | \
230 tl-wr1043nd-v2 | \
231 tl-wr741nd | \
232 tl-wr741nd-v4 | \
233 tl-wr841n-v1 | \
234 tl-wr841n-v7 | \
235 tl-wr841n-v8 | \
236 tl-wa830re-v2 | \
237 tl-wr842n-v2 | \
238 tl-wr941nd | \
239 tl-wr941nd-v5)
240 status_led="tp-link:green:system"
241 ;;
242 archer-c5 | \
243 archer-c7 | \
244 tl-wdr4900-v2 | \
245 tl-mr10u | \
246 tl-mr12u | \
247 tl-mr13u | \
248 tl-wdr4300 | \
249 tl-wr703n | \
250 tl-wr710n | \
251 tl-wr720n-v3)
252 status_led="tp-link:blue:system"
253 ;;
254 tl-wr841n-v9)
255 status_led="tp-link:green:qss"
256 ;;
257 tl-wr2543n)
258 status_led="tp-link:green:wps"
259 ;;
260 tube2h)
261 status_led="alfa:green:signal4"
262 ;;
263 unifi)
264 status_led="ubnt:green:dome"
265 ;;
266 uap-pro)
267 status_led="ubnt:white:dome"
268 ;;
269 unifi-outdoor-plus)
270 status_led="ubnt:white:front"
271 ;;
272 airgateway)
273 status_led="ubnt:white:status"
274 ;;
275 whr-g301n | \
276 whr-hp-g300n | \
277 whr-hp-gn | \
278 wzr-hp-g300nh)
279 status_led="buffalo:green:router"
280 ;;
281 wlae-ag300n)
282 status_led="buffalo:green:status"
283 ;;
284 wzr-hp-ag300h | \
285 wzr-hp-g300nh2)
286 status_led="buffalo:red:diag"
287 ;;
288 r6100 | \
289 wndap360 | \
290 wndr3700 | \
291 wndr3700v4 | \
292 wndr4300 | \
293 wnr2000 | \
294 wnr2200 |\
295 wnr612-v2 |\
296 wnr1000-v2)
297 status_led="netgear:green:power"
298 ;;
299 wp543)
300 status_led="wp543:green:diag"
301 ;;
302 wpj344)
303 status_led="wpj344:green:status"
304 ;;
305 wpj558)
306 status_led="wpj558:green:sig3"
307 ;;
308 wrt400n)
309 status_led="wrt400n:blue:wps"
310 ;;
311 wrt160nl)
312 status_led="wrt160nl:blue:wps"
313 ;;
314 zcn-1523h-2 | zcn-1523h-5)
315 status_led="zcn-1523h:amber:init"
316 ;;
317 wlr8100)
318 status_led="sitecom:amber:status"
319 ;;
320 esac
321 }
322
323 set_state() {
324 get_status_led
325
326 case "$1" in
327 preinit)
328 status_led_blink_preinit
329 ;;
330 failsafe)
331 status_led_blink_failsafe
332 ;;
333 preinit_regular)
334 status_led_blink_preinit_regular
335 ;;
336 done)
337 status_led_on
338 case $(ar71xx_board_name) in
339 qihoo-c301)
340 local n=$(fw_printenv activeregion | cut -d = -f 2)
341 fw_setenv "image${n}trynum" 0
342 ;;
343 esac
344 ;;
345 esac
346 }