444e6fff7fa6cd6229ee3b27fdfe5347ec83cbcb
[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 mr600)
109 status_led="mr600:orange:power"
110 ;;
111 mr600v2)
112 status_led="mr600:blue:power"
113 ;;
114 mr900 | \
115 mr900v2)
116 status_led="mr900:blue:power"
117 ;;
118 mynet-n600 | \
119 mynet-n750)
120 status_led="wd:blue:power"
121 ;;
122 mynet-rext)
123 status_led="wd:blue:power"
124 ;;
125 mzk-w04nu | \
126 mzk-w300nh)
127 status_led="planex:green:status"
128 ;;
129 nbg460n_550n_550nh)
130 status_led="nbg460n:green:power"
131 ;;
132 nbg6716)
133 status_led="nbg6716:white:power"
134 ;;
135 om2p | \
136 om2pv2 | \
137 om2p-hs | \
138 om2p-hsv2 | \
139 om2p-lc)
140 status_led="om2p:blue:power"
141 ;;
142 om5p)
143 status_led="om5p:blue:power"
144 ;;
145 pb44)
146 status_led="pb44:amber:jump1"
147 ;;
148 rb-2011l|\
149 rb-2011uas|\
150 rb-2011uas-2hnd)
151 status_led="rb:green:usr"
152 ;;
153 rb-411 | rb-411u | rb-433 | rb-433u | rb-450 | rb-450g | rb-493)
154 status_led="rb4xx:yellow:user"
155 ;;
156 rb-750)
157 status_led="rb750:green:act"
158 ;;
159 rb-911g-2hpnd|\
160 rb-911g-5hpnd|\
161 rb-912uag-2hpnd|\
162 rb-912uag-5hpnd)
163 status_led="rb:green:user"
164 ;;
165 rb-951ui-2hnd)
166 status_led="rb:green:act"
167 ;;
168 rb-sxt2n|\
169 rb-sxt5n)
170 status_led="rb:green:power"
171 ;;
172 routerstation | routerstation-pro)
173 status_led="ubnt:green:rf"
174 ;;
175 rw2458n)
176 status_led="rw2458n:green:d3"
177 ;;
178 smart-300)
179 status_led="nc-link:green:system"
180 ;;
181 oolite)
182 status_led="oolite:red:system"
183 ;;
184 qihoo-c301)
185 status_led="qihoo:green:status"
186 ;;
187 tew-632brp)
188 status_led="tew-632brp:green:status"
189 ;;
190 tew-673gru)
191 status_led="trendnet:blue:wps"
192 ;;
193 tew-712br|\
194 tew-732br)
195 status_led="trendnet:green:power"
196 ;;
197 tl-mr3020)
198 status_led="tp-link:green:wps"
199 ;;
200 tl-wa750re)
201 status_led="tp-link:orange:re"
202 ;;
203 tl-wa850re)
204 status_led="tp-link:blue:re"
205 ;;
206 tl-wa860re)
207 status_led="tp-link:green:power"
208 ;;
209 tl-mr3220 | \
210 tl-mr3220-v2 | \
211 tl-mr3420 | \
212 tl-mr3420-v2 | \
213 tl-wa701nd-v2 | \
214 tl-wa801nd-v2 | \
215 tl-wa901nd | \
216 tl-wa901nd-v2 | \
217 tl-wa901nd-v3 | \
218 tl-wdr3500 | \
219 tl-wr1041n-v2 | \
220 tl-wr1043nd | \
221 tl-wr1043nd-v2 | \
222 tl-wr741nd | \
223 tl-wr741nd-v4 | \
224 tl-wr841n-v1 | \
225 tl-wr841n-v7 | \
226 tl-wr841n-v8 | \
227 tl-wa830re-v2 | \
228 tl-wr842n-v2 | \
229 tl-wr941nd)
230 status_led="tp-link:green:system"
231 ;;
232 archer-c5 | \
233 archer-c7 | \
234 tl-wdr4900-v2 | \
235 tl-mr10u | \
236 tl-mr13u | \
237 tl-wdr4300 | \
238 tl-wr703n | \
239 tl-wr710n | \
240 tl-wr720n-v3)
241 status_led="tp-link:blue:system"
242 ;;
243 tl-wr841n-v9)
244 status_led="tp-link:green:qss"
245 ;;
246 tl-wr2543n)
247 status_led="tp-link:green:wps"
248 ;;
249 tube2h)
250 status_led="alfa:green:signal4"
251 ;;
252 unifi)
253 status_led="ubnt:green:dome"
254 ;;
255 uap-pro)
256 status_led="ubnt:white:dome"
257 ;;
258 unifi-outdoor-plus)
259 status_led="ubnt:white:front"
260 ;;
261 airgateway)
262 status_led="ubnt:white:status"
263 ;;
264 whr-g301n | \
265 whr-hp-g300n | \
266 whr-hp-gn | \
267 wzr-hp-g300nh)
268 status_led="buffalo:green:router"
269 ;;
270 wlae-ag300n)
271 status_led="buffalo:green:status"
272 ;;
273 wzr-hp-ag300h | \
274 wzr-hp-g300nh2)
275 status_led="buffalo:red:diag"
276 ;;
277 r6100 | \
278 wndap360 | \
279 wndr3700 | \
280 wndr3700v4 | \
281 wndr4300 | \
282 wnr2000 | \
283 wnr2200 |\
284 wnr612-v2)
285 status_led="netgear:green:power"
286 ;;
287 wp543)
288 status_led="wp543:green:diag"
289 ;;
290 wrt400n)
291 status_led="wrt400n:blue:wps"
292 ;;
293 wrt160nl)
294 status_led="wrt160nl:blue:wps"
295 ;;
296 zcn-1523h-2 | zcn-1523h-5)
297 status_led="zcn-1523h:amber:init"
298 ;;
299 wlr8100)
300 status_led="sitecom:amber:status"
301 ;;
302 esac
303 }
304
305 set_state() {
306 get_status_led
307
308 case "$1" in
309 preinit)
310 status_led_blink_preinit
311 ;;
312 failsafe)
313 status_led_blink_failsafe
314 ;;
315 preinit_regular)
316 status_led_blink_preinit_regular
317 ;;
318 done)
319 status_led_on
320 case $(ar71xx_board_name) in
321 qihoo-c301)
322 local n=$(fw_printenv activeregion | cut -d = -f 2)
323 fw_setenv "image${n}trynum" 0
324 ;;
325 esac
326 ;;
327 esac
328 }