[systemd-devel] [PATCH] backlight: Do not clamp brightness for LEDs

Lennart Poettering lennart at poettering.net
Wed Jun 4 23:37:20 PDT 2014


On Thu, 05.06.14 01:25, Denis Tikhomirov (dvtikhomirov at gmail.com) wrote:

> Systemd-backlight can not set keyboard backlight level to 0 due to
> clamp_brightness.
> I found report for this, https://bugs.freedesktop.org/show_bug.cgi?id=77092
> , and it has patch attached. Josh Triplett <josh at joshtriplett.org> reviewed
> that patch and said that it looks good, but he would rather check not for
> "subsystem is not leds" but for "subsystem is backlight", so I made my
> version of fix.
> 
> ---
>  src/backlight/backlight.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
> index 691472c..2762fde 100644
> --- a/src/backlight/backlight.c
> +++ b/src/backlight/backlight.c
> @@ -381,7 +381,8 @@ int main(int argc, char *argv[]) {
>                          return EXIT_FAILURE;
>                  }
> 
> -                clamp_brightness(device, &value, max_brightness);
> +                if (streq(ss, "backlight"))
> +                        clamp_brightness(device, &value, max_brightness);
> 
>                  r = udev_device_set_sysattr_value(device, "brightness",
> value);
>                  if (r < 0) {

The patch is line-broken, please send an uncorrupted patch!

clamp_brightness() clamps the brightness value to the range of the
actual device. This is a recent addition that was added to deal with
driver updates where the resolution is changed. I don't think this part
should be dropped for LED devices. The clamp_brightness() call hence
should be called unconditionally, however, internally it should use a
different min_brightness value if something is an !backlight devices...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list