From: Yu Watanabe Date: Mon, 16 Feb 2026 10:16:35 +0000 (+0900) Subject: backlight: also change clamp percentage on ID_BACKLIGHT_CLAMP/ID_LEDS_CLAMP=yes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e0c1f2e1b6dd337482260eaea474720f0dc5723;p=thirdparty%2Fsystemd.git backlight: also change clamp percentage on ID_BACKLIGHT_CLAMP/ID_LEDS_CLAMP=yes Follow-up for 4ed1e2ea17e0f29a23d7a3dd65af192def9b3214. --- diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c index 15e0d17b8dd..027379809d1 100644 --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c @@ -372,6 +372,9 @@ static int clamp_brightness( return 0; } +/* used as the default for devices in the backlight subsystem, or when ID_BACKLIGHT_CLAMP/ID_LEDS_CLAMP=yes. */ +#define DEFAULT_CLAMP_PERCENT 1u + static int shall_clamp(sd_device *device, unsigned *ret) { const char *property, *s; unsigned default_percent; @@ -385,10 +388,10 @@ static int shall_clamp(sd_device *device, unsigned *ret) { return r; if (r > 0) { property = "ID_BACKLIGHT_CLAMP"; - default_percent = 1; + default_percent = DEFAULT_CLAMP_PERCENT; } else { property = "ID_LEDS_CLAMP"; - default_percent = 0; + default_percent = 0; /* The clamping is disabled by default. */ } r = sd_device_get_property_value(device, property, &s); @@ -401,7 +404,7 @@ static int shall_clamp(sd_device *device, unsigned *ret) { r = parse_boolean(s); if (r >= 0) { - *ret = r ? 5 : 0; + *ret = r ? DEFAULT_CLAMP_PERCENT : 0; return r; }