[PATCH v5 3/7] launcher-logind: only get a VT on seat0, as only seat0 supports VTs
Peter Hutterer
peter.hutterer at who-t.net
Mon Jan 22 00:19:36 UTC 2018
On Fri, Jan 19, 2018 at 04:24:59PM +0200, Pekka Paalanen wrote:
> On Fri, 29 Dec 2017 13:31:49 -0500
> nerdopolis <bluescreen_avenger at verizon.net> wrote:
>
> > As only seat0 supports TTYs, this changes the logind launcher where
> > it detects a TTY, only if the seat is seat0. This has only been
> > tested for logind
> > ---
> > libweston/launcher-logind.c | 22 ++++++++++++----------
> > libweston/launcher-util.c | 4 ++++
> > 2 files changed, 16 insertions(+), 10 deletions(-)
> >
> > diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
> > index 21d8c37b..875db70f 100644
> > --- a/libweston/launcher-logind.c
> > +++ b/libweston/launcher-logind.c
> > @@ -769,18 +769,20 @@ launcher_logind_connect(struct weston_launcher **out, struct weston_compositor *
> > free(t);
> > goto err_session;
> > }
> > - free(t);
> >
> > - r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
> > - if (r < 0) {
> > - weston_log("logind: session not running on a VT\n");
> > - goto err_session;
> > - } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
> > - weston_log("logind: requested VT --tty=%d differs from real session VT %u\n",
> > - tty, wl->vtnr);
> > - r = -EINVAL;
> > - goto err_session;
> > + if (!strcmp(t, "seat0")) {
> > + r = weston_sd_session_get_vt(wl->sid, &wl->vtnr);
> > + if (r < 0) {
> > + weston_log("logind: session not running on a VT\n");
> > + goto err_session;
> > + } else if (tty > 0 && wl->vtnr != (unsigned int )tty) {
> > + weston_log("logind: requested VT --tty=%d differs from real session VT %u\n",
> > + tty, wl->vtnr);
> > + r = -EINVAL;
> > + goto err_session;
> > + }
> > }
> > + free(t);
> >
> > loop = wl_display_get_event_loop(compositor->wl_display);
> > r = weston_dbus_open(loop, DBUS_BUS_SYSTEM, &wl->dbus, &wl->dbus_ctx);
> > diff --git a/libweston/launcher-util.c b/libweston/launcher-util.c
> > index 96a0ba6f..777ab755 100644
> > --- a/libweston/launcher-util.c
> > +++ b/libweston/launcher-util.c
> > @@ -111,6 +111,10 @@ WL_EXPORT void
> > weston_setup_vt_switch_bindings(struct weston_compositor *compositor)
> > {
> > uint32_t key;
> > + struct weston_launcher *launcher = compositor->launcher;
> > +
> > + if (launcher->iface->get_vt(launcher) == 0)
> > + return;
> >
> > if (compositor->vt_switching == false)
> > return;
>
> Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
>
> Although I'm not quite sure whether the VT-ful seat's name is
> configurable in logind or elsewhere, wondering whether "If your seat is
> not called seat0, you don't get VT switching." could surprise someone.
the string "seat0" is hardcoded all over systemd's sources, I'm assuming
it's not configurable without significant efforts :)
A quick skim also shows quite a few error messages to happen when the VT
seat is not seat0, so I think we're good.
The patch looks good, too, so
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Cheers,
Peter
More information about the wayland-devel
mailing list