Skip to content

Commit

Permalink
base-files: fix shell scope error for the default LED brightness
Browse files Browse the repository at this point in the history
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 cbdfd03: "base-files: add option to set LED brightness"
Signed-off-by: Andre Heider <[email protected]>
Link: openwrt/openwrt#17269
Signed-off-by: John Crispin <[email protected]>
  • Loading branch information
dhewg authored and blogic committed Dec 14, 2024
1 parent 15e173b commit 3c7134f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions package/base-files/files/etc/init.d/led
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 3c7134f

Please sign in to comment.