source: trunk/target/linux/ar71xx/base-files/etc/uci-defaults/leds @ 29394

Last change on this file since 29394 was 29394, checked in by juhosg, 5 years ago

ar71xx: configure default led behavior for the OM2P

Signed-off-by: Marek Lindner <lindner_marek@…>

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/sh
2#
3# Copyright (C) 2011 OpenWrt.org
4#
5
6COMMIT_SYSTEM=0
7
8set_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
17set system.$cfg='led'
18set system.$cfg.name='$name'
19set system.$cfg.sysfs='$sysfs'
20set system.$cfg.trigger='netdev'
21set system.$cfg.dev='$dev'
22set system.$cfg.mode='link tx rx'
23EOF
24        COMMIT_SYSTEM=1
25}
26
27set_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
36set system.$cfg='led'
37set system.$cfg.name='$name'
38set system.$cfg.sysfs='$sysfs'
39set system.$cfg.trigger='usbdev'
40set system.$cfg.dev='$dev'
41set system.$cfg.interval='50'
42EOF
43        COMMIT_SYSTEM=1
44}
45
46set_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
55set system.$cfg='led'
56set system.$cfg.name='$name'
57set system.$cfg.sysfs='$sysfs'
58set system.$cfg.trigger='$trigger'
59EOF
60        COMMIT_SYSTEM=1
61}
62
63set_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
72set system.$cfg='led'
73set system.$cfg.name='$name'
74set system.$cfg.sysfs='$sysfs'
75set system.$cfg.default='$default'
76EOF
77        COMMIT_SYSTEM=1
78}
79
80. /lib/ar71xx.sh
81
82board=$(ar71xx_board_name)
83
84case "$board" in
85rb750)
86        set_led_default "act" "act" "rb750:green:act" "1"
87        set_led_netdev "port1" "port1" "rb750:green:port1" "eth1"
88        ;;
89
90dir-825-b1)
91        set_led_usbdev "usb" "USB" "dir825b1:blue:usb" "1-1"
92        ;;
93
94mzk-w04u)
95        set_led_usbdev "usb" "USB" "planex:green:usb" "1-1"
96        ;;
97
98nbg460n_550n_550nh)
99        set_led_wlan "wlan" "WLAN" "nbg460n:green:wlan" "phy0tpt"
100        ;;
101
102om2p)
103        set_led_netdev "port1" "port1" "om2p:blue:wan" "eth0"
104        set_led_netdev "port2" "port2" "om2p:blue:lan" "eth1"
105        ;;
106
107tl-mr3220 | \
108tl-mr3420 )
109        set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
110        ;;
111
112tl-wr741nd-v4 | \
113tl-wr941nd)
114        set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
115        ;;
116
117tl-wr1043nd)
118        set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
119        set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
120        ;;
121
122wrt160nl)
123        set_led_wlan "wlan" "WLAN" "wrt160nl:blue:wlan" "phy0tpt"
124        ;;
125
126wndr3700 | \
127wndr3700v2)
128        set_led_default "wan" "WAN LED (green)" "wndr3700:green:wan" "0"
129        set_led_usbdev "usb" "USB" "wndr3700:green:usb" "1-1"
130        ;;
131
132wzr-hp-g300nh)
133        set_led_wlan "wlan" "Wireless" "buffalo:green:wireless" "phy0tpt"
134        set_led_netdev "router" "Router" "buffalo:green:router" "eth1"
135        set_led_usbdev "usb" "USB" "buffalo:blue:usb" "1-1"
136        ;;
137
138zcn-1523h-2)
139        set_led_netdev "lan1" "lan1" "zcn-1523h:green:lan1" "eth0"
140        ;;
141
142zcn-1523h-5)
143        set_led_netdev "lan1" "lan1" "zcn-1523h:green:lan1" "eth0"
144        set_led_netdev "lan2" "lan2" "zcn-1523h:green:lan2" "eth1"
145        ;;
146esac
147
148[ "$COMMIT_SYSTEM" == "1" ] && uci commit system
149
150exit 0
Note: See TracBrowser for help on using the repository browser.