Adam Williamson ec1d7b
From 8af4c8abfb59ab66f1f5a34f0eac1342e6f0c7e5 Mon Sep 17 00:00:00 2001
Adam Williamson ec1d7b
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Adam Williamson ec1d7b
Date: Thu, 17 Oct 2019 12:37:12 +0200
Adam Williamson ec1d7b
Subject: [PATCH] udev: tag any display devices as master-of-seat when
Adam Williamson ec1d7b
 nomodeset is used
Adam Williamson ec1d7b
MIME-Version: 1.0
Adam Williamson ec1d7b
Content-Type: text/plain; charset=UTF-8
Adam Williamson ec1d7b
Content-Transfer-Encoding: 8bit
Adam Williamson ec1d7b
Adam Williamson ec1d7b
Fixes #13773. See also https://bugzilla.redhat.com/show_bug.cgi?id=1728240,
Adam Williamson ec1d7b
https://github.com/sddm/sddm/issues/1204.
Adam Williamson ec1d7b
Adam Williamson ec1d7b
When nomodeset is used on the kernel command line, there is no graphics
Adam Williamson ec1d7b
device that the kernel knows, so we don't tag anything as master-of-seat,
Adam Williamson ec1d7b
and seat0 has CanGraphical=no.
Adam Williamson ec1d7b
Adam Williamson ec1d7b
$ loginctl seat-status seat0 ; loginctl show-seat seat0
Adam Williamson ec1d7b
seat0
Adam Williamson ec1d7b
         Devices:
Adam Williamson ec1d7b
                  ├─/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
Adam Williamson ec1d7b
                  │ input:input0 "Power Button"
Adam Williamson ec1d7b
                  ├─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1
Adam Williamson ec1d7b
                  │ usb:usb1
Adam Williamson ec1d7b
                  │ └─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-1/1-1:1.0/0003:0627:0001.0001/input/input4
Adam Williamson ec1d7b
                  │   input:input4 "QEMU QEMU USB Tablet"
Adam Williamson ec1d7b
                  ├─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb2
Adam Williamson ec1d7b
                  │ usb:usb2
Adam Williamson ec1d7b
                  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card0
Adam Williamson ec1d7b
                  │ sound:card0 "Intel"
Adam Williamson ec1d7b
                  ├─/sys/devices/platform/i8042/serio0/input/input1
Adam Williamson ec1d7b
                  │ input:input1 "AT Translated Set 2 keyboard"
Adam Williamson ec1d7b
                  │ ├─/sys/devices/platform/i8042/serio0/input/input1/input1::capslock
Adam Williamson ec1d7b
                  │ │ leds:input1::capslock
Adam Williamson ec1d7b
                  │ ├─/sys/devices/platform/i8042/serio0/input/input1/input1::numlock
Adam Williamson ec1d7b
                  │ │ leds:input1::numlock
Adam Williamson ec1d7b
                  │ └─/sys/devices/platform/i8042/serio0/input/input1/input1::scrolllock
Adam Williamson ec1d7b
                  │   leds:input1::scrolllock
Adam Williamson ec1d7b
                  └─/sys/devices/platform/i8042/serio1/input/input3
Adam Williamson ec1d7b
                    input:input3 "ImExPS/2 Generic Explorer Mouse"
Adam Williamson ec1d7b
Id=seat0
Adam Williamson ec1d7b
CanMultiSession=yes
Adam Williamson ec1d7b
CanTTY=yes
Adam Williamson ec1d7b
CanGraphical=no
Adam Williamson ec1d7b
Sessions=
Adam Williamson ec1d7b
IdleHint=yes
Adam Williamson ec1d7b
IdleSinceHint=0
Adam Williamson ec1d7b
IdleSinceHintMonotonic=0
Adam Williamson ec1d7b
Adam Williamson ec1d7b
Let's tag the PCI device with "master-of-seat", so we get CanGraphical=yes, and "seat",
Adam Williamson ec1d7b
so it is show as part of the seat:
Adam Williamson ec1d7b
Adam Williamson ec1d7b
[fedora@f31-bios ~]$ loginctl seat-status seat0 ; loginctl show-seat seat0
Adam Williamson ec1d7b
seat0
Adam Williamson ec1d7b
         Devices:
Adam Williamson ec1d7b
                  ├─/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
Adam Williamson ec1d7b
                  │ input:input0 "Power Button"
Adam Williamson ec1d7b
                  ├─/sys/devices/pci0000:00/0000:00:01.0
