libinput driver doesn't grab devices, keystrokes still go to the TTY
Adam Nielsen
a.nielsen at shikadi.net
Wed Jun 10 03:22:52 UTC 2020
> an EVIOCGRAB does more than just cutting off the tty, it cuts off everything
> including internal consumers of that (e.g. rfkill and sysrq). That breaks
> things and is the reason we removed the grab-by-default from the
> evdev/synaptics drivers about a decade ago and punted this responsibility to
> the X server.
Interesting, thanks for the explanation. I suppose in this case it
would still be ok, because it's only devices belonging to additional
seats that are grabbed - the main input devices, rfkill, etc. would be
left as-is on the primary seat.
> In your case where you want the TTY and an xserver on the side this won't
> work. tbh I'm not sure a driver-specific option is the solution here (it may
> be), probably worth spending some time investitagating what other solutions
> are there. But meanwhile, the libinput driver simply doesn't have that
> option so you'll have to keep using evdev+synaptics for now.
Having thought about this after reading your explanation, I think the
fix may sit somewhere in the Linux console/TTY implementation, as the
real problem seems to be that the console listens to all input devices
no matter what. You don't really need exclusive use of an input device,
you just want to disconnect it from the console regardless of active VT.
If you consider a second monitor and keyboard as an independent seat,
then it should always be independent whether X is running or not. At
the moment you may be using the second seat in X just fine, but as
soon as X terminates, suddenly your keystrokes are going into the other
seat's terminal (two keyboards typing into the same console), which
seems like the wrong behaviour to me.
If it's the responsibility of systemd/logind to configure seats so that
Xorg knows what devices to use, then I am thinking that it should
probably be somewhere in that process that an input device moved to
another seat should also be disconnected from the main console TTY as
well.
This way it wouldn't matter whether X had exclusive use of the device
or not, because the TTY on seat0 would ignore events coming from the
keyboard assigned to seat1, whether X was running or not.
Do you think that makes sense? Any idea whether you can already unbind
input devices from the console? I had a look around but can't find
much, although there seem to be a few different layers at this point
(tty, vtconsole, etc.) so I'm not sure at which point the input devices
get involved.
Cheers,
Adam.
More information about the xorg
mailing list