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