summaryrefslogtreecommitdiff
path: root/src/backlight
diff options
context:
space:
mode:
authorTopi Miettinen <toiwoton@gmail.com>2015-02-01 08:49:02 +0200
committerLennart Poettering <lennart@poettering.net>2015-02-02 17:18:40 +0100
commitbca81be7755d15e7369d764bfa94a7ca6c595c76 (patch)
tree23fe22a95eb2fae1cbf8f4218e489a0a6c36f475 /src/backlight
parent3f4d56a069d8aedc0a784b6f4a2c049db76289b7 (diff)
backlight: let udev properties override clamping
On my computer, the minimum brightness enforced by clamping in backlight is too bright. Let udev property ID_BACKLIGHT_CLAMP control whether the brightness is clamped or not.
Diffstat (limited to 'src/backlight')
-rw-r--r--src/backlight/backlight.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index 1271a66983..c79ad6520c 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 || parse_boolean(clamp) != 0) /* default to clamping */
+ clamp_brightness(device, &value, max_brightness);
r = udev_device_set_sysattr_value(device, "brightness", value);
if (r < 0) {