diff options
author | Florian Eckert <fe@dev.tdt.de> | 2020-02-05 09:23:27 +0100 |
---|---|---|
committer | Paul Spooren <mail@aparcar.org> | 2021-03-05 00:10:06 -1000 |
commit | dec14ac436325abddd0ded06f34e95425fc9a75e (patch) | |
tree | a8d8f4ce7662a5eb1246c93cf3a8195955f1f371 | |
parent | 58ad113087b3db7567507202b94d94756056a455 (diff) | |
download | upstream-dec14ac436325abddd0ded06f34e95425fc9a75e.tar.gz upstream-dec14ac436325abddd0ded06f34e95425fc9a75e.tar.bz2 upstream-dec14ac436325abddd0ded06f34e95425fc9a75e.zip |
base-files: add new application led trigger backend
For now we have only kernel LED trigger support. With this change it is now
possible to use application triggers.
If we configure a LED with a non kernel trigger, then we check on every
restart and boot of the LED service if we have this trigger as an application
in "/usr/libexec/led-trigger". If this file with the name is found, then we
execute this to init the LED.
Possible use cases are:
- Start/Stop/Restart an application led trigger service for this led
- Init a LED that is configured by a hotplug script (VPN tunnel established)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
-rwxr-xr-x | package/base-files/files/etc/init.d/led | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index 277fb4e76f..51cb8b5178 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -31,10 +31,11 @@ load_led() { config_get gpio $1 gpio "0" config_get inverted $1 inverted "0" - if [ "$trigger" = "rssi" ]; then - # handled by rssileds userspace process - return - fi + # execute application led trigger + [ -f "/usr/libexec/led-trigger/${trigger}" ] && { + . "/usr/libexec/led-trigger/${trigger}" + return 0 + } [ "$trigger" = "usbdev" ] && { # Backward compatibility: translate to the new trigger |