I have 3 USB-keyboards attached to the Linux. Normally, when writing on any one, the characters "going" to the currently active application, e.g. to terminal or any other app.
But, me reading the keyboard events from two keyboards directly by reading the particular /dev/input/eventX
devices using some Perl module. While the script reads and decodes all events correctly, the entered keys are also going into the active application.
The question is: It is possible to stop routing the keyboard events from particular keyboard to the active application? E.g. somewhat tell to kernel that inputs from a particular keyboard should not be taken as normal keyboard input.
Because the X11
reads from every device which has device nodes in the /dev/input/event*
it kooks like there are two possible solutions:
Somewhat change the name of the USB "keyboard" to another name instead of
eventN
, for example/dev/input/myinput0
. Unfortunately, theudev
rules doesn't allows renaming the device. (TheNAME
directive in therules.d
works only for network devices, for other devices could create only symlink)Somewhat change the
X11
configuration, in the/usr/share/X11/xorg.conf.d/10-evdev.conf
, to ignore some particular "keyboard-like" devices - e.g. don't read everyeventN
device. Currently in my system it contains:
Section "InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Do you have any idea how to do any of the above?
The real background: I have attached two USB-RFID readers. They act as keyboards, e.g. when I touching the reader with the RFID-tag, it sends the RFID-number exactly as they was typed on the keyboard, e.g the readers act like a normal keyboard.
My application could read the RFID events (in the background), and (of course) I don't want get the characters from RFID into the active window.
EVIOCGRAB
, just found this nearly exact duplicate question. https://unix.stackexchange.com/q/77756/37612 . Thank you. – clt60 Jun 18 '17 at 05:04