blob: d750f06ea7909339d57b087b7d8003a763239bbd [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#!/bin/sh
2# (C) 2008 openwrt.org
3
4. /lib/functions.sh
5ACTION=$1
6NAME=$2
7do_led() {
8 local name
9 local sysfs
10 config_get name $1 name
11 config_get sysfs $1 sysfs
12 [ "$name" = "$NAME" -o "$sysfs" = "$NAME" -a -e "/sys/class/leds/${sysfs}" ] && {
13 [ "$ACTION" = "set" ] &&
14 echo 1 >/sys/class/leds/${sysfs}/brightness \
15 || echo 0 >/sys/class/leds/${sysfs}/brightness
16 exit 0
17 }
18}
19
20[ "$1" = "clear" -o "$1" = "set" ] &&
21 [ -n "$2" ] &&{
22 config_load system
23 config_foreach do_led
24 exit 1
25 }