Sample Header Ad - 728x90

How to prevent the keyboard from being interpreted by the current application?

4 votes
2 answers
3797 views
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: 1. Somewhat change the name of the USB "keyboard" to another name instead of eventN, for example /dev/input/myinput0. Unfortunately, the udev rules doesn't allows renaming the device. (The NAME directive in the rules.d works only for network devices, for other devices could create only symlink) 2. 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 every eventN 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.
Asked by clt60 (297 rep)
Jun 16, 2017, 08:09 AM
Last activity: Jan 26, 2024, 04:35 PM