diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-11-26 13:53:06 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-11-26 13:53:06 +0000 |
commit | 1e347d1d169bd93fd8dcf4294541bcae8d36ab28 (patch) | |
tree | 20c80d1312971c15196c7f1e257c4fa8534e1c7d /package/base-files | |
parent | bc095ba4055bcff07ebbcbe646a9d2a1d94d7b8b (diff) | |
download | master-187ad058-1e347d1d169bd93fd8dcf4294541bcae8d36ab28.tar.gz master-187ad058-1e347d1d169bd93fd8dcf4294541bcae8d36ab28.tar.bz2 master-187ad058-1e347d1d169bd93fd8dcf4294541bcae8d36ab28.zip |
base-files: uci-defaults-new, config_generate: support for gpio leds
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47660 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files')
-rwxr-xr-x | package/base-files/files/bin/config_generate | 10 | ||||
-rwxr-xr-x | package/base-files/files/lib/functions/uci-defaults-new.sh | 21 |
2 files changed, 31 insertions, 0 deletions
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index a0ff53a72c..b6675f12ce 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -305,6 +305,16 @@ generate_led() { EOF case "$type" in + gpio) + local gpio inverted + json_get_vars gpio inverted + uci -q batch <<-EOF + set system.$cfg.trigger='gpio' + set system.$cfg.gpio='$gpio' + set system.$cfg.inverted='$inverted' + EOF + ;; + netdev) local device json_get_vars device diff --git a/package/base-files/files/lib/functions/uci-defaults-new.sh b/package/base-files/files/lib/functions/uci-defaults-new.sh index 2ea0742e1e..e79ec99f53 100755 --- a/package/base-files/files/lib/functions/uci-defaults-new.sh +++ b/package/base-files/files/lib/functions/uci-defaults-new.sh @@ -321,6 +321,27 @@ ucidef_set_led_default() { json_select .. } +ucidef_set_led_gpio() { + local cfg="led_$1" + local name="$2" + local sysfs="$3" + local gpio="$4" + local inverted="$5" + + json_select_object led + + json_select_object "$1" + json_add_string type gpio + json_add_string name "$name" + json_add_string sysfs "$sysfs" + json_add_string trigger "$trigger" + json_add_int gpio "$gpio" + json_add_boolean inverted "$inverted" + json_select .. + + json_select .. +} + ucidef_set_led_rssi() { local cfg="led_$1" local name="$2" |