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

Topi Miettinen toiwoton at gmail.com
Sat Jan 31 01:30:40 PST 2015


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.

-Topi

> 
> Otherwise looks fine to me.
> 
> Lennart
> 



More information about the systemd-devel mailing list