[OpenWrt-Devel] [PATCH 1/3] uci-defaults: add ucidef_set_led_mmc

Álvaro Fernández Rojas noltari at gmail.com
Sat Feb 14 12:41:33 EST 2015


Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
 package/base-files/files/lib/functions/uci-defaults.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index eb5b240..5a8809d 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -140,6 +140,23 @@ EOF
 	UCIDEF_LEDS_CHANGED=1
 }
 
+ucidef_set_led_mmc() {
+	local cfg="led_$1"
+	local name=$2
+	local sysfs=$3
+	local trigger=$4
+
+	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='$trigger'
+EOF
+	UCIDEF_LEDS_CHANGED=1
+}
+
 ucidef_set_rssimon() {
 	local dev="$1"
 	local refresh="$2"
-- 
1.9.1
_______________________________________________
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