make sure errors get sent to /dev/null
[oweals/openwrt.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         ap132)
16                 status_led="ap132:green:status"
17                 ;;
18         ap136-010|\
19         ap136-020)
20                 status_led="ap136:green:status"
21                 ;;
22         ap135-020)
23                 status_led="ap135:green:status"
24                 ;;
25         ap81)
26                 status_led="ap81:green:status"
27                 ;;
28         ap83)
29                 status_led="ap83:green:power"
30                 ;;
31         ap96)
32                 status_led="ap96:green:led2"
33                 ;;
34         aw-nr580)
35                 status_led="aw-nr580:green:ready"
36                 ;;
37         bullet-m | rocket-m | nano-m | nanostation-m)
38                 status_led="ubnt:green:link4"
39                 ;;
40         cap4200ag)
41                 status_led="senao:green:pwr"
42                 ;;
43         db120)
44                 status_led="db120:green:status"
45                 ;;
46         dir-600-a1 |\
47         dir-615-e4)
48                 status_led="d-link:green:power"
49                 ;;
50         dir-615-c1)
51                 status_led="d-link:green:status"
52                 ;;
53         dir-825-b1 |\
54         dir-835-a1)
55                 status_led="d-link:orange:power"
56                 ;;
57         dir-825-c1)
58                 status_led="d-link:orange:power"
59                 ;;
60         eap7660d)
61                 status_led="eap7660d:green:ds4"
62                 ;;
63         hornet-ub)
64                 status_led="alfa:blue:wps"
65                 ;;
66         ja76pf | \
67         ja76pf2)
68                 status_led="jjplus:green:led1"
69                 ;;
70         ls-sr71)
71                 status_led="ubnt:green:d22"
72                 ;;
73         mr600)
74                 status_led="mr600:orange:power"
75                 ;;
76         mr600v2)
77                 status_led="mr600:blue:power"
78                 ;;
79         mzk-w04nu | \
80         mzk-w300nh)
81                 status_led="planex:green:status"
82                 ;;
83         nbg460n_550n_550nh)
84                 status_led="nbg460n:green:power"
85                 ;;
86         om2p | \
87         om2p-hs | \
88         om2p-lc)
89                 status_led="om2p:blue:power"
90                 ;;
91         pb44)
92                 status_led="pb44:amber:jump1"
93                 ;;
94         rb-411 | rb-411u | rb-433 | rb-433u | rb-450 | rb-450g | rb-493)
95                 status_led="rb4xx:yellow:user"
96                 ;;
97        rb-750)
98                status_led="rb750:green:act"
99                ;;
100         routerstation | routerstation-pro)
101                 status_led="ubnt:green:rf"
102                 ;;
103         rw2458n)
104                 status_led="rw2458n:green:d3"
105                 ;;
106         tew-632brp)
107                 status_led="tew-632brp:green:status"
108                 ;;
109         tew-673gru)
110                 status_led="trendnet:blue:wps"
111                 ;;
112         tew-712br)
113                 status_led="trendnet:green:power"
114                 ;;
115         tl-mr3020)
116                 status_led="tp-link:green:wps"
117                 ;;
118         tl-mr3220 | \
119         tl-mr3220-v2 | \
120         tl-mr3420 | \
121         tl-mr3420-v2 | \
122         tl-wa901nd | \
123         tl-wa901nd-v2 | \
124         tl-wr1041n-v2 | \
125         tl-wr1043nd | \
126         tl-wr741nd | \
127         tl-wr741nd-v4 | \
128         tl-wr841n-v1 | \
129         tl-wr841n-v7 | \
130         tl-wr841n-v8 | \
131         tl-wr941nd)
132                 status_led="tp-link:green:system"
133                 ;;
134         tl-wdr4300 | \
135         tl-wr703n)
136                 status_led="tp-link:blue:system"
137                 ;;
138         tl-wr2543n)
139                 status_led="tp-link:green:wps"
140                 ;;
141         unifi)
142                 status_led="ubnt:green:dome"
143                 ;;
144         uap-pro)
145                 status_led="ubnt:white:dome"
146                 ;;
147         whr-g301n | \
148         whr-hp-g300n | \
149         whr-hp-gn | \
150         wzr-hp-g300nh)
151                 status_led="buffalo:green:router"
152                 ;;
153         wlae-ag300n)
154                 status_led="buffalo:green:status"
155                 ;;
156         wzr-hp-ag300h | \
157         wzr-hp-g300nh2)
158                 status_led="buffalo:red:diag"
159                 ;;
160         wndr3700)
161                 status_led="wndr3700:green:power"
162                 ;;
163         wndr4300)
164                 status_led="netgear:green:power"
165                 ;;
166         wnr2000)
167                 status_led="wnr2000:green:power"
168                 ;;
169         wp543)
170                 status_led="wp543:green:diag"
171                 ;;
172         wrt400n)
173                 status_led="wrt400n:blue:wps"
174                 ;;
175         wrt160nl)
176                 status_led="wrt160nl:blue:wps"
177                 ;;
178         zcn-1523h-2 | zcn-1523h-5)
179                 status_led="zcn-1523h:amber:init"
180                 ;;
181         esac
182 }
183
184 set_state() {
185         get_status_led
186
187         case "$1" in
188         preinit)
189                 insmod leds-gpio 2> /dev/null
190                 insmod ledtrig-default-on 2> /dev/null
191                 insmod ledtrig-timer 2> /dev/null
192                 status_led_blink_preinit
193                 ;;
194         failsafe)
195                 status_led_blink_failsafe
196                 ;;
197         done)
198                 status_led_on
199                 ;;
200         esac
201 }