2008-08-04 22:56:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# (C) 2008 openwrt.org
|
|
|
|
|
2012-06-05 16:04:23 +00:00
|
|
|
. /lib/functions.sh
|
2008-08-04 22:56:46 +00:00
|
|
|
ACTION=$1
|
|
|
|
NAME=$2
|
|
|
|
do_led() {
|
|
|
|
local name
|
|
|
|
local sysfs
|
|
|
|
config_get name $1 name
|
|
|
|
config_get sysfs $1 sysfs
|
2014-10-14 12:21:11 +00:00
|
|
|
[ "$name" = "$NAME" -o "$sysfs" = "$NAME" -a -e "/sys/class/leds/${sysfs}" ] && {
|
|
|
|
[ "$ACTION" = "set" ] &&
|
2008-08-04 22:56:46 +00:00
|
|
|
echo 1 >/sys/class/leds/${sysfs}/brightness \
|
|
|
|
|| echo 0 >/sys/class/leds/${sysfs}/brightness
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-14 12:21:11 +00:00
|
|
|
[ "$1" = "clear" -o "$1" = "set" ] &&
|
2008-08-04 22:56:46 +00:00
|
|
|
[ -n "$2" ] &&{
|
|
|
|
config_load system
|
|
|
|
config_foreach do_led
|
|
|
|
exit 1
|
|
|
|
}
|