[OpenWrt-Devel] [PATCH 5/7] base-files: allow setting ide-disk led trigger

Jonas Gorski jogo at openwrt.org
Fri Aug 21 07:45:19 EDT 2015


Signed-off-by: Jonas Gorski <jogo at openwrt.org>
---
 package/base-files/files/lib/functions/uci-defaults.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index 8ba95a2..2658d43 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -178,6 +178,22 @@ EOF
 	UCIDEF_LEDS_CHANGED=1
 }
 
+ucidef_set_led_ide_disk() {
+	local cfg="led_$1"
+	local name=$2
+	local sysfs=$3
+
+	uci -q get system.$cfg && return 0
+
+	uci batch <<EOF
+set system.$cfg='led'
+set system.$cfg.name='$name'
+set system.$cfg.sysfs='$sysfs'
+set system.$cfg.trigger='ide-disk'
+EOF
+	UCIDEF_LEDS_CHANGED=1
+}
+
 ucidef_set_rssimon() {
 	local dev="$1"
 	local refresh="$2"
-- 
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list