ramips: add support for TP-Link TL-WR842N v5
[openwrt/openwrt.git] / target / linux / ramips / base-files / etc / diag.sh
1 #!/bin/sh
2 # Copyright (C) 2010-2013 OpenWrt.org
3
4 . /lib/functions.sh
5 . /lib/functions/leds.sh
6
7 get_status_led() {
8 board=$(board_name)
9 boardname="${board##*,}"
10
11 case $board in
12 3g150b|\
13 3g300m|\
14 w150m)
15 status_led="$boardname:blue:ap"
16 ;;
17 3g-6200n|\
18 ar670w|\
19 ar725w|\
20 br-6475nd|\
21 c50|\
22 dch-m225|\
23 dir-860l-b1|\
24 e1700|\
25 ex2700|\
26 ex3700|\
27 fonera20n|\
28 firewrt|\
29 hg255d|\
30 kn|\
31 kn_rc|\
32 kn_rf|\
33 kng_rc|\
34 mzk-750dhp|\
35 mzk-dp150n|\
36 mzk-w300nh2|\
37 nbg-419n|\
38 nbg-419n2|\
39 pwh2004|\
40 r6220|\
41 tplink,c20-v4|\
42 tplink,c50-v3|\
43 tplink,tl-mr3420-v5|\
44 tplink,tl-wr842n-v5|\
45 tplink,tl-wr902ac-v3|\
46 tl-wr840n-v4|\
47 tl-wr840n-v5|\
48 tl-wr841n-v13|\
49 vr500|\
50 wnce2001|\
51 wndr3700v5|\
52 x5|\
53 x8|\
54 xdxrn502j|\
55 wn3000rpv3)
56 status_led="$boardname:green:power"
57 ;;
58 3g-6200nl)
59 status_led="$boardname:green:internet"
60 ;;
61 a5-v11|\
62 cs-qr10|\
63 d105|\
64 dcs-930l-b1|\
65 hlk-rm04|\
66 jhr-n825r|\
67 mpr-a1|\
68 mpr-a2|\
69 mzk-ex750np)
70 status_led="$boardname:red:power"
71 ;;
72 ai-br100|\
73 ht-tm02)
74 status_led="$boardname:blue:wlan"
75 ;;
76 alfa-network,ac1200rm|\
77 awapn2403|\
78 dir-645|\
79 sk-wb8|\
80 wrh-300cr)
81 status_led="$boardname:green:wps"
82 ;;
83 alfa-network,awusfree1)
84 status_led="$boardname:orange:system"
85 ;;
86 all0239-3g|\
87 dcs-930|\
88 dir-300-b1|\
89 dir-300-b7|\
90 dir-320-b1|\
91 dir-600-b1|\
92 dir-610-a1|\
93 dir-615-d|\
94 dir-615-h1|\
95 dir-620-a1|\
96 dir-620-d1|\
97 dwr-512-b|\
98 dlink,dwr-116-a1|\
99 gnubee,gb-pc1|\
100 gnubee,gb-pc2|\
101 hpm|\
102 hw550-3g|\
103 mac1200rv2|\
104 miniembwifi|\
105 mofi3500-3gn|\
106 rut5xx|\
107 v11st-fe|\
108 wmr-300|\
109 zbt-wg2626)
110 status_led="$boardname:green:status"
111 ;;
112 dlink,dwr-921-c1)
113 status_led="$boardname:green:sigstrength"
114 ;;
115 asl26555-8M|\
116 asl26555-16M)
117 status_led="asl26555:green:power"
118 ;;
119 atp-52b|\
120 ew1200|\
121 ip2202)
122 status_led="$boardname:green:run"
123 ;;
124 c108)
125 status_led="$boardname:green:lan"
126 ;;
127 cf-wr800n|\
128 psg1208)
129 status_led="$boardname:white:wps"
130 ;;
131 psg1218a|\
132 psg1218b)
133 status_led="$boardname:yellow:status"
134 ;;
135 cy-swr1100|\
136 w502u|\
137 youhua,wr1200js)
138 status_led="$boardname:blue:wps"
139 ;;
140 d240|\
141 dap-1350|\
142 na930|\
143 d-team,newifi-d2|\
144 pbr-m1|\
145 re350-v1|\
146 rt-ac51u|\
147 rt-n13u|\
148 rt-n14u|\
149 rt-n15|\
150 rt-n56u|\
151 tplink,c20-v1|\
152 wl-330n|\
153 wl-330n3g|\
154 wli-tx4-ag300n|\
155 y1|\
156 y1s|\
157 youku-yk1|\
158 zorlik,zl5900v2)
159 status_led="$boardname:blue:power"
160 ;;
161 dlink,dap-1522-a1|\
162 k2p|\
163 m3|\
164 mir3g|\
165 miwifi-nano)
166 status_led="$boardname:blue:status"
167 ;;
168 db-wrt01|\
169 esr-9753|\
170 pbr-d1)
171 status_led="$boardname:orange:power"
172 ;;
173 f5d8235-v1)
174 status_led="$boardname:blue:wired"
175 ;;
176 f5d8235-v2)
177 status_led="$boardname:blue:router"
178 ;;
179 f7c027|\
180 timecloud)
181 status_led="$boardname:orange:status"
182 ;;
183 hc5*61|\
184 hc5661a|\
185 jhr-n805r|\
186 jhr-n926r|\
187 mlw221|\
188 mlwg2|\
189 vonets,var11n-300)
190 status_led="$boardname:blue:system"
191 ;;
192 hc5962)
193 status_led="$boardname:white:status"
194 ;;
195 linkits7688)
196 status_led="linkit-smart-7688:orange:wifi"
197 ;;
198 m2m)
199 status_led="$boardname:blue:wifi"
200 ;;
201 gl-mt300n-v2)
202 status_led="$boardname:green:power"
203 ;;
204 m4-4M|\
205 m4-8M)
206 status_led="m4:blue:status"
207 ;;
208 miwifi-mini|\
209 zte-q7)
210 status_led="$boardname:red:status"
211 ;;
212 mr-102n)
213 status_led="$boardname:amber:status"
214 ;;
215 mr200)
216 status_led="$boardname:white:power"
217 ;;
218 nw718)
219 status_led="$boardname:amber:cpu"
220 ;;
221 newifi-d1)
222 status_led="$boardname:blue:status"
223 ;;
224 omega2| \
225 omega2p)
226 status_led="$boardname:amber:system"
227 ;;
228 oy-0001|\
229 sl-r7205)
230 status_led="$boardname:green:wifi"
231 ;;
232 psr-680w)
233 status_led="$boardname:red:wan"
234 ;;
235 px-4885-4M|\
236 px-4885-8M)
237 status_led="px-4885:orange:wifi"
238 ;;
239 re6500|\
240 whr-1166d|\
241 whr-600d)
242 status_led="$boardname:orange:wifi"
243 ;;
244 mzk-ex300np|\
245 rt-n10-plus|\
246 tew-638apb-v2|\
247 tew-691gr|\
248 tew-692gr|\
249 ur-326n4g|\
250 ur-336un|\
251 wf-2881)
252 status_led="$boardname:green:wps"
253 ;;
254 rb750gr3)
255 status_led="$boardname:blue:pwr"
256 ;;
257 sap-g3200u3)
258 status_led="$boardname:green:usb"
259 ;;
260 u25awf-h1)
261 status_led="u25awf:red:wifi"
262 ;;
263 u7621-06-256M-16M)
264 status_led="u7621-06:green:status"
265 ;;
266 u7628-01-128M-16M)
267 status_led="u7628-01:green:power"
268 ;;
269 v22rw-2x2)
270 status_led="$boardname:green:security"
271 ;;
272 vocore-8M|\
273 vocore-16M)
274 status_led="vocore:green:status"
275 ;;
276 vocore2)
277 status_led="$boardname:fuchsia:status"
278 ;;
279 vocore2lite)
280 status_led="$boardname:green:status"
281 ;;
282 w306r-v20|\
283 mqmaker,witi-256m|\
284 mqmaker,witi-512m|\
285 zbt-wr8305rt)
286 status_led="$boardname:green:sys"
287 ;;
288 wcr-1166ds|\
289 whr-300hp2|\
290 wsr-1166|\
291 wsr-600)
292 status_led="$boardname:green:power"
293 ;;
294 wcr-150gn|\
295 wl-351)
296 status_led="$boardname:amber:power"
297 ;;
298 whr-g300n|\
299 wlr-6000|\
300 zbt-we2026)
301 status_led="$boardname:red:power"
302 ;;
303 widora,neo-16m|\
304 widora,neo-32m)
305 status_led="widora:orange:wifi"
306 ;;
307 wzr-agl300nh)
308 status_led="$boardname:green:router"
309 ;;
310 wizfi630a)
311 status_led="$boardname::run"
312 ;;
313 wr512-3gn-4M|\
314 wr512-3gn-8M)
315 status_led="wr512-3gn:green:wps"
316 ;;
317 wrtnode2r | \
318 wrtnode2p | \
319 wrtnode)
320 status_led="wrtnode:blue:indicator"
321 ;;
322 wt3020-4M|\
323 wt3020-8M)
324 status_led="wt3020:blue:power"
325 ;;
326 zbt-cpe102)
327 status_led="$boardname:green:4g-0"
328 ;;
329 zbt-we826-16M|\
330 zbt-we826-32M)
331 status_led="zbt-we826:green:power"
332 ;;
333 zbtlink,zbt-we1226)
334 status_led="$boardname:green:wlan"
335 ;;
336 zbt-wg3526-16M|\
337 zbt-wg3526-32M)
338 status_led="zbt-wg3526:green:status"
339 ;;
340 esac
341 }
342
343 set_state() {
344 get_status_led $1
345
346 case "$1" in
347 preinit)
348 status_led_blink_preinit
349 ;;
350 failsafe)
351 status_led_blink_failsafe
352 ;;
353 upgrade | \
354 preinit_regular)
355 status_led_blink_preinit_regular
356 ;;
357 done)
358 status_led_on
359 ;;
360 esac
361 }