ar71xx: change LED name prefix on the jjplus boards
[openwrt.git] / target / linux / ar71xx / base-files / etc / uci-defaults / leds
1 #!/bin/sh
2 #
3 # Copyright (C) 2011 OpenWrt.org
4 #
5
6 COMMIT_SYSTEM=0
7
8 set_led_netdev() {
9 local cfg="led_$1"
10 local name=$2
11 local sysfs=$3
12 local dev=$4
13
14 uci -q get system.$cfg && return 0
15
16 uci batch <<EOF
17 set system.$cfg='led'
18 set system.$cfg.name='$name'
19 set system.$cfg.sysfs='$sysfs'
20 set system.$cfg.trigger='netdev'
21 set system.$cfg.dev='$dev'
22 set system.$cfg.mode='link tx rx'
23 EOF
24 COMMIT_SYSTEM=1
25 }
26
27 set_led_usbdev() {
28 local cfg="led_$1"
29 local name=$2
30 local sysfs=$3
31 local dev=$4
32
33 uci -q get system.$cfg && return 0
34
35 uci batch <<EOF
36 set system.$cfg='led'
37 set system.$cfg.name='$name'
38 set system.$cfg.sysfs='$sysfs'
39 set system.$cfg.trigger='usbdev'
40 set system.$cfg.dev='$dev'
41 set system.$cfg.interval='50'
42 EOF
43 COMMIT_SYSTEM=1
44 }
45
46 set_led_wlan() {
47 local cfg="led_$1"
48 local name=$2
49 local sysfs=$3
50 local trigger=$4
51
52 uci -q get system.$cfg && return 0
53
54 uci batch <<EOF
55 set system.$cfg='led'
56 set system.$cfg.name='$name'
57 set system.$cfg.sysfs='$sysfs'
58 set system.$cfg.trigger='$trigger'
59 EOF
60 COMMIT_SYSTEM=1
61 }
62
63 set_led_switch() {
64 local cfg="led_$1"
65 local name=$2
66 local sysfs=$3
67 local trigger=$4
68 local port_mask=$5
69
70 uci -q get system.$cfg && return 0
71
72 uci batch <<EOF
73 set system.$cfg='led'
74 set system.$cfg.name='$name'
75 set system.$cfg.sysfs='$sysfs'
76 set system.$cfg.trigger='$trigger'
77 set system.$cfg.port_mask='$port_mask'
78 EOF
79 COMMIT_SYSTEM=1
80 }
81
82 set_led_default() {
83 local cfg="led_$1"
84 local name=$2
85 local sysfs=$3
86 local default=$4
87
88 uci -q get system.$cfg && return 0
89
90 uci batch <<EOF
91 set system.$cfg='led'
92 set system.$cfg.name='$name'
93 set system.$cfg.sysfs='$sysfs'
94 set system.$cfg.default='$default'
95 EOF
96 COMMIT_SYSTEM=1
97 }
98
99 . /lib/ar71xx.sh
100
101 board=$(ar71xx_board_name)
102
103 case "$board" in
104 alfa-nx)
105 set_led_netdev "wan" "WAN" "alfa:green:led_2" "eth0"
106 set_led_netdev "lan" "LAN" "alfa:green:led_3" "eth1"
107 ;;
108
109 ap113)
110 set_led_usbdev "usb" "USB" "ap113:green:usb" "1-1"
111 ;;
112 rb750)
113 set_led_default "act" "act" "rb750:green:act" "1"
114 set_led_netdev "port1" "port1" "rb750:green:port1" "eth1"
115 set_led_switch "port2" "port2" "rb750:green:port2" "switch0" "0x10"
116 set_led_switch "port3" "port3" "rb750:green:port3" "switch0" "0x08"
117 set_led_switch "port4" "port4" "rb750:green:port4" "switch0" "0x04"
118 set_led_switch "port5" "port5" "rb750:green:port5" "switch0" "0x02"
119 ;;
120
121 dir-600-a1|\
122 dir-615-e4)
123 set_led_netdev "wan" "WAN" "d-link:green:wan" "eth1"
124 set_led_switch "lan1" "LAN1" "d-link:green:lan1" "switch0" "0x02"
125 set_led_switch "lan2" "LAN2" "d-link:green:lan2" "switch0" "0x04"
126 set_led_switch "lan3" "LAN3" "d-link:green:lan3" "switch0" "0x08"
127 set_led_switch "lan4" "LAN4" "d-link:green:lan4" "switch0" "0x10"
128 ;;
129
130 dir-825-b1)
131 set_led_usbdev "usb" "USB" "d-link:blue:usb" "1-1"
132 ;;
133
134 hornet-ub)
135 set_led_netdev "lan" "LAN" "alfa:blue:lan" "eth0"
136 set_led_netdev "wan" "WAN" "alfa:blue:wan" "eth1"
137 set_led_wlan "wlan" "WLAN" "alfa:blue:wlan" "phy0tpt"
138 set_led_usbdev "usb" "USB" "alfa:blue:usb" "1-1"
139 ;;
140
141 mzk-w04u)
142 set_led_usbdev "usb" "USB" "planex:green:usb" "1-1"
143 ;;
144
145 mzk-w300nh)
146 set_led_wlan "wlan" "WLAN" "planex:green:wlan" "phy0tpt"
147 ;;
148
149 nbg460n_550n_550nh)
150 set_led_wlan "wlan" "WLAN" "nbg460n:green:wlan" "phy0tpt"
151 ;;
152
153 om2p)
154 set_led_netdev "port1" "port1" "om2p:blue:wan" "eth0"
155 set_led_netdev "port2" "port2" "om2p:blue:lan" "eth1"
156 ;;
157
158 tl-mr11u | \
159 tl-mr3020)
160 set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
161 set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
162 set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
163 ;;
164
165 tl-mr3220 | \
166 tl-mr3420 )
167 set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
168 ;;
169
170 tl-wa901nd)
171 set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
172 ;;
173
174 tl-wr741nd)
175 set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
176 set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x02"
177 set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x04"
178 set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x08"
179 set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x10"
180 ;;
181
182 tl-wr741nd-v4)
183 set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
184 set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
185 set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
186 set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x10"
187 set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
188 ;;
189
190 tl-wr941nd)
191 set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
192 ;;
193
194 tl-wr1043nd)
195 set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
196 set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
197 ;;
198
199 tl-wr2543n)
200 set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
201 ;;
202
203 wrt160nl)
204 set_led_wlan "wlan" "WLAN" "wrt160nl:blue:wlan" "phy0tpt"
205 ;;
206
207 wndr3700)
208 set_led_default "wan" "WAN LED (green)" "wndr3700:green:wan" "0"
209 set_led_usbdev "usb" "USB" "wndr3700:green:usb" "1-1"
210 ;;
211
212 whr-g301n |\
213 whr-hp-g300n |\
214 whr-hp-gn)
215 set_led_netdev "wan" "WAN" "buffalo:green:wan" "eth1"
216 set_led_switch "lan1" "LAN1" "buffalo:green:lan1" "switch0" "0x02"
217 set_led_switch "lan2" "LAN2" "buffalo:green:lan2" "switch0" "0x04"
218 set_led_switch "lan3" "LAN3" "buffalo:green:lan3" "switch0" "0x08"
219 set_led_switch "lan4" "LAN4" "buffalo:green:lan4" "switch0" "0x10"
220 ;;
221
222 wzr-hp-g300nh)
223 set_led_wlan "wlan" "Wireless" "buffalo:green:wireless" "phy0tpt"
224 set_led_netdev "router" "Router" "buffalo:green:router" "eth1"
225 set_led_usbdev "usb" "USB" "buffalo:blue:usb" "1-1"
226 ;;
227
228 zcn-1523h-2)
229 set_led_netdev "lan1" "lan1" "zcn-1523h:green:lan1" "eth0"
230 ;;
231
232 zcn-1523h-5)
233 set_led_netdev "lan1" "lan1" "zcn-1523h:green:lan1" "eth0"
234 set_led_netdev "lan2" "lan2" "zcn-1523h:green:lan2" "eth1"
235 ;;
236 esac
237
238 [ "$COMMIT_SYSTEM" == "1" ] && uci commit system
239
240 exit 0
This page took 0.0669 seconds and 5 git commands to generate.