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