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

Lennart Poettering lennart at poettering.net
Mon Feb 2 08:20:17 PST 2015


On Sat, 31.01.15 09:30, Topi Miettinen (toiwoton at gmail.com) wrote:

> On 01/29/15 00:09, Lennart Poettering wrote:
> > 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.
> 
> OK.
> 
> > 
> > I think it would be better to name this ID_BACKLIGHT_CLAMP_MIN or so.
> 
> _MIN as in minimum? The brightness is also clamped to maximum brightness
> advertised by the device.

Ah, I was confused for a moment, got lost between making this a prop
that ovverides the clamping parameter, and making this just a boolean
prop for turning this off and on... YOu made it the later, which is
fine, and hence disregard my comments about _MIN...

Your newer patch is merged now. THanks!

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list