backlight_control
backlight_control copied to clipboard
Revamp
Previously (i.e commit 9a79e0d),
backlight_control
would not validate the value
argument and set unexpected brightness values.
For example:
backlight_control -100
Sets the current brigthness to 0
.
Although Linux ensures the value set in /sys/class/backlight/<backlight>/brightness
is between 0
and max_brightness
, I think it would be nice to notify the user of invalid arguments.
Thanks for reading and I am open to feedback.
Hi Alejandro,
Thanks for your interest and contribution :)
I agree with the technical changes (like ab68af529e1d4b34e6ccac5aa0dd3027f0f032b6), but I don't want to change the coding style (e.g. 2b2725d2d2d34abbafccbf47fa736278d660d2dc). Are you fine with cherry-picking just some of the commits from your branch?
Best, Hendrik
I am fine with that @Hendrikto
Edit 1:
What do you think about replacing the conditional expression ((value < 0 ? value *= -1 : value)
) for labs
function from stdlib
header?
if (labs(value) >= 1 && labs(value) <= 100)