[systemd-devel] [PATCH] backlight: let udev properties override clamping

Lennart Poettering lennart at poettering.net
Wed Jan 28 16:09:16 PST 2015


On Wed, 28.01.15 23:51, Topi Miettinen (toiwoton at gmail.com) wrote:

> diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
> index 1271a66..df53b75 100644
> --- a/src/backlight/backlight.c
> +++ b/src/backlight/backlight.c
> @@ -373,6 +373,7 @@ int main(int argc, char *argv[]) {
>  
>          if (streq(argv[1], "load")) {
>                  _cleanup_free_ char *value = NULL;
> +                const char *clamp;
>  
>                  if (!shall_restore_state())
>                          return EXIT_SUCCESS;
> @@ -390,7 +391,9 @@ int main(int argc, char *argv[]) {
>                          return EXIT_FAILURE;
>                  }
>  
> -                clamp_brightness(device, &value, max_brightness);
> +                clamp = udev_device_get_property_value(device, "ID_BACKLIGHT_CLAMP");
> +                if (clamp == NULL || streq(clamp, "1"))

Please use parse_boolean() for this.

I think it would be better to name this ID_BACKLIGHT_CLAMP_MIN or so.

Otherwise looks fine to me.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list