[ar7] let 802.1q tagged frames go in and out from cpmac (#6730)
[openwrt.git] / package / base-files / files / etc / init.d / led
1 #!/bin/sh /etc/rc.common
2 # (C) 2008 openwrt.org
3
4 START=96
5
6 load_led() {
7 local name
8 local sysfs
9 local trigger
10 local dev
11 local mode
12 local default
13 local delayon
14 local delayoff
15
16 config_get sysfs $1 sysfs
17 config_get name $1 name "$sysfs"
18 config_get trigger $1 trigger "none"
19 config_get dev $1 dev
20 config_get mode $1 mode "link"
21 config_get_bool default $1 default "nil"
22 config_get delayon $1 delayon
23 config_get delayoff $1 delayoff
24
25 [ -e /sys/class/leds/${sysfs}/brightness ] && {
26 echo "setting up led ${name}"
27 [ "$default" != nil ] && {
28 [ $default -eq 1 ] &&
29 echo 1 >/sys/class/leds/${sysfs}/brightness
30 [ $default -eq 1 ] ||
31 echo 0 >/sys/class/leds/${sysfs}/brightness
32 }
33 echo $trigger > /sys/class/leds/${sysfs}/trigger
34 [ "$trigger" == "netdev" -a -n "$dev" ] && {
35 echo $dev > /sys/class/leds/${sysfs}/device_name
36 echo $mode > /sys/class/leds/${sysfs}/mode
37 }
38 [ "$trigger" == "timer" ] && {
39 [ -n "$delayon" ] && echo $delayon > /sys/class/leds/${sysfs}/delay_on
40 [ -n "$delayoff" ] && echo $delayoff > /sys/class/leds/${sysfs}/delay_off
41 }
42 }
43 }
44
45 start() {
46 [ -e /sys/class/leds/ ] && {
47 config_load system
48 config_foreach load_led led
49 }
50 }
This page took 0.057294 seconds and 5 git commands to generate.