ar71xx: add user-space support for the OpenMesh OM2P-HSv3
[librecmc/librecmc.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         antminer-s1)
16                 status_led="antminer-s1:green:system"
17                 ;;
18         antminer-s3)
19                 status_led="antminer-s3:green:system"
20                 ;;
21         antminer-r1)
22                 status_led="antminer-r1:green:system"
23                 ;;
24         ap132)
25                 status_led="ap132:green:status"
26                 ;;
27         ap136-010|\
28         ap136-020)
29                 status_led="ap136:green:status"
30                 ;;
31         ap147-010)
32                 status_led="ap147:green:status"
33                 ;;
34         ap135-020)
35                 status_led="ap135:green:status"
36                 ;;
37         ap81)
38                 status_led="ap81:green:status"
39                 ;;
40         ap83)
41                 status_led="ap83:green:power"
42                 ;;
43         ap96)
44                 status_led="ap96:green:led2"
45                 ;;
46         aw-nr580)
47                 status_led="aw-nr580:green:ready"
48                 ;;
49         bsb)
50                 status_led="bsb:red:sys"
51                 ;;
52         bullet-m | rocket-m | rocket-m-xw | nano-m | nanostation-m | nanostation-m-xw | loco-m-xw)
53                 status_led="ubnt:green:link4"
54                 ;;
55         rocket-m-ti)
56                 status_led="ubnt:green:link6"
57                 ;;
58         bxu2000n-2-a1)
59                 status_led="bhu:green:status"
60                 ;;
61         cap324)
62                 status_led="pcs:green:power"
63                 ;;
64         c-55)
65                 status_led="c-55:green:pwr"
66                 ;;
67         cap4200ag)
68                 status_led="senao:green:pwr"
69                 ;;
70         cf-e316n-v2)
71                 status_led="$(ar71xx_board_name):blue:wan"
72                 ;;
73         cpe510)
74                 status_led="tp-link:green:link4"
75                 ;;
76         cr3000)
77                 status_led="pcs:amber:power"
78                 ;;
79         cr5000)
80                 status_led="pcs:amber:power"
81                 ;;
82         db120)
83                 status_led="db120:green:status"
84                 ;;
85         dgl-5500-a1 |\
86         dhp-1565-a1|\
87         dir-505-a1 |\
88         dir-600-a1 |\
89         dir-615-e1 |\
90         dir-615-i1 |\
91         dir-615-e4)
92                 status_led="d-link:green:power"
93                 ;;
94         dir-615-c1)
95                 status_led="d-link:green:status"
96                 ;;
97         dir-825-b1)
98                 status_led="d-link:orange:power"
99                 ;;
100         dir-825-c1 |\
101         dir-835-a1)
102                 status_led="d-link:amber:power"
103                 ;;
104         dlan-hotspot)
105                 status_led="devolo:green:wifi"
106                 ;;
107         dlan-pro-500-wp)
108                 status_led="devolo:green:wlan-2g"
109                 ;;
110         dlan-pro-1200-ac)
111                 status_led="devolo:status:wlan"
112                 ;;
113         dr344)
114                 status_led="dr344:green:status"
115                 ;;
116         dragino2)
117                 status_led="dragino2:red:system"
118                 ;;
119         eap300v2)
120                 status_led="engenius:blue:power"
121                 ;;
122         eap7660d)
123                 status_led="eap7660d:green:ds4"
124                 ;;
125         el-mini | \
126         el-m150)
127                 status_led="easylink:green:system"
128                 ;;
129         ew-dorin | ew-dorin-router)
130                 status_led="dorin:green:status"
131                 ;;
132         f9k1115v2)
133                 status_led="belkin:blue:status"
134                 ;;
135         gl-inet)
136                 status_led="gl-connect:green:lan"
137                 ;;
138         epg5000)
139                 status_led="epg5000:amber:power"
140                 ;;
141         esr1750)
142                 status_led="esr1750:amber:power"
143                 ;;
144         esr900)
145                 status_led="engenius:amber:power"
146                 ;;
147         hiwifi-hc6361)
148                 status_led="hiwifi:blue:system"
149                 ;;
150         hornet-ub | \
151         hornet-ub-x2)
152                 status_led="alfa:blue:wps"
153                 ;;
154         ja76pf | \
155         ja76pf2)
156                 status_led="jjplus:green:led1"
157                 ;;
158         ls-sr71)
159                 status_led="ubnt:green:d22"
160                 ;;
161         mc-mac1200r)
162                 status_led="mercury:green:system"
163                 ;;
164         mr12)
165                 status_led="mr12:green:power"
166                 ;;
167         mr16)
168                 status_led="mr16:green:power"
169                 ;;
170         mr18)
171                 status_led="mr18:green:tricolor0"
172                 ;;
173         mr600)
174                 status_led="mr600:orange:power"
175                 ;;
176         mr600v2)
177                 status_led="mr600:blue:power"
178                 ;;
179         mr1750)
180                 status_led="mr1750:blue:power"
181                 ;;
182         mr900 | \
183         mr900v2)
184                 status_led="mr900:blue:power"
185                 ;;
186         mynet-n600 | \
187         mynet-n750)
188                 status_led="wd:blue:power"
189                 ;;
190         mynet-rext)
191                 status_led="wd:blue:power"
192                 ;;
193         mzk-w04nu | \
194         mzk-w300nh)
195                 status_led="planex:green:status"
196                 ;;
197         nbg460n_550n_550nh)
198                 status_led="nbg460n:green:power"
199                 ;;
200         nbg6616)
201                 status_led="nbg6616:green:power"
202                 ;;
203         nbg6716)
204                 status_led="nbg6716:white:power"
205                 ;;
206         om2p | \
207         om2pv2 | \
208         om2p-hs | \
209         om2p-hsv2 | \
210         om2p-hsv3 | \
211         om2p-lc)
212                 status_led="om2p:blue:power"
213                 ;;
214         om5p | \
215         om5p-an)
216                 status_led="om5p:blue:power"
217                 ;;
218         om5p-ac | \
219         om5p-acv2)
220                 status_led="om5pac:blue:power"
221                 ;;
222         omy-g1)
223                 status_led="omy:green:wlan"
224                 ;;
225         omy-x1)
226                 status_led="omy:green:power"
227                 ;;
228         onion-omega)
229                 status_led="onion:amber:system"
230                 ;;
231         pb44)
232                 status_led="pb44:amber:jump1"
233                 ;;
234         rb-2011l|\
235         rb-2011uas|\
236         rb-2011uas-2hnd)
237                 status_led="rb:green:usr"
238                 ;;
239         rb-411 | rb-411u | rb-433 | rb-433u | rb-450 | rb-450g | rb-493)
240                 status_led="rb4xx:yellow:user"
241                 ;;
242         rb-750)
243                 status_led="rb750:green:act"
244                 ;;
245         rb-911g-2hpnd|\
246         rb-911g-5hpacd|\
247         rb-911g-5hpnd|\
248         rb-912uag-2hpnd|\
249         rb-912uag-5hpnd)
250                 status_led="rb:green:user"
251                 ;;
252         rb-951ui-2hnd)
253                 status_led="rb:green:act"
254                 ;;
255         rb-sxt2n|\
256         rb-sxt5n)
257                 status_led="rb:green:power"
258                 ;;
259         routerstation | routerstation-pro)
260                 status_led="ubnt:green:rf"
261                 ;;
262         rw2458n)
263                 status_led="rw2458n:green:d3"
264                 ;;
265         smart-300)
266                 status_led="nc-link:green:system"
267                 ;;
268         minibox-v1)
269                 status_led="minibox-v1:green:system"
270                 ;;
271         oolite)
272                 status_led="oolite:red:system"
273                 ;;
274         qihoo-c301)
275                 status_led="qihoo:green:status"
276                 ;;
277         tellstick-znet-lite)
278                 status_led="tellstick:white:system"
279                 ;;
280         tew-632brp)
281                 status_led="tew-632brp:green:status"
282                 ;;
283         tew-673gru)
284                 status_led="trendnet:blue:wps"
285                 ;;
286         tew-712br|\
287         tew-732br|\
288         tew-823dru)
289                 status_led="trendnet:green:power"
290                 ;;
291         tl-mr3020)
292                 status_led="tp-link:green:wps"
293                 ;;
294         tl-wa750re)
295                 status_led="tp-link:orange:re"
296                 ;;
297         tl-wa850re)
298                 status_led="tp-link:blue:re"
299                 ;;
300         tl-wa860re)
301                 status_led="tp-link:green:power"
302                 ;;
303         tl-mr3220 | \
304         tl-mr3220-v2 | \
305         tl-mr3420 | \
306         tl-mr3420-v2 | \
307         tl-wa701nd-v2 | \
308         tl-wa801nd-v2 | \
309         tl-wa901nd | \
310         tl-wa901nd-v2 | \
311         tl-wa901nd-v3 | \
312         tl-wa901nd-v4 | \
313         tl-wdr3320-v2 | \
314         tl-wdr3500 | \
315         tl-wr1041n-v2 | \
316         tl-wr1043nd | \
317         tl-wr1043nd-v2 | \
318         tl-wr741nd | \
319         tl-wr741nd-v4 | \
320         tl-wr841n-v1 | \
321         tl-wr841n-v7 | \
322         tl-wr841n-v8 | \
323         tl-wa830re-v2 | \
324         tl-wr842n-v2 | \
325         tl-wr842n-v3 | \
326         tl-wr941nd | \
327         tl-wr941nd-v5)
328                 status_led="tp-link:green:system"
329                 ;;
330         archer-c5 | \
331         archer-c7 | \
332         tl-wdr4900-v2 | \
333         tl-mr10u | \
334         tl-mr12u | \
335         tl-mr13u | \
336         tl-wdr4300 | \
337         tl-wr703n | \
338         tl-wr710n | \
339         tl-wr720n-v3 | \
340         tl-wr810n | \
341         tl-wr941nd-v6)
342                 status_led="tp-link:blue:system"
343                 ;;
344         tl-wr841n-v9)
345                 status_led="tp-link:green:qss"
346                 ;;
347         tl-wr2543n)
348                 status_led="tp-link:green:wps"
349                 ;;
350         tl-wdr6500-v2)
351                 status_led="tp-link:white:system"
352                 ;;
353         tube2h)
354                 status_led="alfa:green:signal4"
355                 ;;
356         unifi)
357                 status_led="ubnt:green:dome"
358                 ;;
359         uap-pro | \
360         unifiac-lite | \
361         unifiac-pro)
362                 status_led="ubnt:white:dome"
363                 ;;
364         unifi-outdoor-plus)
365                 status_led="ubnt:white:front"
366                 ;;
367         airgateway | \
368         airgatewaypro)
369                 status_led="ubnt:white:status"
370                 ;;
371         whr-g301n | \
372         whr-hp-g300n | \
373         whr-hp-gn | \
374         wzr-hp-g300nh)
375                 status_led="buffalo:green:router"
376                 ;;
377         wlae-ag300n)
378                 status_led="buffalo:green:status"
379                 ;;
380         wzr-hp-ag300h | \
381         wzr-hp-g300nh2)
382                 status_led="buffalo:red:diag"
383                 ;;
384         r6100 | \
385         wndap360 | \
386         wndr3700 | \
387         wndr3700v4 | \
388         wndr4300 | \
389         wnr2000 | \
390         wnr2000-v3 |\
391         wnr2200 |\
392         wnr612-v2 |\
393         wnr1000-v2 |\
394         wpn824n)
395                 status_led="netgear:green:power"
396                 ;;
397         wp543)
398                 status_led="wp543:green:diag"
399                 ;;
400         wpj342)
401                 status_led="wpj342:green:sig3"
402                 ;;
403         wpj344)
404                 status_led="wpj344:green:status"
405                 ;;
406         wpj531)
407                 status_led="wpj531:green:sig3"
408                 ;;
409         wpj558)
410                 status_led="wpj558:green:sig3"
411                 ;;
412         wrt400n)
413                 status_led="wrt400n:blue:wps"
414                 ;;
415         wrt160nl)
416                 status_led="wrt160nl:blue:wps"
417                 ;;
418         zcn-1523h-2 | zcn-1523h-5)
419                 status_led="zcn-1523h:amber:init"
420                 ;;
421         wlr8100)
422                 status_led="sitecom:amber:status"
423                 ;;
424         esac
425 }
426
427 set_state() {
428         get_status_led
429
430         case "$1" in
431         preinit)
432                 status_led_blink_preinit
433                 ;;
434         failsafe)
435                 status_led_blink_failsafe
436                 ;;
437         preinit_regular)
438                 status_led_blink_preinit_regular
439                 ;;
440         done)
441                 status_led_on
442                 case $(ar71xx_board_name) in
443                 qihoo-c301)
444                         local n=$(fw_printenv activeregion | cut -d = -f 2)
445                         fw_setenv "image${n}trynum" 0
446                         ;;
447                 esac
448                 ;;
449         esac
450 }