Files
wlan-ap/patches/0030-base-files-add-a-turnoff-command-to-the-led-script.patch
John Crispin 42251224b3 ucentral: development update
* more mac80211/hapd script improvements
* more led blink/off commands
* update ucentral-schema
* further improvement on maverick
* various ipq807x led improvements

Signed-off-by: John Crispin <john@phrozen.org>
2021-06-25 09:18:09 +02:00

62 lines
1.4 KiB
Diff

From d459f53ff9608c47fbf0b634fa4380bce1099d49 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 19 Apr 2021 13:49:20 +0200
Subject: [PATCH 31/36] base-files: add a turnoff command to the led script
Signed-off-by: John Crispin <john@phrozen.org>
---
package/base-files/files/etc/init.d/led | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led
index 8d97515d52..3221c8c44c 100755
--- a/package/base-files/files/etc/init.d/led
+++ b/package/base-files/files/etc/init.d/led
@@ -3,6 +3,9 @@
START=96
+extra_command "turnoff" "Turn all leds off"
+extra_command "blink" "Blink all leds"
+
load_led() {
local name
local sysfs
@@ -122,7 +125,25 @@ load_led() {
}
}
+turnoff() {
+ for led in `ls /sys/class/leds/`; do
+ echo none > /sys/class/leds/$led/trigger
+ echo 0 > /sys/class/leds/$led/brightness
+ done
+}
+
+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 get system.@system[-1].leds_off)" -eq 1 ] && {
+ turnoff
+ exit 0
+ }
[ -e /sys/class/leds/ ] && {
[ -s /var/run/led.state ] && {
local led trigger brightness
@@ -138,5 +159,7 @@ start() {
config_load system
config_foreach load_led led
+ . /etc/diag.sh
+ set_state done
}
}
--
2.25.1