ar71xx: add support for GainStrong Oolite V5.2
[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.sh
5 . /lib/functions/leds.sh
6
7 get_status_led() {
8 local board=$(board_name)
9
10 case $board in
11 a40)
12 status_led="a40:green:status"
13 ;;
14 a60)
15 status_led="a60:green:status"
16 ;;
17 alfa-nx)
18 status_led="alfa:green:led_8"
19 ;;
20 all0305)
21 status_led="eap7660d:green:ds4"
22 ;;
23 antminer-s1|\
24 antminer-s3|\
25 antminer-r1|\
26 e1700ac-v2|\
27 e600gac-v2|\
28 eap120|\
29 minibox-v1|\
30 packet-squirrel|\
31 som9331|\
32 sr3200|\
33 tl-wr802n-v2|\
34 xd3200)
35 status_led="$board:green:system"
36 ;;
37 ap121f)
38 status_led="$board:green:vpn"
39 ;;
40 ap132|\
41 ap531b0|\
42 cpe505n|\
43 db120|\
44 dr342|\
45 dr344|\
46 rut900|\
47 tew-632brp|\
48 tl-wr942n-v1|\
49 wpj344|\
50 zbt-we1526)
51 status_led="$board:green:status"
52 ;;
53 ap136-010|\
54 ap136-020)
55 status_led="ap136:green:status"
56 ;;
57 ap147-010)
58 status_led="ap147:green:status"
59 ;;
60 ap135-020)
61 status_led="ap135:green:status"
62 ;;
63 archer-c25-v1|\
64 archer-c58-v1|\
65 archer-c59-v1|\
66 archer-c60-v1|\
67 archer-c7-v4|\
68 fritz300e|\
69 gl-usb150|\
70 mr12|\
71 mr16|\
72 nbg6616|\
73 sc1750|\
74 sc450|\
75 tl-wpa8630|\
76 tl-wr902ac-v1)
77 status_led="$board:green:power"
78 ;;
79 archer-c5|\
80 archer-c7|\
81 tl-mr10u|\
82 tl-mr12u|\
83 tl-mr13u|\
84 tl-wdr4300|\
85 tl-wdr4900-v2|\
86 tl-wr703n|\
87 tl-wr710n|\
88 tl-wr720n-v3|\
89 tl-wr802n-v1|\
90 tl-wr810n|\
91 tl-wr810n-v2|\
92 tl-wr940n-v4|\
93 tl-wr941nd-v6)
94 status_led="tp-link:blue:system"
95 ;;
96 ap90q|\
97 cpe830|\
98 cpe870|\
99 gl-ar300m|\
100 gl-inet|\
101 gl-mifi)
102 status_led="$board:green:lan"
103 ;;
104 ap91-5g|\
105 n5q)
106 status_led="$board:green:signal4"
107 ;;
108 ap96)
109 status_led="$board:green:led2"
110 ;;
111 aw-nr580)
112 status_led="$board:green:ready"
113 ;;
114 bhr-4grv2|\
115 wzr-hp-ag300h|\
116 wzr-hp-g300nh2)
117 status_led="buffalo:red:diag"
118 ;;
119 bsb)
120 status_led="$board:red:sys"
121 ;;
122 bullet-m|\
123 loco-m-xw|\
124 nano-m|\
125 nanostation-m|\
126 nanostation-m-xw|\
127 rocket-m|\
128 rocket-m-xw)
129 status_led="ubnt:green:link4"
130 ;;
131 bxu2000n-2-a1)
132 status_led="bhu:green:status"
133 ;;
134 cap324)
135 status_led="pcs:green:power"
136 ;;
137 c-55|\
138 c-60)
139 status_led="$board:green:pwr"
140 ;;
141 cap4200ag)
142 status_led="senao:green:pwr"
143 ;;
144 cf-e316n-v2|\
145 cf-e520n|\
146 cf-e530n)
147 status_led="$board:blue:wan"
148 ;;
149 cf-e320n-v2)
150 status_led="$board:blue:wlan"
151 ;;
152 cf-e375ac|\
153 cf-e380ac-v1|\
154 cf-e380ac-v2|\
155 cf-e385ac)
156 status_led="$board:blue:wlan2g"
157 ;;
158 cpe510)
159 status_led="tp-link:green:link4"
160 ;;
161 cr3000|\
162 cr5000)
163 status_led="pcs:amber:power"
164 ;;
165 dgl-5500-a1|\
166 dhp-1565-a1|\
167 dir-505-a1|\
168 dir-600-a1|\
169 dir-615-e1|\
170 dir-615-i1|\
171 dir-615-e4)
172 status_led="d-link:green:power"
173 ;;
174 dir-615-c1)
175 status_led="d-link:green:status"
176 ;;
177 dir-825-b1)
178 status_led="d-link:orange:power"
179 ;;
180 dir-825-c1|\
181 dir-835-a1)
182 status_led="d-link:amber:power"
183 ;;
184 dir-869-a1)
185 status_led="d-link:white:status"
186 ;;
187 dlan-hotspot)
188 status_led="devolo:green:wifi"
189 ;;
190 dlan-pro-500-wp)
191 status_led="devolo:green:wlan-2g"
192 ;;
193 dlan-pro-1200-ac)
194 status_led="devolo:status:wlan"
195 ;;
196 dr531)
197 status_led="$board:green:sig4"
198 ;;
199 dragino2|\
200 oolite-v1)
201 status_led="$board:red:system"
202 ;;
203 dw33d|\
204 r36a)
205 status_led="$board:blue:status"
206 ;;
207 e600g-v2|\
208 oolite-v5.2-dev|\
209 wifi-pineapple-nano)
210 status_led="$board:blue:system"
211 ;;
212 eap300v2)
213 status_led="engenius:blue:power"
214 ;;
215 ens202ext|\
216 esr900)
217 status_led="engenius:amber:power"
218 ;;
219 eap7660d)
220 status_led="$board:green:ds4"
221 ;;
222 el-m150|\
223 el-mini)
224 status_led="easylink:green:system"
225 ;;
226 ew-balin)
227 status_led="balin:green:status"
228 ;;
229 ew-dorin|\
230 ew-dorin-router)
231 status_led="dorin:green:status"
232 ;;
233 f9k1115v2)
234 status_led="belkin:blue:status"
235 ;;
236 epg5000|\
237 esr1750)
238 status_led="$board:amber:power"
239 ;;
240 gl-ar750|\
241 hiveap-121|\
242 nbg6716|\
243 wam250)
244 status_led="$board:white:power"
245 ;;
246 hiwifi-hc6361)
247 status_led="hiwifi:blue:system"
248 ;;
249 hornet-ub|\
250 hornet-ub-x2)
251 status_led="alfa:blue:wps"
252 ;;
253 ja76pf|\
254 ja76pf2)
255 status_led="jjplus:green:led1"
256 ;;
257 jwap230)
258 status_led="$board:green:led1"
259 ;;
260 lan-turtle)
261 status_led="$board:orange:system"
262 ;;
263 ls-sr71)
264 status_led="ubnt:green:d22"
265 ;;
266 mc-mac1200r)
267 status_led="mercury:green:system"
268 ;;
269 mr18|\
270 z1)
271 status_led="$board:green:tricolor0"
272 ;;
273 mr600)
274 status_led="$board:orange:power"
275 ;;
276 mr600v2)
277 status_led="mr600:blue:power"
278 ;;
279 mr1750|\
280 mr1750v2)
281 status_led="mr1750:blue:power"
282 ;;
283 mr900|\
284 mr900v2)
285 status_led="mr900:blue:power"
286 ;;
287 mynet-n600|\
288 mynet-n750|\
289 mynet-rext)
290 status_led="wd:blue:power"
291 ;;
292 mzk-w04nu|\
293 mzk-w300nh)
294 status_led="planex:green:status"
295 ;;
296 nbg460n_550n_550nh)
297 status_led="nbg460n:green:power"
298 ;;
299 om2p|\
300 om2p-hs|\
301 om2p-hsv2|\
302 om2p-hsv3|\
303 om2p-hsv4|\
304 om2p-lc|\
305 om2pv2|\
306 om2pv4)
307 status_led="om2p:blue:power"
308 ;;
309 om5p|\
310 om5p-an)
311 status_led="om5p:blue:power"
312 ;;
313 om5p-ac|\
314 om5p-acv2)
315 status_led="om5pac:blue:power"
316 ;;
317 omy-g1)
318 status_led="omy:green:wlan"
319 ;;
320 omy-x1)
321 status_led="omy:green:power"
322 ;;
323 onion-omega)
324 status_led="onion:amber:system"
325 ;;
326 pb44)
327 status_led="$board:amber:jump1"
328 ;;
329 r602n)
330 status_led="$board:green:wan"
331 ;;
332 rb-2011il|\
333 rb-2011l|\
334 rb-2011uas|\
335 rb-2011uas-2hnd)
336 status_led="rb:green:usr"
337 ;;
338 rb-411|\
339 rb-411u|\
340 rb-433|\
341 rb-433u|\
342 rb-450|\
343 rb-450g|\
344 rb-493)
345 status_led="rb4xx:yellow:user"
346 ;;
347 rb-750)
348 status_led="rb750:green:act"
349 ;;
350 rb-750-r2|\
351 rb-750p-pbr2|\
352 rb-750up-r2|\
353 rb-911-2hn|\
354 rb-911-5hn|\
355 rb-911g-2hpnd|\
356 rb-911g-5hpacd|\
357 rb-911g-5hpnd|\
358 rb-941-2nd|\
359 rb-951ui-2nd|\
360 rb-952ui-5ac2nd|\
361 rb-962uigs-5hact2hnt|\
362 rb-lhg-5nd|\
363 rb-map-2nd|\
364 rb-mapl-2nd)
365 status_led="rb:green:user"
366 ;;
367 rb-951ui-2hnd)
368 status_led="rb:green:act"
369 ;;
370 rb-912uag-2hpnd|\
371 rb-912uag-5hpnd|\
372 rb-sxt2n|\
373 rb-sxt5n)
374 status_led="rb:green:power"
375 ;;
376 re355|\
377 re450|\
378 sc300m)
379 status_led="$board:blue:power"
380 ;;
381 rocket-m-ti)
382 status_led="ubnt:green:link6"
383 ;;
384 routerstation|\
385 routerstation-pro)
386 status_led="ubnt:green:rf"
387 ;;
388 rw2458n)
389 status_led="$board:green:d3"
390 ;;
391 smart-300)
392 status_led="nc-link:green:system"
393 ;;
394 qihoo-c301)
395 status_led="qihoo:green:status"
396 ;;
397 t830)
398 status_led="$board:green:usb"
399 ;;
400 tellstick-znet-lite)
401 status_led="tellstick:white:system"
402 ;;
403 tew-673gru)
404 status_led="trendnet:blue:wps"
405 ;;
406 tew-712br|\
407 tew-732br|\
408 tew-823dru)
409 status_led="trendnet:green:power"
410 ;;
411 tl-mr3020|\
412 tl-wr2543n)
413 status_led="tp-link:green:wps"
414 ;;
415 tl-wa750re)
416 status_led="tp-link:orange:re"
417 ;;
418 tl-wa850re|\
419 tl-wa850re-v2)
420 status_led="tp-link:blue:re"
421 ;;
422 tl-wa855re-v1|\
423 tl-wa860re)
424 status_led="tp-link:green:power"
425 ;;
426 tl-mr6400)
427 status_led="tp-link:white:power"
428 ;;
429 tl-mr3220|\
430 tl-mr3220-v2|\
431 tl-mr3420|\
432 tl-mr3420-v2|\
433 tl-wa701nd-v2|\
434 tl-wa801nd-v2|\
435 tl-wa801nd-v3|\
436 tl-wa830re-v2|\
437 tl-wa901nd|\
438 tl-wa901nd-v2|\
439 tl-wa901nd-v3|\
440 tl-wa901nd-v4|\
441 tl-wa901nd-v5|\
442 tl-wdr3320-v2|\
443 tl-wdr3500|\
444 tl-wr1041n-v2|\
445 tl-wr1043n-v5|\
446 tl-wr1043nd|\
447 tl-wr1043nd-v2|\
448 tl-wr1043nd-v4|\
449 tl-wr740n-v6|\
450 tl-wr741nd|\
451 tl-wr741nd-v4|\
452 tl-wr840n-v2|\
453 tl-wr840n-v3|\
454 tl-wr841n-v1|\
455 tl-wr841n-v7|\
456 tl-wr841n-v8|\
457 tl-wr841n-v11|\
458 tl-wr842n-v2|\
459 tl-wr842n-v3|\
460 tl-wr941nd|\
461 tl-wr941nd-v5)
462 status_led="tp-link:green:system"
463 ;;
464 tl-wr841n-v9)
465 status_led="tp-link:green:qss"
466 ;;
467 tl-wdr6500-v2)
468 status_led="tp-link:white:system"
469 ;;
470 tube2h)
471 status_led="alfa:green:signal4"
472 ;;
473 unifi)
474 status_led="ubnt:green:dome"
475 ;;
476 uap-pro|\
477 unifiac-lite|\
478 unifiac-pro)
479 status_led="ubnt:white:dome"
480 ;;
481 unifi-outdoor-plus)
482 status_led="ubnt:white:front"
483 ;;
484 airgateway|\
485 airgatewaypro)
486 status_led="ubnt:white:status"
487 ;;
488 wi2a-ac200i)
489 status_led="nokia:green:ctrl"
490 ;;
491 whr-g301n|\
492 whr-hp-g300n|\
493 whr-hp-gn|\
494 wzr-hp-g300nh)
495 status_led="buffalo:green:router"
496 ;;
497 wlae-ag300n)
498 status_led="buffalo:green:status"
499 ;;
500 r6100|\
501 wndap360|\
502 wndr3700|\
503 wndr3700v4|\
504 wndr4300|\
505 wnr2000|\
506 wnr2000-v3|\
507 wnr2200|\
508 wnr612-v2|\
509 wnr1000-v2|\
510 wpn824n)
511 status_led="netgear:green:power"
512 ;;
513 wp543)
514 status_led="$board:green:diag"
515 ;;
516 wpj342|\
517 wpj531|\
518 wpj558)
519 status_led="$board:green:sig3"
520 ;;
521 wpj563)
522 status_led="$board:green:sig1"
523 ;;
524 wrt160nl|\
525 wrt400n)
526 status_led="$board:blue:wps"
527 ;;
528 zcn-1523h-2|\
529 zcn-1523h-5)
530 status_led="zcn-1523h:amber:init"
531 ;;
532 wlr8100)
533 status_led="sitecom:amber:status"
534 ;;
535 esac
536 }
537
538 set_state() {
539 get_status_led
540
541 case "$1" in
542 preinit)
543 status_led_blink_preinit
544 ;;
545 failsafe)
546 status_led_blink_failsafe
547 ;;
548 preinit_regular)
549 status_led_blink_preinit_regular
550 ;;
551 done)
552 status_led_on
553 case $(board_name) in
554 gl-ar300m|\
555 gl-ar750)
556 fw_printenv lc >/dev/null 2>&1 && fw_setenv "bootcount" 0
557 ;;
558 qihoo-c301)
559 local n=$(fw_printenv activeregion | cut -d = -f 2)
560 fw_setenv "image${n}trynum" 0
561 ;;
562 wi2a-ac200i)
563 fw_setenv PKRstCnt 0
564 ;;
565 esac
566 ;;
567 esac
568 }