chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for saving/restoring keyboard backlights
[elogind.git]
/
src
/
backlight
/
backlight.c
diff --git
a/src/backlight/backlight.c
b/src/backlight/backlight.c
index 9b2eada3970cd99a5abec3b8533e0d1ca4fec94f..f22deed4e081970729859ec92cea4c6a4fe1c0e3 100644
(file)
--- 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]);
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) {
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();
r = -errno;
} else
r = log_oom();
@@
-66,7
+68,8
@@
int main(int argc, char *argv[]) {
goto finish;
}
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;
log_error("Not a backlight device: %s", argv[2]);
r = -ENODEV;
goto finish;