summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules/99-systemd.rules.in2
-rw-r--r--src/backlight/backlight.c10
-rw-r--r--units/systemd-backlight@.service.in6
3 files changed, 12 insertions, 6 deletions
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index ac4bc86c81..bbb7d0c2c3 100644
--- a/rules/99-systemd.rules.in
+++ b/rules/99-systemd.rules.in
@@ -53,7 +53,7 @@ ACTION=="add", SUBSYSTEM=="net", KERNEL!="lo", RUN+="@rootlibexecdir@/systemd-sy
# Pull in backlight save/restore for all firmware backlight devices
-ACTION=="add", SUBSYSTEM=="backlight", ATTR{type}=="firmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@sys%p.service"
+ACTION=="add", SUBSYSTEM=="backlight", ATTR{type}=="firmware", TAG+="systemd", 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 3378907f91..1ef0b45cc6 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -54,9 +54,15 @@ int main(int argc, char *argv[]) {
goto finish;
}
- device = udev_device_new_from_syspath(udev, argv[2]);
+ errno = 0;
+ device = udev_device_new_from_subsystem_sysname(udev, "backlight", argv[2]);
if (!device) {
- r = log_oom();
+ if (errno != 0) {
+ log_error("Failed to get backlight device: %m");
+ r = -errno;
+ } else
+ r = log_oom();
+
goto finish;
}
diff --git a/units/systemd-backlight@.service.in b/units/systemd-backlight@.service.in
index 14b12198e8..b0e75db39e 100644
--- a/units/systemd-backlight@.service.in
+++ b/units/systemd-backlight@.service.in
@@ -6,7 +6,7 @@
# (at your option) any later version.
[Unit]
-Description=Load/Save Screen Backlight Brightness of %f
+Description=Load/Save Screen Backlight Brightness of %I
Documentation=man:systemd-backlight@.service(8)
DefaultDependencies=no
RequiresMountsFor=/var/lib/backlight
@@ -17,5 +17,5 @@ Before=sysinit.target shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=@rootlibexecdir@/systemd-backlight load %f
-ExecStop=@rootlibexecdir@/systemd-backlight save %f
+ExecStart=@rootlibexecdir@/systemd-backlight load %I
+ExecStop=@rootlibexecdir@/systemd-backlight save %I