weston-launch: reset tty properly

Graphics / Wayland / Weston - Stefan Agner [agner.ch] - 30 January 2020 12:11 UTC

On weston-launch exit we see errors such as: failed to restore keyboard mode: Invalid argument failed to set KD_TEXT mode on tty: Invalid argument

This has been resolved by making sure the tty file descriptor does not get closed. However, the ioctrl's KDSKBMODE/KDSETMODE and VT_SETMODE still fail with -EIO: failed to restore keyboard mode: Input/output error failed to set KD_TEXT mode on tty: Input/output error

It turns out the reason for this lies in some very particular behavior of the kernel, the separation of weston-launch/weston and the fact that we restore the tty only after the weston process quits: When the controlling process for a TTY exits, all open file descriptors for that TTY are put in a hung-up state! For more details see this systemd-logind issue: https://github.com/systemd/systemd/issues/989

We can work around by reopening the particular TTY. This allows to properly restore the TTY settings such that a successive VT switch will show text terminals fine again.

bd1e39a7 weston-launch: reset tty properly
libweston/weston-launch.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

Upstream: cgit.freedesktop.org

  • Share