20ff8fff38ff5223bae3c93a466e0c363a33154c
[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/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-750dhp|\
25 mzk-dp150n|\
26 mzk-w300nh2|\
27 nbg-419n|\
28 pwh2004|\
29 wnce2001|\
30 wndr3700v5|\
31 x5|\
32 x8|\
33 xdxrn502j)
34 status_led="$board:green:power"
35 ;;
36 a5-v11|\
37 cs-qr10|\
38 d105|\
39 dcs-930l-b1|\
40 ex2700|\
41 hlk-rm04|\
42 jhr-n825r|\
43 mpr-a1|\
44 mpr-a2)
45 status_led="$board:red:power"
46 ;;
47 ai-br100|\
48 ht-tm02)
49 status_led="$board:blue:wlan"
50 ;;
51 all0239-3g|\
52 dcs-930|\
53 dir-300-b1|\
54 dir-300-b7|\
55 dir-320-b1|\
56 dir-600-b1|\
57 dir-600-b2|\
58 dir-610-a1|\
59 dir-615-d|\
60 dir-615-h1|\
61 dir-620-a1|\
62 dir-620-d1|\
63 hpm|\
64 hw550-3g|\
65 miniembwifi|\
66 mofi3500-3gn|\
67 rut5xx|\
68 v11st-fe|\
69 vocore|\
70 wmr-300|\
71 zbt-wg2626|\
72 zbt-wg3526)
73 status_led="$board:green:status"
74 ;;
75 atp-52b|\
76 ip2202)
77 status_led="$board:green:run"
78 ;;
79 awapn2403|\
80 dir-645|\
81 wrh-300cr)
82 status_led="$board:green:wps"
83 ;;
84 cf-wr800n|\
85 psg1208)
86 status_led="$board:white:wps"
87 ;;
88 cy-swr1100|\
89 w502u)
90 status_led="$board:blue:wps"
91 ;;
92 dap-1350|\
93 na930|\
94 pbr-m1|\
95 rt-n13u|\
96 rt-n14u|\
97 rt-n15|\
98 rt-n56u|\
99 wl-330n|\
100 wl-330n3g|\
101 wli-tx4-ag300n|\
102 wt3020|\
103 y1|\
104 y1s)
105 status_led="$board:blue:power"
106 ;;
107 db-wrt01|\
108 esr-9753)
109 status_led="$board:orange:power"
110 ;;
111 f5d8235-v2)
112 status_led="$board:blue:router"
113 ;;
114 f7c027)
115 status_led="$board:orange:status"
116 ;;
117 hc5*61|\
118 jhr-n805r|\
119 jhr-n926r|\
120 mlw221|\
121 mlwg2)
122 status_led="$board:blue:system"
123 ;;
124 linkits7688| \
125 linkits7688d)
126 [ "$1" = "upgrade" ] && status_led="mediatek:orange:wifi"
127 ;;
128 m2m)
129 status_led="$board:blue:wifi"
130 ;;
131 m3|\
132 m4)
133 status_led="$board:blue:status"
134 ;;
135 miwifi-mini|\
136 zte-q7)
137 status_led="$board:red:status"
138 ;;
139 mr-102n)
140 status_led="$board:amber:status"
141 ;;
142 nw718)
143 status_led="$board:amber:cpu"
144 ;;
145 oy-0001|\
146 sl-r7205)
147 status_led="$board:green:wifi"
148 ;;
149 psr-680w)
150 status_led="$board:red:wan"
151 ;;
152 px-4885|\
153 re6500|\
154 whr-1166d|\
155 whr-300hp2|\
156 whr-600d)
157 status_led="$board:orange:wifi"
158 ;;
159 mzk-ex300np|\
160 rt-n10-plus|\
161 tew-691gr|\
162 tew-692gr|\
163 ur-326n4g|\
164 ur-336un|\
165 wf-2881|\
166 wr512-3gn)
167 status_led="$board:green:wps"
168 ;;
169 sap-g3200u3)
170 status_led="$board:green:usb"
171 ;;
172 v22rw-2x2)
173 status_led="$board:green:security"
174 ;;
175 w306r-v20|\
176 witi|\
177 zbt-wr8305rt)
178 status_led="$board:green:sys"
179 ;;
180 wcr-150gn|\
181 wl-351)
182 status_led="$board:amber:power"
183 ;;
184 whr-g300n|\
185 wzr-agl300nh)
186 status_led="$board:green:router"
187 ;;
188 wizfi630a)
189 status_led="$board::run"
190 ;;
191 wsr-1166|\
192 wsr-600)
193 status_led="$board:orange:diag"
194 ;;
195 wrtnode2r | \
196 wrtnode2p | \
197 wrtnode)
198 status_led="wrtnode:blue:indicator"
199 ;;
200 esac
201 }
202
203 set_state() {
204 get_status_led $1
205
206 case "$1" in
207 preinit)
208 status_led_blink_preinit
209 ;;
210 failsafe)
211 status_led_blink_failsafe
212 ;;
213 upgrade | \
214 preinit_regular)
215 status_led_blink_preinit_regular
216 ;;
217 done)
218 status_led_on
219 ;;
220 esac
221 }