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