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