How to read events from a HID device under Ubuntu Jaunty?

I have a Linux USB-HID device ( Hama MCE ), and I can read its events manually by reading cat /dev/input/event7and cat /dev/input/event8. Whenever I press a key on a device, several bytes become readable using one of the commands above cat. I have the default installation of the 64-bit Ubuntu Jaunty desktop on the computer.

I think I can write a parser to interpret the bytes emitted by the device, or I will use libhid if it is more convenient.

My questions:

  • How to prevent text mode virtual consoles from receiving some keystrokes on a device as regular keystrokes? Currently, some device keys result in input, back space, PageUp or numeric keypad numbers.
  • Similarly, how can I prevent the X server from receiving events from the keyboard and mouse from this device? I have several USB keyboards and mice connected to a computer. I want the X server to receive events from all of them except this device.
  • How to configure that whenever a device connects to a computer, a command /usr/local/bin/keydumper /dev/input/event7 /dev/input/event8(or one command for each path /dev/) will be launched, and the corresponding lines will be /dev/replaced on the command line?
+3
3

, USB USB HID:

1. 2.: Do

ioctl(open("/dev/input/event7", O_RDONLY), EVIOCGRAB, 1);

, ( () s ). EVIOCGRAB HID . Lirc EVIOCGRAB.

3: udev .

+5

.

EVIOCGRAB,

    #include <linux/input.h>
0

I think that the solution to all issues may be to write your own filter device driver or a special driver for your device. I know that such a thing (filter device driver) is available on Windows, so something like this can be on Linux. In this filter device driver, you can block all unwanted events from the target device that you want to block, I really do not get 3 questions, so I do not know how to answer this.

-1
source

Source: https://habr.com/ru/post/1719327/


All Articles