base-files: allow users to delect debug level during boot
[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         case $(ramips_board_name) in
9         3g-6200n)
10                 status_led="edimax:green:power"
11                 ;;
12         3g300m | w150m)
13                 status_led="tenda:blue:ap"
14                 ;;
15         argus-atp52b)
16                 status_led="argus-atp52b:green:run"
17                 ;;
18         asl26555)
19                 status_led="asl26555:green:power"
20                 ;;
21         br6524n)
22                 status_led="edimax:blue:power"
23                 ;;
24         br6425)
25                 status_led="edimax:green:power"
26                 ;;
27         d105)
28                 status_led="d105:red:power"
29                 ;;
30         dcs-930 | dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-610-a1 | dir-615-h1 | dir-615-d | dir-620-a1| dir-620-d1| dir-300-b7| dir-320-b1)
31                 status_led="d-link:green:status"
32                 ;;
33         dir-645)
34                 status_led="d-link:green:wps"
35                 ;;
36         dap-1350)
37                 status_led="d-link:blue:power"
38                 ;;
39         esr-9753)
40                 status_led="esr-9753:orange:power"
41                 ;;
42         f5d8235-v2)
43                 status_led="f5d8235v2:blue:router"
44                 ;;
45         fonera20n)
46                 status_led="fonera20n:green:power"
47                 ;;
48         ip2202)
49                 status_led="ip2202:green:run"
50                 ;;
51         rt-n13u)
52                 status_led="rt-n13u:power"
53                 ;;
54         all0239-3g|\
55         hw550-3g)
56                 status_led="hw550-3g:green:status"
57                 ;;
58         m3)
59                 status_led="m3:blue:status"
60                 ;;
61         m4)
62                 status_led="m4:blue:status"
63                 ;;
64         mofi3500-3gn)
65                 status_led="mofi3500-3gn:green:status"
66                 ;;
67         mpr-a1)
68                 status_led="mpr-a1:red:power"
69                 ;;
70         mpr-a2)
71                 status_led="mpr-a2:red:power"
72                 ;;
73         nbg-419n)
74                 status_led="nbg-419n:green:power"
75                 ;;
76         nw718)
77                 status_led="nw718:amber:cpu"
78                 ;;
79         omni-emb|\
80         omni-emb-hpm)
81                 status_led="emb:green:status"
82                 ;;
83         psr-680w)
84                 status_led="psr-680w:red:wan"
85                 ;;
86         pwh2004)
87                 status_led="pwh2004:green:power"
88                 ;;
89         rt-n15)
90                 status_led="rt-n15:blue:power"
91                 ;;
92         rt-n10-plus)
93                 status_led="asus:green:wps"
94                 ;;
95         rt-n56u | wl-330n | wl-330n3g)
96                 status_led="asus:blue:power"
97                 ;;
98         sl-r7205)
99                 status_led="sl-r7205:green:status"
100                 ;;
101         tew-691gr|\
102         tew-692gr)
103                 status_led="trendnet:green:wps"
104                 ;;
105         v11st-fe)
106                 status_led="v11st-fe:green:status"
107                 ;;
108         v22rw-2x2)
109                 status_led="v22rw-2x2:green:security"
110                 ;;
111         w306r-v20)
112                 status_led="w306r-v20:green:sys"
113                 ;;
114         w502u)
115                 status_led="alfa:blue:wps"
116                 ;;
117         wcr-150gn)
118                 status_led="wcr150gn:amber:power"
119                 ;;
120         whr-g300n)
121                 status_led="whr-g300n:green:router"
122                 ;;
123         wmr300 | \
124         whr-300hp2 | \
125         whr-600d)
126                 status_led="buffalo:green:status"
127                 ;;
128         wli-tx4-ag300n)
129                 status_led="buffalo:blue:power"
130                 ;;
131         wl-351)
132                 status_led="wl-351:amber:power"
133                 ;;
134         wr512-3gn)
135                 status_led="wr512:green:wps"
136                 ;;
137         wnce2001)
138                 status_led="netgear:green:power"
139                 ;;
140         mzk-w300nh2)
141                 status_led="mzkw300nh2:green:power"
142                 ;;
143         ur-326n4g)
144                 status_led="ur326:green:wps"
145                 ;;
146         ur-336un)
147                 status_led="ur336:green:wps"
148                 ;;
149         x5)
150                 status_led="x5:green:power"
151                 ;;
152         x8)
153                 status_led="x8:green:power"
154                 ;;
155         xdxrn502j)
156                 status_led="xdxrn502j:green:power"
157                 ;;
158         f7c027)
159                 status_led="belkin:orange:status"
160         ;;
161         esac
162 }
163
164 set_state() {
165         get_status_led
166
167         case "$1" in
168         preinit)
169                 status_led_blink_preinit
170                 ;;
171         failsafe)
172                 status_led_blink_failsafe
173                 ;;
174         done)
175                 status_led_on
176                 ;;
177         esac
178 }