forked from pool/systemd
82 lines
3.8 KiB
Diff
82 lines
3.8 KiB
Diff
Patch based on
|
|
|
|
From e0d856dd48d640f3d95efe7b769edec02373cc74 Mon Sep 17 00:00:00 2001
|
|
From: Lennart Poettering <lennart@poettering.net>
|
|
Date: Wed, 16 Oct 2013 02:51:24 +0200
|
|
Subject: [PATCH] rules: don't limit some of the rules to the "add" action
|
|
|
|
Devices should show up in systemd regardless whether the user invoked
|
|
"udevadm trigger" or not. Before this change some devices might have
|
|
suddenly disappeared due issuing that command.
|
|
|
|
and also on
|
|
|
|
From 1a0464230c08506c3fd715ff7cc56660df3a85ca Mon Sep 17 00:00:00 2001
|
|
From: Bastien Nocera <hadess@hadess.net>
|
|
Date: Fri, 11 Oct 2013 07:45:32 +0000
|
|
Subject: 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"]
|
|
|
|
---
|
|
rules/99-systemd.rules.in | 10 ++++++----
|
|
src/backlight/backlight.c | 7 +++++--
|
|
2 files changed, 11 insertions(+), 6 deletions(-)
|
|
|
|
--- rules/99-systemd.rules.in
|
|
+++ rules/99-systemd.rules.in 2014-02-14 14:46:48.358235397 +0000
|
|
@@ -51,14 +51,16 @@ SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_dev
|
|
|
|
ACTION=="add", SUBSYSTEM=="net", KERNEL!="lo", RUN+="@rootlibexecdir@/systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/$name --prefix=/proc/sys/net/ipv4/neigh/$name --prefix=/proc/sys/net/ipv6/conf/$name --prefix=/proc/sys/net/ipv6/neigh/$name"
|
|
|
|
-# Pull in backlight save/restore for all firmware backlight devices
|
|
+# Pull in backlight save/restore for all backlight devices and
|
|
+# keyboard backlights
|
|
|
|
-ACTION=="add", SUBSYSTEM=="backlight", ATTR{type}=="firmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service"
|
|
+SUBSYSTEM=="backlight", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-backlight@backlight:$name.service"
|
|
+SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-backlight@leds:$name.service"
|
|
|
|
# Asynchronously mount file systems implemented by these modules as
|
|
# soon as they are loaded.
|
|
|
|
-SUBSYSTEM=="module", KERNEL=="fuse", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-fs-fuse-connections.mount"
|
|
-SUBSYSTEM=="module", KERNEL=="configfs", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-kernel-config.mount"
|
|
+SUBSYSTEM=="module", KERNEL=="fuse", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-fs-fuse-connections.mount"
|
|
+SUBSYSTEM=="module", KERNEL=="configfs", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-kernel-config.mount"
|
|
|
|
LABEL="systemd_end"
|
|
--- src/backlight/backlight.c
|
|
+++ src/backlight/backlight.c 2014-02-14 15:20:47.534298128 +0000
|
|
@@ -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;
|