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