ar71xx: enable SWCONFIG_LEDS
[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_default() {
64 local cfg="led_$1"
65 local name=$2
66 local sysfs=$3
67 local default=$4
68
69 uci -q get system.$cfg && return 0
70
71 uci batch <<EOF
72 set system.$cfg='led'
73 set system.$cfg.name='$name'
74 set system.$cfg.sysfs='$sysfs'
75 set system.$cfg.default='$default'
76 EOF
77 COMMIT_SYSTEM=1
78 }
79
80 . /lib/ar71xx.sh
81
82 board=$(ar71xx_board_name)
83
84 case "$board" in
85 rb750)
86 set_led_default "act" "act" "rb750:green:act" "1"
87 set_led_netdev "port1" "port1" "rb750:green:port1" "eth1"
88 ;;
89
90 dir-825-b1)
91 set_led_usbdev "usb" "USB" "dir825b1:blue:usb" "1-1"
92 ;;
93
94 hornet-ub)
95 set_led_netdev "lan" "LAN" "alfa:blue:lan" "eth0"
96 set_led_netdev "wan" "WAN" "alfa:blue:wan" "eth1"
97 set_led_wlan "wlan" "WLAN" "alfa:blue:wlan" "phy0tpt"
98 set_led_usbdev "usb" "USB" "alfa:blue:usb" "1-1"
99 ;;
100
101 mzk-w04u)
102 set_led_usbdev "usb" "USB" "planex:green:usb" "1-1"
103 ;;
104
105 nbg460n_550n_550nh)
106 set_led_wlan "wlan" "WLAN" "nbg460n:green:wlan" "phy0tpt"
107 ;;
108
109 om2p)
110 set_led_netdev "port1" "port1" "om2p:blue:wan" "eth0"
111 set_led_netdev "port2" "port2" "om2p:blue:lan" "eth1"
112 ;;
113
114 tl-mr3220 | \
115 tl-mr3420 )
116 set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
117 ;;
118
119 tl-wr741nd-v4 | \
120 tl-wr941nd)
121 set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
122 ;;
123
124 tl-wr1043nd)
125 set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
126 set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
127 ;;
128
129 wrt160nl)
130 set_led_wlan "wlan" "WLAN" "wrt160nl:blue:wlan" "phy0tpt"
131 ;;
132
133 wndr3700)
134 set_led_default "wan" "WAN LED (green)" "wndr3700:green:wan" "0"
135 set_led_usbdev "usb" "USB" "wndr3700:green:usb" "1-1"
136 ;;
137
138 wzr-hp-g300nh)
139 set_led_wlan "wlan" "Wireless" "buffalo:green:wireless" "phy0tpt"
140 set_led_netdev "router" "Router" "buffalo:green:router" "eth1"
141 set_led_usbdev "usb" "USB" "buffalo:blue:usb" "1-1"
142 ;;
143
144 zcn-1523h-2)
145 set_led_netdev "lan1" "lan1" "zcn-1523h:green:lan1" "eth0"
146 ;;
147
148 zcn-1523h-5)
149 set_led_netdev "lan1" "lan1" "zcn-1523h:green:lan1" "eth0"
150 set_led_netdev "lan2" "lan2" "zcn-1523h:green:lan2" "eth1"
151 ;;
152 esac
153
154 [ "$COMMIT_SYSTEM" == "1" ] && uci commit system
155
156 exit 0
This page took 0.049464 seconds and 5 git commands to generate.