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