summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan@agner.ch>2019-11-14 23:29:09 +0100
committerPekka Paalanen <pq@iki.fi>2020-01-30 12:11:37 +0000
commitc6f818a01611d65fd5d383bf2a6b1ee3f7389567 (patch)
treed7af64e4829cbc8e495d4fec7d8b6eb24ac9860c
parentcb24a7d1ebe5cbfdb6ec209ae2d23e376a66d1ef (diff)
weston-launch: make sure weston-launch activates the VT
Currently weston-launch does not activate the VT when opening the terminal directly (e.g. using --tty=/dev/tty7). Weston takes full control over the terminal by switching it to graphical mode etc. However, the old VT stays active as can be seen when looking at sysfs: # cat /sys/class/tty/tty0/active tty1 Always switch to the new VT to make sure the correct VT is active. This aligns with how TTY setup is implemented in launcher-direct.c. Signed-off-by: Stefan Agner <stefan@agner.ch> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
-rw-r--r--libweston/weston-launch.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c
index d5eae960..bfe70a7b 100644
--- a/libweston/weston-launch.c
+++ b/libweston/weston-launch.c
@@ -605,6 +605,20 @@ setup_tty(struct weston_launch *wl, const char *tty)
wl->ttynr = minor(buf.st_rdev);
}
+ if (ioctl(wl->tty, VT_ACTIVATE, wl->ttynr) < 0) {
+ fprintf(stderr,
+ "weston: failed to activate VT: %s\n",
+ strerror(errno));
+ return -1;
+ }
+
+ if (ioctl(wl->tty, VT_WAITACTIVE, wl->ttynr) < 0) {
+ fprintf(stderr,
+ "weston: failed to wait for VT to be active: %s\n",
+ strerror(errno));
+ return -1;
+ }
+
if (ioctl(wl->tty, KDGKBMODE, &wl->kb_mode)) {
fprintf(stderr,
"weston: failed to get current keyboard mode: %s\n",