ar71xx: add user-space support for Netgear WNDAP360
[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-wdr3500 | \
125         tl-wr1041n-v2 | \
126         tl-wr1043nd | \
127         tl-wr741nd | \
128         tl-wr741nd-v4 | \
129         tl-wr841n-v1 | \
130         tl-wr841n-v7 | \
131         tl-wr841n-v8 | \
132         tl-wr941nd)
133                 status_led="tp-link:green:system"
134                 ;;
135         tl-wdr4300 | \
136         tl-wr703n | \
137         tl-wr720n-v3)
138                 status_led="tp-link:blue:system"
139                 ;;
140         tl-wr2543n)
141                 status_led="tp-link:green:wps"
142                 ;;
143         unifi)
144                 status_led="ubnt:green:dome"
145                 ;;
146         uap-pro)
147                 status_led="ubnt:white:dome"
148                 ;;
149         whr-g301n | \
150         whr-hp-g300n | \
151         whr-hp-gn | \
152         wzr-hp-g300nh)
153                 status_led="buffalo:green:router"
154                 ;;
155         wlae-ag300n)
156                 status_led="buffalo:green:status"
157                 ;;
158         wzr-hp-ag300h | \
159         wzr-hp-g300nh2)
160                 status_led="buffalo:red:diag"
161                 ;;
162         wndap360)
163                 status_led="wndap360:green:power"
164                 ;;
165         wndr3700)
166                 status_led="wndr3700:green:power"
167                 ;;
168         wndr4300)
169                 status_led="netgear:green:power"
170                 ;;
171         wnr2000)
172                 status_led="wnr2000:green:power"
173                 ;;
174         wp543)
175                 status_led="wp543:green:diag"
176                 ;;
177         wrt400n)
178                 status_led="wrt400n:blue:wps"
179                 ;;
180         wrt160nl)
181                 status_led="wrt160nl:blue:wps"
182                 ;;
183         zcn-1523h-2 | zcn-1523h-5)
184                 status_led="zcn-1523h:amber:init"
185                 ;;
186         esac
187 }
188
189 set_state() {
190         get_status_led
191
192         case "$1" in
193         preinit)
194                 insmod leds-gpio 2> /dev/null
195                 insmod ledtrig-default-on 2> /dev/null
196                 insmod ledtrig-timer 2> /dev/null
197                 status_led_blink_preinit
198                 ;;
199         failsafe)
200                 status_led_blink_failsafe
201                 ;;
202         done)
203                 status_led_on
204                 ;;
205         esac
206 }