d332e02bbd3ccd8807b3d6e392398ac359140f9a
[openwrt/openwrt.git] / target / linux / ramips / mt7620 / base-files / etc / board.d / 01_leds
1 #!/bin/sh
2
3 . /lib/functions/leds.sh
4 . /lib/functions/uci-defaults.sh
5
6 set_wifi_led() {
7 ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
8 }
9
10
11 board=$(board_name)
12 boardname="${board##*,}"
13
14 board_config_update
15
16 led_wlan="$(get_dt_led wlan)"
17 [ -n "$led_wlan" ] && ucidef_set_led_wlan "wifi_led" "wifi" "$led_wlan" "phy0tpt"
18
19 case $board in
20 aigale,ai-br100)
21 ucidef_set_led_netdev "wan" "wan" "$boardname:blue:wan" "eth0.2"
22 set_wifi_led "$boardname:blue:wlan"
23 ;;
24 alfa-network,ac1200rm)
25 set_wifi_led "$boardname:green:wlan2g" "wlan1"
26 ;;
27 alfa-network,r36m-e4g)
28 ucidef_set_led_netdev "4g" "4g" "$boardname:orange:4g" "wwan0"
29 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x8"
30 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x10"
31 ;;
32 alfa-network,tube-e4g)
33 ucidef_set_led_netdev "4g" "4g" "$boardname:green:4g" "wwan0"
34 ucidef_set_led_netdev "lan" "lan" "$boardname:blue:lan" "eth0"
35 ;;
36 asus,rp-n53)
37 ucidef_set_led_netdev "eth" "Network" "$boardname:white:back" "eth0"
38 set_wifi_led "$boardname:blue:wifi"
39 ;;
40 asus,rt-n12p)
41 ucidef_set_led_netdev "lan" "lan" "$boardname:green:lan" eth0.1
42 ucidef_set_led_netdev "wan" "wan" "$boardname:green:wan" eth0.2
43 set_wifi_led "$boardname:green:air"
44 ;;
45 asus,rt-n14u)
46 ucidef_set_led_netdev "lan" "lan" "$boardname:blue:lan" eth0.1
47 ucidef_set_led_netdev "wan" "wan" "$boardname:blue:wan" eth0.2
48 set_wifi_led "$boardname:blue:air"
49 ;;
50 asus,rt-ac51u|\
51 kingston,mlw221|\
52 kingston,mlwg2|\
53 sanlinking,d240)
54 set_wifi_led "$boardname:blue:wifi"
55 ;;
56 bdcom,wap2100-sk)
57 set_wifi_led "$boardname:green:wlan2g"
58 ;;
59 comfast,cf-wr800n)
60 ucidef_set_led_netdev "lan" "lan" "$boardname:white:ethernet" eth0.1
61 set_wifi_led "$boardname:white:wifi"
62 ;;
63 dlink,dwr-116-a1|\
64 head-weblink,hdrm200|\
65 ohyeah,oy-0001|\
66 planex,mzk-ex300np|\
67 zbtlink,zbt-wr8305rt|\
68 zyxel,keenetic-omni|\
69 zyxel,keenetic-omni-ii|\
70 zyxel,keenetic-viva)
71 set_wifi_led "$boardname:green:wifi"
72 ;;
73 dlink,dwr-118-a1)
74 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1f"
75 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x20"
76 set_wifi_led "$boardname:green:wlan2g" "wlan1"
77 ;;
78 dlink,dwr-118-a2)
79 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
80 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
81 set_wifi_led "$boardname:green:wlan2g" "wlan1"
82 ;;
83 dlink,dwr-921-c1|\
84 dlink,dwr-922-e2)
85 set_wifi_led "$boardname:green:wifi"
86 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x0f"
87 ucidef_set_led_netdev "signalstrength" "signalstrength" "$boardname:green:sigstrength" "wwan0" "link"
88 ucidef_set_led_netdev "4g" "4g" "$boardname:green:4g" "wwan0" "tx rx"
89 ;;
90 dlink,dwr-960)
91 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x2e"
92 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
93 ;;
94 dovado,tiny-ac)
95 set_wifi_led "$boardname:orange:wifi"
96 ;;
97 edimax,br-6478ac-v2|\
98 edimax,ew-7478apc)
99 set_wifi_led "$boardname:blue:wlan"
100 ;;
101 edimax,ew-7476rpc|\
102 edimax,ew-7478ac)
103 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x20"
104 ;;
105 elecom,wrh-300cr)
106 set_wifi_led "$boardname:green:wlan"
107 ucidef_set_led_netdev "lan" "lan" "$boardname:green:ethernet" "eth0"
108 ;;
109 engenius,esr600)
110 ucidef_set_led_netdev "wlan5g" "5.0GHz" "$boardname:blue:wlan5g" "wlan0"
111 ucidef_set_led_netdev "wlan2g" "2.4GHz" "$boardname:blue:wlan2g" "wlan1"
112 ;;
113 glinet,gl-mt300a|\
114 glinet,gl-mt300n|\
115 glinet,gl-mt750)
116 set_wifi_led "$boardname:wlan"
117 ;;
118 hiwifi,hc5661|\
119 hiwifi,hc5761)
120 ucidef_set_led_switch "internet" "internet" "$boardname:blue:internet" "switch0" "0x01"
121 ;;
122 hiwifi,hc5861)
123 ucidef_set_led_switch "internet" "internet" "$boardname:blue:internet" "switch0" "0x20"
124 ;;
125 hnet,c108)
126 ucidef_set_led_netdev "lan" "lan" "$boardname:green:lan" "eth0"
127 ucidef_set_led_netdev "modem" "modem" "$boardname:green:modem" "wwan0"
128 ;;
129 iodata,wn-ac1167gr|\
130 iodata,wn-ac733gr3)
131 ucidef_set_led_wlan "wlan5g" "WLAN5G" "$boardname:green:wlan5g" "phy0radio"
132 ucidef_set_led_wlan "wlan2g" "WLAN2G" "$boardname:green:wlan2g" "phy1radio"
133 ;;
134 kimax,u25awf-h1)
135 set_wifi_led "u25awf:red:wifi"
136 ucidef_set_led_netdev "eth" "eth" "u25awf:green:lan" "eth0"
137 ;;
138 kimax,u35wf)
139 set_wifi_led "$boardname:blue:wifi"
140 ucidef_set_led_netdev "eth" "ETH" "$boardname:green:eth" "eth0"
141 ;;
142 lava,lr-25g001)
143 ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "$boardname:green:wlan2g" "wlan1"
144 ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "$boardname:green:wlan5g" "wlan0"
145 ;;
146 lenovo,newifi-y1)
147 ucidef_set_led_netdev "wifi" "WIFI" "$boardname:blue:wifi" "wlan1"
148 ucidef_set_led_netdev "wifi5g" "WIFI5G" "$boardname:blue:wifi5g" "wlan0"
149 ucidef_set_led_switch "lan" "LAN" "$boardname:blue:lan" "switch0" "0x03"
150 ;;
151 lenovo,newifi-y1s)
152 ucidef_set_led_netdev "wifi" "WIFI" "$boardname:yellow:wifi" "wlan1"
153 ucidef_set_led_netdev "wifi5g" "WIFI5G" "$boardname:blue:wifi" "wlan0"
154 ucidef_set_led_netdev "wan" "WAN" "$boardname:blue:internet" "eth0.2" "tx rx"
155 ;;
156 netgear,ex2700|\
157 netgear,wn3000rp-v3)
158 set_wifi_led "$boardname:green:router"
159 ;;
160 netgear,ex3700|\
161 netgear,ex6130)
162 ucidef_set_led_netdev "wlan5g" "ROUTER (green)" "$boardname:green:router" "wlan0"
163 ucidef_set_led_netdev "wlan2g" "DEVICE (green)" "$boardname:green:device" "wlan1"
164 ;;
165 phicomm,psg1208)
166 set_wifi_led "$boardname:white:wlan2g"
167 ;;
168 planex,mzk-ex750np|\
169 zbtlink,zbt-we826-e)
170 set_wifi_led "$boardname:red:wifi"
171 ;;
172 tplink,archer-c2-v1)
173 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch1" "0x1e"
174 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch1" "0x01"
175 ;;
176 tplink,archer-c20-v1)
177 ucidef_set_led_switch "lan" "lan" "$boardname:blue:lan" "switch0" "0x1e"
178 ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x01"
179 ;;
180 tplink,archer-c20i)
181 ucidef_set_led_switch "lan" "lan" "$boardname:blue:lan" "switch0" "0x1e"
182 ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x01"
183 ;;
184 tplink,archer-c50-v1)
185 ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x1e"
186 ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01"
187 ;;
188 tplink,archer-mr200)
189 ucidef_set_led_netdev "lan" "lan" "$boardname:white:lan" "eth0.1"
190 ucidef_set_led_netdev "wan" "wan" "$boardname:white:wan" "usb0"
191 ;;
192 tplink,re200-v1)
193 ucidef_set_led_netdev "lan" "lan" "$boardname:green:lan" "eth0"
194 ;;
195 youku,yk1)
196 set_wifi_led "$boardname:blue:air"
197 ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x10"
198 ;;
199 zbtlink,zbt-ape522ii)
200 ucidef_set_led_netdev "wlan2g4" "wlan1-link" "$boardname:green:wlan2g4" "wlan1"
201 ucidef_set_led_netdev "sys1" "wlan1" "$boardname:green:sys1" "wlan1" "tx rx"
202 ucidef_set_led_netdev "sys2" "wlan0" "$boardname:green:sys2" "wlan0" "tx rx"
203 ;;
204 zbtlink,zbt-wa05)
205 set_wifi_led "$boardname:blue:air"
206 ;;
207 zbtlink,zbt-we826-16m|\
208 zbtlink,zbt-we826-32m)
209 set_wifi_led "zbt-we826:green:wifi"
210 ;;
211 zbtlink,zbt-we1026-5g-16m)
212 ucidef_set_led_netdev "lan" "LAN" "we1026-5g:green:lan" "eth0"
213 set_wifi_led "we1026-5g:green:wifi"
214 ;;
215 zbtlink,zbt-we1026-h-32m)
216 set_wifi_led "we1026-h:green:wifi"
217 ucidef_set_led_switch "lan" "lan" "we1026-h:green:lan" "switch0" "0x8"
218 ucidef_set_led_switch "wan" "wan" "we1026-h:green:wan" "switch0" "0x10"
219 ;;
220 zbtlink,zbt-we2026)
221 set_wifi_led "$boardname:green:wlan"
222 ;;
223 esac
224
225 board_config_flush
226
227 exit 0