acpid: fix backlight stepping for low values of max_brightness

appearently, max_brightness can be as low as 15, which makes the integer
division round down to 0.

Fixes: c101203b25 ("acpid: cleanup handler")
Reported-by: slotThe <soliditsallgood@mailbox.org>
Signed-off-by: Piraty <piraty1@inbox.ru>
This commit is contained in:
Piraty 2021-10-22 23:07:06 +02:00
parent 0a854ab1f2
commit 65b31ee29e
No known key found for this signature in database
GPG key ID: 82F2CC796BD07077
2 changed files with 2 additions and 1 deletions

View file

@ -9,6 +9,7 @@ step_backlight() {
for backlight in /sys/class/backlight/*/; do
[ -d "$backlight" ] || continue
step=$(( $(cat "$backlight/max_brightness") / 20 ))
[ "$step" -gt "1" ] || step=1 #fallback if gradation is too low
printf '%s' "$(( $(cat "$backlight/brightness") $1 step ))" >"$backlight/brightness"
done
}

View file

@ -1,7 +1,7 @@
# Template file for 'acpid'
pkgname=acpid
version=2.0.33
revision=1
revision=2
build_style=gnu-configure
short_desc="ACPI Daemon (acpid) With Netlink Support"
maintainer="Enno Boland <gottox@voidlinux.org>"