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