From 3c7134fa320b823ab7c5f91dd1ad948491d97478 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Sat, 14 Dec 2024 11:27:09 +0100 Subject: [PATCH] base-files: fix shell scope error for the default LED brightness This fixes "sh: write error: Invalid argument" for all default!=1 LEDs as an empty $brightness was used. Setting up LEDs via luci also now works again. Fixes cbdfd03e: "base-files: add option to set LED brightness" Signed-off-by: Andre Heider Link: https://github.com/openwrt/openwrt/issues/17269 Signed-off-by: John Crispin --- package/base-files/files/etc/init.d/led | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index d292e2a8dd..79fdd452ce 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -106,9 +106,10 @@ load_led() { [ "$default" = 0 ] && echo 0 >/sys/class/leds/${sysfs}/brightness - [ $default = 1 ] && - [ -z "$brightness" ] && brightness=$(cat /sys/class/leds/${sysfs}/max_brightness) - echo $brightness > /sys/class/leds/${sysfs}/brightness + [ "$default" = 1 ] && { + [ -z "$brightness" ] && brightness="$(cat /sys/class/leds/${sysfs}/max_brightness)" + echo "$brightness" > /sys/class/leds/${sysfs}/brightness + } led_color_set "$1" "$sysfs" -- 2.30.2