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