e0dd92ab97ca0ca385ded138670aa551092635b9
[openwrt.git] / target / linux / ramips / base-files / etc / diag.sh
1 #!/bin/sh
2 # Copyright (C) 2010-2013 OpenWrt.org
3
4 . /lib/functions/leds.sh
5 . /lib/ramips.sh
6
7 get_status_led() {
8         board=$(ramips_board_name)
9
10         case $board in
11         3g150b|\
12         3g300m|\
13         w150m)
14                 status_led="$board:blue:ap"
15                 ;;
16         3g-6200n|\
17         ar670w|\
18         ar725w|\
19         asl26555|\
20         br-6425|\
21         br-6475nd|\
22         e1700|\
23         fonera20n|\
24         mzk-dp150n|\
25         mzk-w300nh2|\
26         nbg-419n|\
27         pwh2004|\
28         wnce2001|\
29         x5|\
30         x8|\
31         xdxrn502j)
32                 status_led="$board:green:power"
33                 ;;
34         a5-v11|\
35         d105|\
36         dcs-930l-b1|\
37         hlk-rm04|\
38         mpr-a1|\
39         mpr-a2)
40                 status_led="$board:red:power"
41                 ;;
42         ai-br100|\
43         ht-tm02)
44                 status_led="$board:blue:wlan"
45                 ;;
46         all0239-3g|\
47         dcs-930|\
48         dir-300-b1|\
49         dir-300-b7|\
50         dir-320-b1|\
51         dir-600-b1|\
52         dir-600-b2|\
53         dir-610-a1|\
54         dir-615-d|\
55         dir-615-h1|\
56         dir-620-a1|\
57         dir-620-d1|\
58         hpm|\
59         hw550-3g|\
60         miniembwifi|\
61         mofi3500-3gn|\
62         rut5xx|\
63         v11st-fe|\
64         vocore|\
65         wmr-300|\
66         zbt-wg2626)
67                 status_led="$board:green:status"
68                 ;;
69         atp-52b|\
70         ip2202)
71                 status_led="$board:green:run"
72                 ;;
73         awapn2403|\
74         dir-645)
75                 status_led="$board:green:wps"
76                 ;;
77         cf-wr800n)
78                 status_led="$board:white:wps"
79                 ;;
80         cy-swr1100|\
81         w502u)
82                 status_led="$board:blue:wps"
83                 ;;
84         dap-1350|\
85         na930|\
86         rt-n13u|\
87         rt-n14u|\
88         rt-n15|\
89         rt-n56u|\
90         wl-330n|\
91         wl-330n3g|\
92         wli-tx4-ag300n|\
93         wt3020|\
94         y1|\
95         y1s)
96                 status_led="$board:blue:power"
97                 ;;
98         db-wrt01|\
99         esr-9753)
100                 status_led="$board:orange:power"
101                 ;;
102         f5d8235-v2)
103                 status_led="$board:blue:router"
104                 ;;
105         f7c027)
106                 status_led="$board:orange:status"
107                 ;;
108         hc5*61|\
109         mlw221|\
110         mlwg2)
111                 status_led="$board:blue:system"
112                 ;;
113         m2m)
114                 status_led="$board:blue:wifi"
115                 ;;
116         m3|\
117         m4)
118                 status_led="$board:blue:status"
119                 ;;
120         miwifi-mini|\
121         zte-q7)
122                 status_led="$board:red:status"
123                 ;;
124         mr-102n)
125                 status_led="$board:amber:status"
126                 ;;
127         nw718)
128                 status_led="$board:amber:cpu"
129                 ;;
130         oy-0001|\
131         sl-r7205)
132                 status_led="$board:green:wifi"
133                 ;;
134         pbr-m1|\
135         w306r-v20|\
136         zbt-wr8305rt)
137                 status_led="$board:green:sys"
138                 ;;
139         psr-680w)
140                 status_led="$board:red:wan"
141                 ;;
142         px-4885|\
143         re6500|\
144         whr-1166d|\
145         whr-300hp2|\
146         whr-600d)
147                 status_led="$board:orange:wifi"
148                 ;;
149         rt-n10-plus|\
150         tew-691gr|\
151         tew-692gr|\
152         ur-326n4g|\
153         ur-336un|\
154         wr512-3gn)
155                 status_led="$board:green:wps"
156                 ;;
157         sap-g3200u3)
158                 status_led="$board:green:usb"
159                 ;;
160         v22rw-2x2)
161                 status_led="$board:green:security"
162                 ;;
163         wcr-150gn|\
164         wl-351)
165                 status_led="$board:amber:power"
166                 ;;
167         whr-g300n|\
168         wzr-agl300nh)
169                 status_led="$board:green:router"
170                 ;;
171         wizfi630a)
172                 status_led="$board::run"
173                 ;;
174         wsr-1166|\
175         wsr-600)
176                 status_led="$board:orange:diag"
177                 ;;
178         esac
179 }
180
181 set_state() {
182         get_status_led
183
184         case "$1" in
185         preinit)
186                 status_led_blink_preinit
187                 ;;
188         failsafe)
189                 status_led_blink_failsafe
190                 ;;
191         preinit_regular)
192                 status_led_blink_preinit_regular
193                 ;;
194         done)
195                 status_led_on
196                 ;;
197         esac
198 }