Adam Williamson ec1d7b
                  │ [MASTER] pci:0000:00:01.0
Adam Williamson ec1d7b
                  ├─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1
Adam Williamson ec1d7b
                  │ usb:usb1
Adam Williamson ec1d7b
                  │ └─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-1/1-1:1.0/0003:0627:0001.0001/input/input4
Adam Williamson ec1d7b
                  │   input:input4 "QEMU QEMU USB Tablet"
Adam Williamson ec1d7b
                  ├─/sys/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb2
Adam Williamson ec1d7b
                  │ usb:usb2
Adam Williamson ec1d7b
                  ├─/sys/devices/pci0000:00/0000:00:1b.0/sound/card0
Adam Williamson ec1d7b
                  │ sound:card0 "Intel"
Adam Williamson ec1d7b
                  ├─/sys/devices/platform/i8042/serio0/input/input1
Adam Williamson ec1d7b
                  │ input:input1 "AT Translated Set 2 keyboard"
Adam Williamson ec1d7b
                  │ ├─/sys/devices/platform/i8042/serio0/input/input1/input1::capslock
Adam Williamson ec1d7b
                  │ │ leds:input1::capslock
Adam Williamson ec1d7b
                  │ ├─/sys/devices/platform/i8042/serio0/input/input1/input1::numlock
Adam Williamson ec1d7b
                  │ │ leds:input1::numlock
Adam Williamson ec1d7b
                  │ └─/sys/devices/platform/i8042/serio0/input/input1/input1::scrolllock
Adam Williamson ec1d7b
                  │   leds:input1::scrolllock
Adam Williamson ec1d7b
                  └─/sys/devices/platform/i8042/serio1/input/input3
Adam Williamson ec1d7b
                    input:input3 "ImExPS/2 Generic Explorer Mouse"
Adam Williamson ec1d7b
Id=seat0
Adam Williamson ec1d7b
CanMultiSession=yes
Adam Williamson ec1d7b
CanTTY=yes
Adam Williamson ec1d7b
CanGraphical=yes
Adam Williamson ec1d7b
Sessions=
Adam Williamson ec1d7b
IdleHint=yes
Adam Williamson ec1d7b
IdleSinceHint=0
Adam Williamson ec1d7b
IdleSinceHintMonotonic=0
Adam Williamson ec1d7b
---
Adam Williamson ec1d7b
 src/login/71-seat.rules.in | 5 +++++
Adam Williamson ec1d7b
 1 file changed, 5 insertions(+)
Adam Williamson ec1d7b
Adam Williamson ec1d7b
diff --git a/src/login/71-seat.rules.in b/src/login/71-seat.rules.in
Adam Williamson ec1d7b
index 6010f048aef..2bbd18363e6 100644
Adam Williamson ec1d7b
--- a/src/login/71-seat.rules.in
Adam Williamson ec1d7b
+++ b/src/login/71-seat.rules.in
Adam Williamson ec1d7b
@@ -24,6 +24,11 @@ SUBSYSTEM=="graphics", KERNEL=="fb[0-9]", DRIVERS=="hyperv_fb", TAG+="master-of-
Adam Williamson ec1d7b
 # Allow efifb / uvesafb to be a master if KMS is disabled
Adam Williamson ec1d7b
 SUBSYSTEM=="graphics", KERNEL=="fb[0-9]", IMPORT{cmdline}="nomodeset", TAG+="master-of-seat"
Adam Williamson ec1d7b
 
Adam Williamson ec1d7b
+# Allow any PCI graphics device to be a master and synthesize a seat if KMS
Adam Williamson ec1d7b
+# is disabled and the kernel doesn't have a driver that would work with this device.
Adam Williamson ec1d7b
+SUBSYSTEM=="pci", ENV{ID_PCI_CLASS_FROM_DATABASE}=="Display controller", \
Adam Williamson ec1d7b
+                  ENV{DRIVER}=="", IMPORT{cmdline}="nomodeset", TAG+="seat", TAG+="master-of-seat"
Adam Williamson ec1d7b
+
Adam Williamson ec1d7b
 SUBSYSTEM=="drm", KERNEL=="card[0-9]*", TAG+="seat", TAG+="master-of-seat"
Adam Williamson ec1d7b
 SUBSYSTEM=="usb", ATTR{bDeviceClass}=="09", TAG+="seat"
Adam Williamson ec1d7b