From e83afd26219bf62412f134140d002a94a6150508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 11 Nov 2024 21:17:44 +0100 Subject: [PATCH 1/2] Switch VT before starting weston ... and restore original VT before exiting. libseat >= 0.9.0 doesn't do that anymore, and it's necessary to get access to devices. More details at https://lists.sr.ht/~kennylevinsen/seatd-devel/%3CZy_-FRQnBTeNPXVj@mail-itl%3E https://github.com/QubesOS/qubes-issues/issues/9568 --- initial-setup.spec | 1 + scripts/run-gui-backend.guiweston | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/initial-setup.spec b/initial-setup.spec index 5281872..318d0f0 100644 --- a/initial-setup.spec +++ b/initial-setup.spec @@ -97,6 +97,7 @@ Summary: Run the initial-setup GUI in Wayland Requires: %{name}-gui = %{version}-%{release} Requires: weston Requires: xorg-x11-server-Xwayland +Requires: kbd Provides: firstboot(gui-backend) Conflicts: firstboot(gui-backend) diff --git a/scripts/run-gui-backend.guiweston b/scripts/run-gui-backend.guiweston index 76c91c3..fe4960a 100755 --- a/scripts/run-gui-backend.guiweston +++ b/scripts/run-gui-backend.guiweston @@ -24,8 +24,18 @@ EOF chmod +x ${RUN_SCRIPT} +original_vt= +if [ -n "$XDG_VTNR" ]; then + original_vt=$(fgconsole) + # change to VT on which we run to get access to devices + chvt "${XDG_VTNR}" +fi + weston --config=${CONFIG_FILE} --socket=wl-firstboot-0 exit_code=$(< ${EXIT_CODE_SAVE}) rm ${CONFIG_FILE} ${RUN_SCRIPT} ${EXIT_CODE_SAVE} +if [ -n "$original_vt" ]; then + chvt "$original_vt" +fi exit $exit_code From 47ccca24e25c740c8ca715f70b1fdea35598833b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 20 Nov 2024 20:28:07 +0100 Subject: [PATCH 2/2] Try to use outputs on all cards Normally weston uses card0 only. In dual-GPU setup, it may not be the one with monitor connected, and when it doesn't find any connector monitor, it fails to startup. Look also at outputs connected to other cards too. There doesn't seems to be any option to check all connected devices, so enumerate them via sysfs manually. --- scripts/run-gui-backend.guiweston | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/run-gui-backend.guiweston b/scripts/run-gui-backend.guiweston index fe4960a..aca589a 100755 --- a/scripts/run-gui-backend.guiweston +++ b/scripts/run-gui-backend.guiweston @@ -31,7 +31,13 @@ if [ -n "$XDG_VTNR" ]; then chvt "${XDG_VTNR}" fi -weston --config=${CONFIG_FILE} --socket=wl-firstboot-0 +cards=$(ls -d /sys/class/drm/card*| grep -v -- -| cut -d / -f 5) +primary_card=$(echo "$cards" | head -1 ) +secondary_cards=$(echo "$cards"| + tail -n +2| + xargs printf "%s,") + +weston --config=${CONFIG_FILE} --socket=wl-firstboot-0 --drm-device="$primary_card" --additional-devices="$secondary_cards" exit_code=$(< ${EXIT_CODE_SAVE}) rm ${CONFIG_FILE} ${RUN_SCRIPT} ${EXIT_CODE_SAVE}