diff --git a/0461-backlight-include-ID_PATH-in-file-names-for-backligh.patch b/0461-backlight-include-ID_PATH-in-file-names-for-backligh.patch new file mode 100644 index 0000000..26642da --- /dev/null +++ b/0461-backlight-include-ID_PATH-in-file-names-for-backligh.patch @@ -0,0 +1,82 @@ +From e58c591e5a969523356aafe7e8d308b42f0f401b Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 14 Oct 2013 19:01:09 +0200 +Subject: [PATCH] backlight: include ID_PATH in file names for backlight + settings + +Much like for rfkill devices we should provide some stability regarding +enumeration order, hence include the stable bits of the device path in +the file name we store settings under. + +(cherry picked from commit be3f52f4ed02a9256b1577719677b32a17b525ac) + +Conflicts: + rules/99-systemd.rules.in + src/rfkill/rfkill.c +--- + rules/99-systemd.rules.in | 4 ++-- + src/backlight/backlight.c | 29 ++++++++++++++++++++++++++--- + 2 files changed, 28 insertions(+), 5 deletions(-) + +diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in +index ff0e771..dd6e7f1 100644 +--- a/rules/99-systemd.rules.in ++++ b/rules/99-systemd.rules.in +@@ -57,8 +57,8 @@ ACTION=="add", SUBSYSTEM=="net", KERNEL!="lo", RUN+="@rootlibexecdir@/systemd-sy + # Pull in backlight save/restore for all backlight devices and + # keyboard backlights + +-SUBSYSTEM=="backlight", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service" +-SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service" ++SUBSYSTEM=="backlight", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service" ++SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service" + + # Asynchronously mount file systems implemented by these modules as + # soon as they are loaded. +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index 51a67a0..e8cdad6 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -195,8 +195,8 @@ static bool validate_device(struct udev *udev, struct udev_device *device) { + int main(int argc, char *argv[]) { + _cleanup_udev_unref_ struct udev *udev = NULL; + _cleanup_udev_device_unref_ struct udev_device *device = NULL; +- _cleanup_free_ char *saved = NULL, *ss = NULL; +- const char *sysname; ++ _cleanup_free_ char *saved = NULL, *ss = NULL, *escaped_ss = NULL, *escaped_sysname = NULL, *escaped_path_id = NULL; ++ const char *sysname, *path_id; + int r; + + if (argc != 3) { +@@ -252,7 +252,30 @@ int main(int argc, char *argv[]) { + return EXIT_FAILURE; + } + +- saved = strjoin("/var/lib/systemd/backlight/", ss, ":", sysname, NULL); ++ escaped_ss = cescape(ss); ++ if (!escaped_ss) { ++ log_oom(); ++ return EXIT_FAILURE; ++ } ++ ++ escaped_sysname = cescape(sysname); ++ if (!escaped_sysname) { ++ log_oom(); ++ return EXIT_FAILURE; ++ } ++ ++ path_id = udev_device_get_property_value(device, "ID_PATH"); ++ if (path_id) { ++ escaped_path_id = cescape(path_id); ++ if (!escaped_path_id) { ++ log_oom(); ++ return EXIT_FAILURE; ++ } ++ ++ saved = strjoin("/var/lib/systemd/backlight/", escaped_path_id, ":", escaped_ss, ":", escaped_sysname, NULL); ++ } else ++ saved = strjoin("/var/lib/systemd/backlight/", escaped_ss, ":", escaped_sysname, NULL); ++ + if (!saved) { + log_oom(); + return EXIT_FAILURE; diff --git a/0462-backlight-Fix-copy-paste-error-printing-an-unrelated.patch b/0462-backlight-Fix-copy-paste-error-printing-an-unrelated.patch new file mode 100644 index 0000000..117b90f --- /dev/null +++ b/0462-backlight-Fix-copy-paste-error-printing-an-unrelated.patch @@ -0,0 +1,29 @@ +From 732dc2c66fe60fd6eebc26f2492fc11f520e072c Mon Sep 17 00:00:00 2001 +From: Josh Triplett +Date: Tue, 11 Mar 2014 21:09:04 -0700 +Subject: [PATCH] backlight: Fix copy/paste error printing an unrelated error + code + +udev_device_get_sysattr_value returns NULL on failure, but doesn't +provide an error code; thus, when printing an error from it, don't print +an unrelated error code from a previous call. + +(cherry picked from commit cddc35f75ecff63b2ffd3f8e4c863d475e7b14ca) +(cherry picked from commit b8b80c8aa1effecb9c224cd3be1e8acbf7a44745) +--- + src/backlight/backlight.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index e8cdad6..4b04a3a 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -322,7 +322,7 @@ int main(int argc, char *argv[]) { + + value = udev_device_get_sysattr_value(device, "brightness"); + if (!value) { +- log_error("Failed to read system attribute: %s", strerror(-r)); ++ log_error("Failed to read system attribute"); + return EXIT_FAILURE; + } + diff --git a/0463-backlight-Avoid-restoring-brightness-to-an-unreadabl.patch b/0463-backlight-Avoid-restoring-brightness-to-an-unreadabl.patch new file mode 100644 index 0000000..6167b31 --- /dev/null +++ b/0463-backlight-Avoid-restoring-brightness-to-an-unreadabl.patch @@ -0,0 +1,79 @@ +From ab8e4f127e91881f8b63c13f5c4d0f4ab5807905 Mon Sep 17 00:00:00 2001 +From: Josh Triplett +Date: Tue, 11 Mar 2014 21:16:33 -0700 +Subject: [PATCH] backlight: Avoid restoring brightness to an unreadably dim + level + +Some systems turn the backlight all the way off at the lowest levels. +Clamp saved brightness to at least 1 or 5% of max_brightness. This +avoids preserving an unreadably dim screen, which would otherwise force +the user to disable state restoration. + +(cherry picked from commit 7b909d7407965c03caaba30daae7aee113627a83) +(cherry picked from commit 7bd1f7eab10b4b374b991da5cb378feb233ca0ca) +--- + src/backlight/backlight.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index 4b04a3a..2740b80 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -192,6 +192,48 @@ static bool validate_device(struct udev *udev, struct udev_device *device) { + return true; + } + ++/* Some systems turn the backlight all the way off at the lowest levels. ++ * clamp_brightness clamps the saved brightness to at least 1 or 5% of ++ * max_brightness. This avoids preserving an unreadably dim screen, which ++ * would otherwise force the user to disable state restoration. */ ++static void clamp_brightness(struct udev_device *device, char **value) { ++ int r; ++ const char *max_brightness_str; ++ unsigned brightness, max_brightness, new_brightness; ++ ++ max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness"); ++ if (!max_brightness_str) { ++ log_warning("Failed to read max_brightness attribute; not checking saved brightness"); ++ return; ++ } ++ ++ r = safe_atou(*value, &brightness); ++ if (r < 0) { ++ log_warning("Failed to parse brightness \"%s\": %s", *value, strerror(-r)); ++ return; ++ } ++ ++ r = safe_atou(max_brightness_str, &max_brightness); ++ if (r < 0) { ++ log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r)); ++ return; ++ } ++ ++ new_brightness = MAX3(brightness, 1U, max_brightness/20); ++ if (new_brightness != brightness) { ++ char *old_value = *value; ++ ++ r = asprintf(value, "%u", new_brightness); ++ if (r < 0) { ++ log_oom(); ++ return; ++ } ++ ++ log_debug("Saved brightness %s too low; increasing to %s.", old_value, *value); ++ free(old_value); ++ } ++} ++ + int main(int argc, char *argv[]) { + _cleanup_udev_unref_ struct udev *udev = NULL; + _cleanup_udev_device_unref_ struct udev_device *device = NULL; +@@ -306,6 +348,8 @@ int main(int argc, char *argv[]) { + return EXIT_FAILURE; + } + ++ clamp_brightness(device, &value); ++ + r = udev_device_set_sysattr_value(device, "brightness", value); + if (r < 0) { + log_error("Failed to write system attribute: %s", strerror(-r)); diff --git a/0464-backlight-do-nothing-if-max_brightness-is-0.patch b/0464-backlight-do-nothing-if-max_brightness-is-0.patch new file mode 100644 index 0000000..9d38e66 --- /dev/null +++ b/0464-backlight-do-nothing-if-max_brightness-is-0.patch @@ -0,0 +1,108 @@ +From 2d4460027359d91f442d2677e9ae42ea951e2430 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20B=C3=A4chler?= +Date: Thu, 27 Mar 2014 23:41:59 +0100 +Subject: [PATCH] backlight: do nothing if max_brightness is 0 + +On virtually any newer Asus mainboard, the eeepc-wmi driver is loaded. +It exposes a backlight device despite the lack of any physical backlight +devices. This fake backlight device has max_brightness set to 0. Since +the introduction of the clamp_brightness function, systemd-backlight +tries to write '1' to brightness and fails. + +This patch changes systemd-backlight to exit gracefully when +max_brightness is 0 before performing any action. This affects +both the load and save actions. + +(cherry picked from commit 3cadce7d33e263ec7a6a83c00c11144930258b22) +(cherry picked from commit 555853f8ad1b1db461c45843310bc324bca394de) +--- + src/backlight/backlight.c | 44 ++++++++++++++++++++++++++++++-------------- + 1 file changed, 30 insertions(+), 14 deletions(-) + +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index 2740b80..84bf51d 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -192,30 +192,37 @@ static bool validate_device(struct udev *udev, struct udev_device *device) { + return true; + } + +-/* Some systems turn the backlight all the way off at the lowest levels. +- * clamp_brightness clamps the saved brightness to at least 1 or 5% of +- * max_brightness. This avoids preserving an unreadably dim screen, which +- * would otherwise force the user to disable state restoration. */ +-static void clamp_brightness(struct udev_device *device, char **value) { ++static unsigned get_max_brightness(struct udev_device *device) { + int r; + const char *max_brightness_str; +- unsigned brightness, max_brightness, new_brightness; ++ unsigned max_brightness; + + max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness"); + if (!max_brightness_str) { +- log_warning("Failed to read max_brightness attribute; not checking saved brightness"); +- return; ++ log_warning("Failed to read max_brightness attribute"); ++ return 0; + } + +- r = safe_atou(*value, &brightness); ++ r = safe_atou(max_brightness_str, &max_brightness); + if (r < 0) { +- log_warning("Failed to parse brightness \"%s\": %s", *value, strerror(-r)); +- return; ++ log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r)); ++ return 0; + } + +- r = safe_atou(max_brightness_str, &max_brightness); ++ return max_brightness; ++} ++ ++/* Some systems turn the backlight all the way off at the lowest levels. ++ * clamp_brightness clamps the saved brightness to at least 1 or 5% of ++ * max_brightness. This avoids preserving an unreadably dim screen, which ++ * would otherwise force the user to disable state restoration. */ ++static void clamp_brightness(struct udev_device *device, char **value, unsigned max_brightness) { ++ int r; ++ unsigned brightness, new_brightness; ++ ++ r = safe_atou(*value, &brightness); + if (r < 0) { +- log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r)); ++ log_warning("Failed to parse brightness \"%s\": %s", *value, strerror(-r)); + return; + } + +@@ -239,6 +246,7 @@ int main(int argc, char *argv[]) { + _cleanup_udev_device_unref_ struct udev_device *device = NULL; + _cleanup_free_ char *saved = NULL, *ss = NULL, *escaped_ss = NULL, *escaped_sysname = NULL, *escaped_path_id = NULL; + const char *sysname, *path_id; ++ unsigned max_brightness; + int r; + + if (argc != 3) { +@@ -294,6 +302,14 @@ int main(int argc, char *argv[]) { + return EXIT_FAILURE; + } + ++ /* If max_brightness is 0, then there is no actual backlight ++ * device. This happens on desktops with Asus mainboards ++ * that load the eeepc-wmi module. ++ */ ++ max_brightness = get_max_brightness(device); ++ if (max_brightness == 0) ++ return EXIT_SUCCESS; ++ + escaped_ss = cescape(ss); + if (!escaped_ss) { + log_oom(); +@@ -348,7 +364,7 @@ int main(int argc, char *argv[]) { + return EXIT_FAILURE; + } + +- clamp_brightness(device, &value); ++ clamp_brightness(device, &value, max_brightness); + + r = udev_device_set_sysattr_value(device, "brightness", value); + if (r < 0) { diff --git a/0465-backlight-unify-error-messages.patch b/0465-backlight-unify-error-messages.patch new file mode 100644 index 0000000..95f7da7 --- /dev/null +++ b/0465-backlight-unify-error-messages.patch @@ -0,0 +1,119 @@ +From f3c7076a734fd916e61aac30f142a61b6d9a0a4a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 7 Apr 2014 20:57:22 -0400 +Subject: [PATCH] backlight: unify error messages + +(cherry picked from commit 938d2699d2e818bd996614e89ea3d668200ad2a8) +(cherry picked from commit 45f427fe36a752104ba1cdad7f9b2ec7178f905a) +--- + src/backlight/backlight.c | 29 +++++++++++++++++++---------- + 1 file changed, 19 insertions(+), 10 deletions(-) + +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index 84bf51d..34c01d9 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -24,6 +24,7 @@ + #include "fileio.h" + #include "libudev.h" + #include "udev-util.h" ++#include "def.h" + + static struct udev_device *find_pci_or_platform_parent(struct udev_device *device) { + struct udev_device *parent; +@@ -50,7 +51,7 @@ static struct udev_device *find_pci_or_platform_parent(struct udev_device *devic + if (!c) + return NULL; + +- c += strspn(c, "0123456789"); ++ c += strspn(c, DIGITS); + if (*c == '-') { + /* A connector DRM device, let's ignore all but LVDS and eDP! */ + +@@ -67,7 +68,8 @@ static struct udev_device *find_pci_or_platform_parent(struct udev_device *devic + unsigned long class; + + if (safe_atolu(value, &class) < 0) { +- log_warning("Cannot parse PCI class %s of device %s:%s.", value, subsystem, sysname); ++ log_warning("Cannot parse PCI class %s of device %s:%s.", ++ value, subsystem, sysname); + return NULL; + } + +@@ -175,7 +177,9 @@ static bool validate_device(struct udev *udev, struct udev_device *device) { + if (same_device(parent, other_parent)) { + /* Both have the same PCI parent, that means + * we are out. */ +- log_debug("Skipping backlight device %s, since backlight device %s is on same PCI device and, takes precedence.", udev_device_get_sysname(device), udev_device_get_sysname(other)); ++ log_debug("Skipping backlight device %s, since device %s is on same PCI device and takes precedence.", ++ udev_device_get_sysname(device), ++ udev_device_get_sysname(other)); + return false; + } + +@@ -184,7 +188,9 @@ static bool validate_device(struct udev *udev, struct udev_device *device) { + /* The other is connected to the platform bus + * and we are a PCI device, that also means we + * are out. */ +- log_debug("Skipping backlight device %s, since backlight device %s is a platform device and takes precedence.", udev_device_get_sysname(device), udev_device_get_sysname(other)); ++ log_debug("Skipping backlight device %s, since device %s is a platform device and takes precedence.", ++ udev_device_get_sysname(device), ++ udev_device_get_sysname(other)); + return false; + } + } +@@ -199,13 +205,14 @@ static unsigned get_max_brightness(struct udev_device *device) { + + max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness"); + if (!max_brightness_str) { +- log_warning("Failed to read max_brightness attribute"); ++ log_warning("Failed to read 'max_brightness' attribute"); + return 0; + } + + r = safe_atou(max_brightness_str, &max_brightness); + if (r < 0) { +- log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r)); ++ log_warning("Failed to parse 'max_brightness' \"%s\": %s", ++ max_brightness_str, strerror(-r)); + return 0; + } + +@@ -262,7 +269,8 @@ int main(int argc, char *argv[]) { + + r = mkdir_p("/var/lib/systemd/backlight", 0755); + if (r < 0) { +- log_error("Failed to create backlight directory: %s", strerror(-r)); ++ log_error("Failed to create backlight directory /var/lib/systemd/backlight: %s", ++ strerror(-r)); + return EXIT_FAILURE; + } + +@@ -274,7 +282,7 @@ int main(int argc, char *argv[]) { + + sysname = strchr(argv[2], ':'); + if (!sysname) { +- log_error("Requires pair of subsystem and sysname for specifying backlight device."); ++ log_error("Requires a subsystem and sysname pair specifying a backlight device."); + return EXIT_FAILURE; + } + +@@ -368,7 +376,8 @@ int main(int argc, char *argv[]) { + + r = udev_device_set_sysattr_value(device, "brightness", value); + if (r < 0) { +- log_error("Failed to write system attribute: %s", strerror(-r)); ++ log_error("Failed to write system 'brightness' attribute: %s", ++ strerror(-r)); + return EXIT_FAILURE; + } + +@@ -382,7 +391,7 @@ int main(int argc, char *argv[]) { + + value = udev_device_get_sysattr_value(device, "brightness"); + if (!value) { +- log_error("Failed to read system attribute"); ++ log_error("Failed to read system 'brightness' attribute"); + return EXIT_FAILURE; + } + diff --git a/0466-backlight-handle-saved-brightness-exceeding-max-brig.patch b/0466-backlight-handle-saved-brightness-exceeding-max-brig.patch new file mode 100644 index 0000000..5596acb --- /dev/null +++ b/0466-backlight-handle-saved-brightness-exceeding-max-brig.patch @@ -0,0 +1,63 @@ +From 40077b3f942021d90348162d55c607ca10d86c27 Mon Sep 17 00:00:00 2001 +From: Jani Nikula +Date: Wed, 7 May 2014 12:01:01 +0300 +Subject: [PATCH] backlight: handle saved brightness exceeding max brightness + +If too high a brightness value has been saved (e.g. due to kernel +mechanism changing from one kernel version to another, or booting the +userspace on another system), the brightness update fails and the +process exits. + +Clamp saved brightness between the policy minimum introduced in + +commit 7b909d7407965c03caaba30daae7aee113627a83 +Author: Josh Triplett +Date: Tue Mar 11 21:16:33 2014 -0700 + + backlight: Avoid restoring brightness to an unreadably dim level + +and the absolute maximum. + +https://bugs.freedesktop.org/show_bug.cgi?id=78200 +(cherry picked from commit 0c9d8f1d4b5018199cb5a9b57580dc1480a7f915) +(cherry picked from commit d4666a88938d3d671f7796ce650fa29ad47579cf) +--- + src/backlight/backlight.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index 34c01d9..77ae48c 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -225,7 +225,7 @@ static unsigned get_max_brightness(struct udev_device *device) { + * would otherwise force the user to disable state restoration. */ + static void clamp_brightness(struct udev_device *device, char **value, unsigned max_brightness) { + int r; +- unsigned brightness, new_brightness; ++ unsigned brightness, new_brightness, min_brightness; + + r = safe_atou(*value, &brightness); + if (r < 0) { +@@ -233,7 +233,8 @@ static void clamp_brightness(struct udev_device *device, char **value, unsigned + return; + } + +- new_brightness = MAX3(brightness, 1U, max_brightness/20); ++ min_brightness = MAX(1U, max_brightness/20); ++ new_brightness = CLAMP(brightness, min_brightness, max_brightness); + if (new_brightness != brightness) { + char *old_value = *value; + +@@ -243,7 +244,11 @@ static void clamp_brightness(struct udev_device *device, char **value, unsigned + return; + } + +- log_debug("Saved brightness %s too low; increasing to %s.", old_value, *value); ++ log_info("Saved brightness %s %s to %s.", old_value, ++ new_brightness > brightness ? ++ "too low; increasing" : "too high; decreasing", ++ *value); ++ + free(old_value); + } + } diff --git a/0467-backlight-Do-not-clamp-brightness-for-LEDs.patch b/0467-backlight-Do-not-clamp-brightness-for-LEDs.patch new file mode 100644 index 0000000..c68f5fa --- /dev/null +++ b/0467-backlight-Do-not-clamp-brightness-for-LEDs.patch @@ -0,0 +1,60 @@ +From 67002cbc9aba1b05576f3390410a84775dd060f2 Mon Sep 17 00:00:00 2001 +From: Denis Tikhomirov +Date: Thu, 5 Jun 2014 23:59:40 +0400 +Subject: [PATCH] backlight: Do not clamp brightness for LEDs + +https://bugs.freedesktop.org/show_bug.cgi?id=77092 + +On Thu, Jun 05, 2014 at 08:37:20AM +0200, Lennart Poettering wrote: +> The patch is line-broken, please send an uncorrupted patch! +I am very sorry, I forgot that my client limits line width. I will use +mutt now on. +> clamp_brightness() clamps the brightness value to the range of the +> actual device. This is a recent addition that was added to deal with +> driver updates where the resolution is changed. I don't think this part +> should be dropped for LED devices. The clamp_brightness() call hence +> should be called unconditionally, however, internally it should use a +> different min_brightness value if something is an !backlight devices... +Thank you for explanation, this sounds very reasonable to me. Please, +see updated patch: + +(cherry picked from commit 4cd2b2cf8ca585d15ebc859701b346658262b5bb) +(cherry picked from commit 385d2ab37b1a00b513edf5c3888b91d91ad3aae3) +--- + src/backlight/backlight.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index 77ae48c..e944f57 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -221,11 +221,13 @@ static unsigned get_max_brightness(struct udev_device *device) { + + /* Some systems turn the backlight all the way off at the lowest levels. + * clamp_brightness clamps the saved brightness to at least 1 or 5% of +- * max_brightness. This avoids preserving an unreadably dim screen, which +- * would otherwise force the user to disable state restoration. */ ++ * max_brightness in case of 'backlight' subsystem. This avoids preserving ++ * an unreadably dim screen, which would otherwise force the user to ++ * disable state restoration. */ + static void clamp_brightness(struct udev_device *device, char **value, unsigned max_brightness) { + int r; + unsigned brightness, new_brightness, min_brightness; ++ const char *subsystem; + + r = safe_atou(*value, &brightness); + if (r < 0) { +@@ -233,7 +235,12 @@ static void clamp_brightness(struct udev_device *device, char **value, unsigned + return; + } + +- min_brightness = MAX(1U, max_brightness/20); ++ subsystem = udev_device_get_subsystem(device); ++ if (streq_ptr(subsystem, "backlight")) ++ min_brightness = MAX(1U, max_brightness/20); ++ else ++ min_brightness = 0; ++ + new_brightness = CLAMP(brightness, min_brightness, max_brightness); + if (new_brightness != brightness) { + char *old_value = *value; diff --git a/systemd.spec b/systemd.spec index a4a6ee7..6efaf7c 100644 --- a/systemd.spec +++ b/systemd.spec @@ -499,6 +499,13 @@ Patch457: 0457-install-when-looking-for-a-unit-file-for-enabling-se.patch Patch458: 0458-install-make-sure-systemctl-disable-foobar-.service-.patch Patch459: 0459-install-make-sure-that-root-mode-doesn-t-make-us-con.patch Patch460: 0460-install-simplify-symlink-root-logic.patch +Patch461: 0461-backlight-include-ID_PATH-in-file-names-for-backligh.patch +Patch462: 0462-backlight-Fix-copy-paste-error-printing-an-unrelated.patch +Patch463: 0463-backlight-Avoid-restoring-brightness-to-an-unreadabl.patch +Patch464: 0464-backlight-do-nothing-if-max_brightness-is-0.patch +Patch465: 0465-backlight-unify-error-messages.patch +Patch466: 0466-backlight-handle-saved-brightness-exceeding-max-brig.patch +Patch467: 0467-backlight-Do-not-clamp-brightness-for-LEDs.patch # kernel-install patch for grubby, drop if grubby is obsolete @@ -1163,6 +1170,8 @@ getent passwd systemd-journal-gateway >/dev/null 2>&1 || useradd -r -l -u 191 -g - Allow local users to hibernate - Fix selinux policy reload on switch-root - Restore backlight also for "raw" devices (#1108019) +- Make backlight paths stable (backlight settings will probably by lost on + update), and sanitize restored values (#1062638) * Wed Jun 11 2014 Michal Sekletar - 208-17 - Log debug message when Abandon() fails (#1105857)