Files
wlan-ap/patches/0030-base-files-add-a-turnoff-command-to-the-led-script.patch
John Crispin 7a40e97658 ucentral: development update
* rename eap6x0 to exxx7
* update schema
* update client
* update gateway
* update usteer
* implement all missing ucentral commands
* patch the led script to allow turning of all leds

Signed-off-by: John Crispin <john@phrozen.org>
2021-04-19 13:53:08 +02:00

54 lines
1.2 KiB
Diff

From 43f1072a42dd19a0718c44c58daf3f9e5a3c9421 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 19 Apr 2021 13:49:20 +0200
Subject: [PATCH] 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 | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led
index 8d97515d52..9f7930feed 100755
--- a/package/base-files/files/etc/init.d/led
+++ b/package/base-files/files/etc/init.d/led
@@ -3,6 +3,8 @@
START=96
+extra_command "turnoff" "Turn all leds off"
+
load_led() {
local name
local sysfs
@@ -122,7 +124,18 @@ 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
+}
+
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 +151,7 @@ start() {
config_load system
config_foreach load_led led
+ . /etc/diag.sh
+ set_state done
}
}
--
2.25.1