mirror of
https://github.com/systemd/systemd
synced 2024-07-23 19:25:39 +00:00
logind: include subsystem name in device id for assigning seats
This commit is contained in:
parent
47a2669062
commit
c28fa3d32f
|
@ -16,5 +16,6 @@ SUBSYSTEM=="usb", ATTR{bDeviceClass}=="09", TAG+="seat"
|
||||||
SUBSYSTEM=="usb", ATTR{idVendor}=="2230", ATTR{idProduct}=="0001", ENV{ID_AUTOSEAT}="1"
|
SUBSYSTEM=="usb", ATTR{idVendor}=="2230", ATTR{idProduct}=="0001", ENV{ID_AUTOSEAT}="1"
|
||||||
|
|
||||||
TAG=="seat", ENV{ID_PATH}=="", IMPORT{program}="path_id %p"
|
TAG=="seat", ENV{ID_PATH}=="", IMPORT{program}="path_id %p"
|
||||||
|
TAG=="seat", ENV{ID_FOR_SEAT}=="", ENV{ID_PATH}!="", ENV{ID_FOR_SEAT}="$env{SUBSYSTEM}-$env{ID_PATH}"
|
||||||
|
|
||||||
LABEL="seat_end"
|
LABEL="seat_end"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
ACTION=="remove", GOTO="seat_late_end"
|
ACTION=="remove", GOTO="seat_late_end"
|
||||||
TAG!="seat", GOTO="seat_late_end"
|
TAG!="seat", GOTO="seat_late_end"
|
||||||
|
|
||||||
ENV{ID_SEAT}=="", ENV{ID_AUTOSEAT}=="1", ENV{ID_PATH}!="", ENV{ID_SEAT}="seat-$env{ID_PATH}"
|
ENV{ID_SEAT}=="", ENV{ID_AUTOSEAT}=="1", ENV{ID_FOR_SEAT}!="", ENV{ID_SEAT}="seat-$env{ID_FOR_SEAT}"
|
||||||
ENV{ID_SEAT}=="", IMPORT{parent}="ID_SEAT"
|
ENV{ID_SEAT}=="", IMPORT{parent}="ID_SEAT"
|
||||||
|
|
||||||
ENV{ID_SEAT}!="", TAG+="$env{ID_SEAT}"
|
ENV{ID_SEAT}!="", TAG+="$env{ID_SEAT}"
|
||||||
|
|
|
@ -553,7 +553,7 @@ static bool device_has_tag(struct udev_device *d, const char *tag) {
|
||||||
static int attach_device(Manager *m, const char *seat, const char *sysfs) {
|
static int attach_device(Manager *m, const char *seat, const char *sysfs) {
|
||||||
struct udev_device *d;
|
struct udev_device *d;
|
||||||
char *rule = NULL, *file = NULL;
|
char *rule = NULL, *file = NULL;
|
||||||
const char *path;
|
const char *id_for_seat;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
@ -569,22 +569,23 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = udev_device_get_property_value(d, "ID_PATH");
|
id_for_seat = udev_device_get_property_value(d, "ID_FOR_SEAT");
|
||||||
if (!path) {
|
if (!id_for_seat) {
|
||||||
r = -ENODEV;
|
r = -ENODEV;
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asprintf(&file, "/etc/udev/rules.d/72-seat-%s.rules", path) < 0) {
|
if (asprintf(&file, "/etc/udev/rules.d/72-seat-%s.rules", id_for_seat) < 0) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asprintf(&rule, "TAG==\"seat\", ID_PATH==\"%s\", ID_SEAT=\"%s\"", path, seat) < 0) {
|
if (asprintf(&rule, "TAG==\"seat\", ENV{ID_FOR_SEAT}==\"%s\", ENV{ID_SEAT}=\"%s\"", id_for_seat, seat) < 0) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mkdir_p("/etc/udev/rules.d", 0755);
|
||||||
r = write_one_line_file(file, rule);
|
r = write_one_line_file(file, rule);
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
|
|
Loading…
Reference in a new issue