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