libinput driver doesn't grab devices, keystrokes still go to the TTY

Adam Nielsen a.nielsen at shikadi.net
Mon Jun 8 08:29:56 UTC 2020


Hi all,

I'm trying to set up a multiseat environment, with Xorg on a new seat
and the normal Linux console (TTY) on the default seat0.

Using loginctl, I've assigned an add-in video card and keyboard to the
Xorg seat, leaving the onboard video card and a different keyboard to
default as seat0.  It almost works except any keys I type on the Xorg
keyboard get sent to both Xorg and the TTY, whereas they should only go
to X.

Some things I read[1] said I need this:

  Section "InputClass"
    Identifier "prevent input events from going to the console"
    Option "GrabDevice" "True"
  EndSection

While a patch[2] from 2013 suggests that GrabDevice is set automatically
for seats that are not named "seat0", so it should apply to my keyboard
belonging to "seat-nvidia".

Either way I tried putting that section into my xorg config and
confirmed it was applied: (with and without -sharevts and -novtswitch,
which the patch suggests is now automatic anyway)

# /usr/bin/X -sharevts :0 -seat seat-nvidia -novtswitch
...
(II) config/udev: Adding input device HID 04d9:1400 (/dev/input/event1)
(**) HID 04d9:1400: Applying InputClass "libinput keyboard catchall"
(**) HID 04d9:1400: Applying InputClass "prevent input events from going to the console"
(II) Using input driver 'libinput' for 'HID 04d9:1400'
(**) HID 04d9:1400: always reports core events
(**) Option "Device" "/dev/input/event1"
(**) Option "_source" "server/udev"
(II) event1  - HID 04d9:1400: is tagged by udev as: Keyboard
(II) event1  - HID 04d9:1400: device is a keyboard
(II) event1  - HID 04d9:1400: device removed
(**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:...
(II) XINPUT: Adding extended input device "HID 04d9:1400" (type: KEYBOARD, id 6)
(II) event1  - HID 04d9:1400: is tagged by udev as: Keyboard
(II) event1  - HID 04d9:1400: device is a keyboard

However still I get keystrokes going to both Xorg and the TTY.

I saw that I can use evtest to make sure grabbing is working, so I ran
this via SSH:

  evtest --grab /dev/input/event1

And sure enough that stopped my keystrokes from going to either Xorg or
the TTY, with them only being seen by evtest.

So it looks like Xorg is no longer grabbing input devices properly?  Is
there anything further I can do to check this?

I'm running X Server 1.20.8 and xf86-input-libinput 0.30.0 under Arch
Linux.

Many thanks,
Adam.

[1] https://wiki.ubuntu.com/Multiseat
[2] https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1228095


More information about the xorg mailing list