base-files: LED/trigger/heartbeat: Add support for inversion
authorOlliver Schinagl <oliver@schinagl.nl>
Sun, 31 Jul 2022 08:11:58 +0000 (10:11 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 6 Aug 2022 17:58:46 +0000 (19:58 +0200)
The heartbeat trigger has the option to be inverted, however
openwrt/uci/luci have no way to set this.

This patch adds this support.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
package/base-files/files/etc/init.d/led

index 732ac59a84f0648f966f81373a9b9ce31e1b5842..08a1e6df3bbaf697c1eaaaea8e2501af77f4f901 100755 (executable)
@@ -69,6 +69,10 @@ load_led() {
                        return 1
                }
                case "$trigger" in
+               "heartbeat")
+                       echo "${inverted}" > "/sys/class/leds/${sysfs}/invert"
+                       ;;
+
                "netdev")
                        [ -n "$dev" ] && {
                                echo $dev > /sys/class/leds/${sysfs}/device_name