Use mouse to enter without mouse

So, the question that I have today is related to interacting with a USB mouse connected to a Linux machine. However, I do not want the mouse to have any traditional effect for the X environment. I just want to use the encoders built into it through the original input. So here is my question.

How can I get low-level but meaningful data from alternative mouse devices in C ++ on linux? In particular, I would like to know the relative position or at least the number of counters along the x and y axes.

+3
source share
2 answers

I did something similar for a USB barcode reader, which is a HID keyboard.

/dev/input/event* . EVIOCGRAB ioctl(), . - . evdev Documentation/input/input.txt linux.

, :

struct input_event {
    struct timeval time;
    unsigned short type;
    unsigned short code;
    unsigned int value;
};

(struct input_event linux/input.h).

, , input_event.type == EV_REL ( ), input_event.code - REL_X ( X - . linux/input.h ), input_event.value .

HID , .

+4

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


All Articles