1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-02 04:22:27 +03:00

backlight: instead of syspath use sysname for identifying backlight devices

This makes the description string of the backlight service a bit nicer.
This commit is contained in:
Lennart Poettering
2013-08-14 02:55:57 +02:00
parent 3731acf1ac
commit 875c6e1b48
3 changed files with 12 additions and 6 deletions

View File

@ -53,7 +53,7 @@ ACTION=="add", SUBSYSTEM=="net", KERNEL!="lo", RUN+="@rootlibexecdir@/systemd-sy
# Pull in backlight save/restore for all firmware backlight devices # 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 # Asynchronously mount file systems implemented by these modules as
# soon as they are loaded. # soon as they are loaded.

View File

@ -54,9 +54,15 @@ int main(int argc, char *argv[]) {
goto finish; 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) { if (!device) {
r = log_oom(); if (errno != 0) {
log_error("Failed to get backlight device: %m");
r = -errno;
} else
r = log_oom();
goto finish; goto finish;
} }

View File

@ -6,7 +6,7 @@
# (at your option) any later version. # (at your option) any later version.
[Unit] [Unit]
Description=Load/Save Screen Backlight Brightness of %f Description=Load/Save Screen Backlight Brightness of %I
Documentation=man:systemd-backlight@.service(8) Documentation=man:systemd-backlight@.service(8)
DefaultDependencies=no DefaultDependencies=no
RequiresMountsFor=/var/lib/backlight RequiresMountsFor=/var/lib/backlight
@ -17,5 +17,5 @@ Before=sysinit.target shutdown.target
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-backlight load %f ExecStart=@rootlibexecdir@/systemd-backlight load %I
ExecStop=@rootlibexecdir@/systemd-backlight save %f ExecStop=@rootlibexecdir@/systemd-backlight save %I