From: John Crispin Date: Tue, 14 Jul 2015 07:35:59 +0000 (+0000) Subject: base-files: added option to configure the gpio led trigger in uci-defaults X-Git-Tag: reboot~2511 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d0d3ca2a1bc5fc61233351e1f5f5cd462e59407b;p=oweals%2Fopenwrt.git base-files: added option to configure the gpio led trigger in uci-defaults Signed-off-by: Günther Kelleter SVN-Revision: 46341 --- diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index 1a57e8afd7..3f45732499 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -26,6 +26,8 @@ load_led() { config_get port_state $1 port_state config_get delay $1 delay "150" config_get message $1 message "" + config_get gpio $1 gpio "0" + config_get inverted $1 inverted "0" if [ "$trigger" = "rssi" ]; then # handled by rssileds userspace process @@ -80,6 +82,11 @@ load_led() { echo $delay > /sys/class/leds/${sysfs}/delay ;; + "gpio") + echo $gpio > /sys/class/leds/${sysfs}/gpio + echo $inverted > /sys/class/leds/${sysfs}/inverted + ;; + switch[0-9]*) local port_mask diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 6577ecdcde..8ba95a22ff 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -158,6 +158,26 @@ EOF UCIDEF_LEDS_CHANGED=1 } +ucidef_set_led_trigger_gpio() { + local cfg="led_$1" + local name=$2 + local sysfs=$3 + local gpio=$4 + local inverted=$5 + + uci -q get system.$cfg && return 0 + + uci batch <