Linux – prevent keyboard input from being used by console

consolekeyboardlinuxusb

I have a linux box with two keyboards, two displays, and one mouse. One of the displays is running an X session, and the other is running a text console, started by mingetty. Currently, the mouse is used by X, one of the keyboards is used only by the text console, but the other keyboard sends input to both the X session and the text console.

Is there any way to have the second keyboard send input to only the X session?

Best Answer

Simplest way is probably to write an xorg.conf and configure the "other keyboard" with option GrabDevice as true. This will make sure the kernel input layer only outputs events from this device to X, which means the console won't see them.

You can test the effect of the grab with evtest --grab /dev/input/... (which will make evtest grab it, of course).

See man evdev for details, see Inputclass and Inputdevice in man xorg.conf on how to match your keyboard using hardware ids (or google, there are plenty of tutorials).

Related Question