summaryrefslogtreecommitdiff
path: root/src/backlight
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-11 09:45:32 +0200
committerTom Gundersen <teg@jklm.no>2013-10-11 12:52:36 +0200
commit1a0464230c08506c3fd715ff7cc56660df3a85ca (patch)
treea3631f9b4ad6aa96cc7e9f743e82747ca708667e /src/backlight
parentf6f2ad9b9c2a2659256a2bce83016ecff0ca9451 (diff)
Add support for saving/restoring keyboard backlights
Piggy-backing on the display backlight code, this saves and restores keyboard backlights on supported devices. The detection code matches that of UPower: http://cgit.freedesktop.org/upower/tree/src/up-kbd-backlight.c#n173 https://bugs.freedesktop.org/show_bug.cgi?id=70367 [tomegun: also work for devices named "{smc,samsung,asus}::kbd_backlight"]
Diffstat (limited to 'src/backlight')
-rw-r--r--src/backlight/backlight.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index 9b2eada397..f22deed4e0 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -56,9 +56,11 @@ int main(int argc, char *argv[]) {
errno = 0;
device = udev_device_new_from_subsystem_sysname(udev, "backlight", argv[2]);
+ if (!device)
+ device = udev_device_new_from_subsystem_sysname(udev, "leds", argv[2]);
if (!device) {
if (errno != 0) {
- log_error("Failed to get backlight device: %m");
+ log_error("Failed to get backlight device '%s': %m", argv[2]);
r = -errno;
} else
r = log_oom();
@@ -66,7 +68,8 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (!streq_ptr(udev_device_get_subsystem(device), "backlight")) {
+ if (!streq_ptr(udev_device_get_subsystem(device), "backlight") &&
+ !streq_ptr(udev_device_get_subsystem(device), "leds")) {
log_error("Not a backlight device: %s", argv[2]);
r = -ENODEV;
goto finish;