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