uci-defaults: add ucidef_set_led_mmc
authorJohn Crispin <john@openwrt.org>
Sat, 14 Feb 2015 20:47:58 +0000 (20:47 +0000)
committerJohn Crispin <john@openwrt.org>
Sat, 14 Feb 2015 20:47:58 +0000 (20:47 +0000)
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
SVN-Revision: 44446

package/base-files/files/lib/functions/uci-defaults.sh

index eb5b240ee3080e369e9ceb8ddfef5a0d6d3976de..5a8809d68c89ac0431919f15dad5f5c33351bbf2 100644 (file)
@@ -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"