Closed maleselo closed 4 years ago
I added your patch, then fixed mouse grab and mouse release after reading the doc: https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt
I tested it with single-touch and multi-touch devices on iMX6 (QT demo CinematicExperience, Mouse press, release, grab.) Can you test if it works on your hardware?
Hi @ponty, Thanks for your very quick answer.
I still have some issues. The ABS_MT_POSITION_X and ABS_MT_POSITION_Y events generated by the framebuffer-vncserver have different values from ABS_X and ABS_Y:
Got ptrevent: 0000 (x=148, y=118)
Got ptrevent: 0001 (x=148, y=118)
Event: time 946687240.090812, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 14
Event: time 946687240.090812, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
injectTouchEvent (screen(148,118) -> touch(2738,1927), mouse=1)
Event: time 946687240.090812, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 148
Event: time 946687240.090812, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 118
Event: time 946687240.090812, type 3 (EV_ABS), code 0 (ABS_X), value 2738
Event: time 946687240.090812, type 3 (EV_ABS), code 1 (ABS_Y), value 1927
Event: time 946687240.090812, -------------- SYN_REPORT ------------
Got ptrevent: 0000 (x=148, y=118)
Event: time 946687240.213149, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
injectTouchEvent (screen(148,118) -> touch(2738,1927), mouse=0)
Event: time 946687240.213149, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 946687240.213149, -------------- SYN_REPORT ------------
Got ptrevent: 0000 (x=148, y=118)
I tried this and it works well for me. What do you think about it ?
diff --git a/src/touch.c b/src/touch.c
index 14716f8..862af5d 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -156,7 +156,7 @@ void injectTouchEvent(enum MouseAction mouseAction, int x, int y, struct fb_var_
gettimeofday(&ev.time, 0);
ev.type = EV_ABS;
ev.code = ABS_MT_POSITION_X;
- ev.value = xin;
+ ev.value = x;
if (write(touchfd, &ev, sizeof(ev)) < 0)
{
error_print("write event failed, %s\n", strerror(errno));
@@ -166,7 +166,7 @@ void injectTouchEvent(enum MouseAction mouseAction, int x, int y, struct fb_var_
gettimeofday(&ev.time, 0);
ev.type = EV_ABS;
ev.code = ABS_MT_POSITION_Y;
- ev.value = yin;
+ ev.value = y;
if (write(touchfd, &ev, sizeof(ev)) < 0)
{
error_print("write event failed, %s\n", strerror(errno));
Here is my evtest output just in case:
evtest /dev/input/event1
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "ili251x Touchscreen"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 59 (KEY_F1)
Event code 60 (KEY_F2)
Event code 61 (KEY_F3)
Event code 62 (KEY_F4)
Event code 330 (BTN_TOUCH)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 3829
Min 0
Max 14800
Event code 1 (ABS_Y)
Value 2156
Min 0
Max 9800
Event code 47 (ABS_MT_SLOT)
Value 5
Min 0
Max 5
Event code 53 (ABS_MT_POSITION_X)
Value 0
Min 0
Max 14800
Event code 54 (ABS_MT_POSITION_Y)
Value 0
Min 0
Max 9800
Event code 57 (ABS_MT_TRACKING_ID)
Value 0
Min 0
Max 65535
Properties:
Testing ... (interrupt to exit)
This seems to be correct.
Thank you very much
Hi,
I am trying to run a simple Qt application (a simple button that changes a rectangle color) on my system (Buildroot, iMX6 and ILI251x touchscreen). I would like to remotely access this application from a VNC client (visualize and interact with).
I tried framebuffer-vncserver and vncviewer and I successfully visualize my application on the client. But I could not remotely push my button.
Input events from vncwiever generate ABS_X, ABS_Y and BTN_TOUCH events on the server side but they are not recognized and my button is not pushed as it should be.
When I press the button directly with the touchscreen (not with the VNC client), I have got these logs:
It looks like framebuffer-vncserver does not generate all the required events to actually push my button. I did some modifications on the touch.c file in order to generate these events (ABS_MT_TRACKING_ID, ABS_MT_POSITION_X and ABS_MT_POSITION_Y):
With these modifications, when I push the button from the VNC client, the push is well recognized by my Qt application (I do have some multi touch x and y position issues though).
I am pretty unaware of how input devices works on Linux as well as VNC, so any suggestion will be appreciated. I would like to know if you plan to support multi touchscreen events like ABS_MT_TRACKING_ID, ABS_MT_POSITION_X and ABS_MT_POSITION_Y ?
Best regards, Maleselo