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