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