aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-04-16 20:09:30 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-04-16 20:09:30 +0000
commit00ba2268e30102b54412556c4bdcfda699bfa62a (patch)
treed68c478d88f24fb9741cb478cf81944d72f5cea9 /package
parent98524cc69868a3cf90201dcb43b4fc0361998598 (diff)
downloadupstream-00ba2268e30102b54412556c4bdcfda699bfa62a.tar.gz
upstream-00ba2268e30102b54412556c4bdcfda699bfa62a.tar.bz2
upstream-00ba2268e30102b54412556c4bdcfda699bfa62a.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> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45463 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/etc/init.d/led17
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
}