mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-18 21:28:02 +00:00
base-files: allow forcing all LEDs to on/off/blink state
* add a UCI option to disable all LEDs. * add an init.d parameter to blink all LEDs * add on/off parameters to init.d Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
parent
3b661cfcf9
commit
1af15e8a2b
@ -3,6 +3,10 @@
|
||||
|
||||
START=96
|
||||
|
||||
extra_command "turnon" "Put the LEDs into their default state"
|
||||
extra_command "turnoff" "Turn all LEDs off"
|
||||
extra_command "blink" "Blink all LEDs"
|
||||
|
||||
led_color_set() {
|
||||
local cfg="$1"
|
||||
local sysfs="$2"
|
||||
@ -168,7 +172,31 @@ load_led() {
|
||||
}
|
||||
}
|
||||
|
||||
turnoff() {
|
||||
for led in `ls /sys/class/leds/`; do
|
||||
echo 0 > /sys/class/leds/$led/brightness
|
||||
done
|
||||
}
|
||||
|
||||
turnon() {
|
||||
turnoff
|
||||
. /etc/diag.sh
|
||||
set_state done
|
||||
start
|
||||
}
|
||||
|
||||
blink() {
|
||||
for led in `ls /sys/class/leds/`; do
|
||||
echo 0 > /sys/class/leds/$led/brightness
|
||||
echo timer > /sys/class/leds/$led/trigger
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
[ "$(uci -q get system.@system[-1].leds_off)" = '1' ] && {
|
||||
turnoff
|
||||
exit 0
|
||||
}
|
||||
[ -e /sys/class/leds/ ] && {
|
||||
[ -s /var/run/led.state ] && {
|
||||
local led trigger brightness color
|
||||
|
Loading…
Reference in New Issue
Block a user