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