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