linuxOS_AP06/buildroot/package/sdl2/0001-src-core-linux-SDL_evdev-Double-check-multitouch-dev.patch
2025-06-03 12:28:32 +08:00

46 lines
1.6 KiB
Diff

From b3c30a78f593b19a5f3ccc06ba78376de9410795 Mon Sep 17 00:00:00 2001
From: Jiajian Wu <jair.wu@rock-chips.com>
Date: Mon, 5 Feb 2024 16:49:12 +0800
Subject: [PATCH] src: core: linux: SDL_evdev: Double check multitouch device
Signed-off-by: Jiajian Wu <jair.wu@rock-chips.com>
---
src/core/linux/SDL_evdev.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c
index 208b3c1..d52c8c2 100644
--- a/src/core/linux/SDL_evdev.c
+++ b/src/core/linux/SDL_evdev.c
@@ -553,6 +553,27 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item)
item->touchscreen_data->max_y = abs_info.maximum;
item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum;
+ /* HACK: Fixup for fake MT device */
+ if (item->touchscreen_data->max_slots == 1)
+ {
+ xreq = EVIOCGABS(ABS_MT_POSITION_X);
+ yreq = EVIOCGABS(ABS_MT_POSITION_Y);
+
+ ret = ioctl(item->fd, xreq, &abs_info);
+ if (ret >= 0) {
+ item->touchscreen_data->min_x = abs_info.minimum;
+ item->touchscreen_data->max_x = abs_info.maximum;
+ item->touchscreen_data->range_x = abs_info.maximum - abs_info.minimum;
+ }
+
+ ret = ioctl(item->fd, yreq, &abs_info);
+ if (ret >= 0) {
+ item->touchscreen_data->min_y = abs_info.minimum;
+ item->touchscreen_data->max_y = abs_info.maximum;
+ item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum;
+ }
+ }
+
ret = ioctl(item->fd, EVIOCGABS(ABS_MT_PRESSURE), &abs_info);
if (ret < 0) {
SDL_free(item->touchscreen_data->name);
--
2.25.1