diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-04-16 20:09:30 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-04-16 20:09:30 +0000 |
commit | 93fb3cac1b46bd290b3a52c3011d7ffc5d2e524b (patch) | |
tree | a115496f55eb2d105b341b73b9f50205c459b1fb /package | |
parent | b3d699bdd3caa3d7e1db562ec67cf6b66da5e2df (diff) | |
download | upstream-93fb3cac1b46bd290b3a52c3011d7ffc5d2e524b.tar.gz upstream-93fb3cac1b46bd290b3a52c3011d7ffc5d2e524b.tar.bz2 upstream-93fb3cac1b46bd290b3a52c3011d7ffc5d2e524b.zip |
base-files: reorder led trigger/brightness writes
Depending on configuration, disable the LED before writing the trigger
and enable it after writing it. Fixes LEDs where the value defaults to 1
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 45463
Diffstat (limited to 'package')
-rwxr-xr-x | package/base-files/files/etc/init.d/led | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index 6962bfa843..ba4dd6791d 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -34,14 +34,17 @@ load_led() { [ -e /sys/class/leds/${sysfs}/brightness ] && { echo "setting up led ${name}" - [ "$default" != nil ] && { - [ $default -eq 1 ] && - echo 1 >/sys/class/leds/${sysfs}/brightness - [ $default -eq 1 ] || - echo 0 >/sys/class/leds/${sysfs}/brightness - } + + [ "$default" = 0 ] || + echo 0 >/sys/class/leds/${sysfs}/brightness + echo $trigger > /sys/class/leds/${sysfs}/trigger 2> /dev/null - [ $? = 0 ] || { + ret="$?" + + [ $default = 1 ] && + echo 1 >/sys/class/leds/${sysfs}/brightness + + [ $ret = 0 ] || { echo >&2 "Skipping trigger '$trigger' for led '$name' due to missing kernel module" return 1 } |