Skip to content

Commit 5e0c1f2

Browse files
committed
backlight: also change clamp percentage on ID_BACKLIGHT_CLAMP/ID_LEDS_CLAMP=yes
Follow-up for 4ed1e2e.
1 parent ad3e4af commit 5e0c1f2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/backlight/backlight.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ static int clamp_brightness(
372372
return 0;
373373
}
374374

375+
/* used as the default for devices in the backlight subsystem, or when ID_BACKLIGHT_CLAMP/ID_LEDS_CLAMP=yes. */
376+
#define DEFAULT_CLAMP_PERCENT 1u
377+
375378
static int shall_clamp(sd_device *device, unsigned *ret) {
376379
const char *property, *s;
377380
unsigned default_percent;
@@ -385,10 +388,10 @@ static int shall_clamp(sd_device *device, unsigned *ret) {
385388
return r;
386389
if (r > 0) {
387390
property = "ID_BACKLIGHT_CLAMP";
388-
default_percent = 1;
391+
default_percent = DEFAULT_CLAMP_PERCENT;
389392
} else {
390393
property = "ID_LEDS_CLAMP";
391-
default_percent = 0;
394+
default_percent = 0; /* The clamping is disabled by default. */
392395
}
393396

394397
r = sd_device_get_property_value(device, property, &s);
@@ -401,7 +404,7 @@ static int shall_clamp(sd_device *device, unsigned *ret) {
401404

402405
r = parse_boolean(s);
403406
if (r >= 0) {
404-
*ret = r ? 5 : 0;
407+
*ret = r ? DEFAULT_CLAMP_PERCENT : 0;
405408
return r;
406409
}
407410

0 commit comments

Comments
 (0)