Incrementing or decrementing by 0 changes brightness by 10 instead.
Appears to be by design, see line 199 of usr.bin/backlight/backlight.c: percent = percent == 0 ? 10 : percent; If this behavior isn't changed to do nothing instead, it should maybe be documented on the man page. I imagine the idea is to incr/decr by 10 only if no percentage is provided, rather than to do this specifically given a percentage of zero.
Simple fix: diff --git a/usr.bin/backlight/backlight.c b/usr.bin/backlight/backlight.c index 1dae0cfe5c6..180b9114876 100644 --- a/usr.bin/backlight/backlight.c +++ b/usr.bin/backlight/backlight.c @@ -98,7 +98,7 @@ main(int argc, char *argv[]) BACKLIGHTGETSTATUS, BACKLIGHTUPDATESTATUS, BACKLIGHTGETINFO}; - long percent = 0; + long percent = -1; const char *percent_error; uint32_t i; bool setname; @@ -196,7 +196,7 @@ main(int argc, char *argv[]) case BACKLIGHT_DECR: if (ioctl(fd, BACKLIGHTGETSTATUS, &props) == -1) errx(1, "Cannot query the backlight device"); - percent = percent == 0 ? 10 : percent; + percent = percent == -1 ? 10 : percent; percent = action == BACKLIGHT_INCR ? percent : -percent; props.brightness += percent; if ((int)props.brightness < 0)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3b005d51bd0fe4d8d19fb2df4d470b6e8baebf16 commit 3b005d51bd0fe4d8d19fb2df4d470b6e8baebf16 Author: David Schlachter <fbsd-bugzilla@schlachter.ca> AuthorDate: 2021-03-03 07:57:35 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2021-03-03 07:57:35 +0000 backlight: Fix incr/decr with percent value of 0 This now does nothing instead of incr/decr by 10% MFC After: 3 days PR: 253736 usr.bin/backlight/backlight.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=9ba393f2ca0fd561c1fbf96f38eb014d7f883381 commit 9ba393f2ca0fd561c1fbf96f38eb014d7f883381 Author: David Schlachter <fbsd-bugzilla@schlachter.ca> AuthorDate: 2021-03-03 07:57:35 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2021-03-10 10:49:25 +0000 backlight: Fix incr/decr with percent value of 0 This now does nothing instead of incr/decr by 10% MFC After: 3 days PR: 253736 (cherry picked from commit 3b005d51bd0fe4d8d19fb2df4d470b6e8baebf16) usr.bin/backlight/backlight.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
A commit in branch releng/13.0 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=cb603e3ea2d4f2fee8fa4e59bda7e27704b6899c commit cb603e3ea2d4f2fee8fa4e59bda7e27704b6899c Author: David Schlachter <fbsd-bugzilla@schlachter.ca> AuthorDate: 2021-03-03 07:57:35 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2021-03-11 08:49:03 +0000 backlight: Fix incr/decr with percent value of 0 This now does nothing instead of incr/decr by 10% MFC After: 3 days PR: 253736 Approved by: re (gjb) (cherry picked from commit 3b005d51bd0fe4d8d19fb2df4d470b6e8baebf16) (cherry picked from commit 9ba393f2ca0fd561c1fbf96f38eb014d7f883381) usr.bin/backlight/backlight.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)