From 9ca214eee869e31916555b8259a87ba95a5fa232 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Fri, 19 Oct 2018 16:08:10 +0200 Subject: [PATCH] usb: quickfix pointer-emulation for touch screen Move button-event reporting behind pointer-position update. This is just a quickfix to restore correct pointer emulation with dde_linux usb_drv. It does not change usb_hid_drv because the approach is a questionable workaround of the current input event handling, which reports events promptly on occurrence of inputs events and ignores synchronization events completely. The original contrib code reported the button press before absolute x and y positioning followed by a sync event. Issue #3019 --- repos/dde_linux/README | 2 +- repos/dde_linux/patches/usb_input_mt.patch | 24 ++++++++++++++++++++++ repos/dde_linux/ports/dde_linux.hash | 2 +- repos/dde_linux/ports/dde_linux.port | 1 + repos/dde_linux/src/lib/usb/input/evdev.cc | 2 +- 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 repos/dde_linux/patches/usb_input_mt.patch diff --git a/repos/dde_linux/README b/repos/dde_linux/README index 180274075..a8f8a2ace 100644 --- a/repos/dde_linux/README +++ b/repos/dde_linux/README @@ -60,7 +60,7 @@ hid xml tag: !... ! ! -! +! !... If a touchscreen is multi-touch-capable than the multitouch attribute gears diff --git a/repos/dde_linux/patches/usb_input_mt.patch b/repos/dde_linux/patches/usb_input_mt.patch new file mode 100644 index 000000000..3ba83d7bc --- /dev/null +++ b/repos/dde_linux/patches/usb_input_mt.patch @@ -0,0 +1,24 @@ +--- a/drivers/input/input-mt.c ++++ b/drivers/input/input-mt.c +@@ -217,10 +217,6 @@ + count++; + } + +- input_event(dev, EV_KEY, BTN_TOUCH, count > 0); +- if (use_count) +- input_mt_report_finger_count(dev, count); +- + if (oldest) { + int x = input_mt_get_value(oldest, ABS_MT_POSITION_X); + int y = input_mt_get_value(oldest, ABS_MT_POSITION_Y); +@@ -236,6 +232,10 @@ + if (test_bit(ABS_MT_PRESSURE, dev->absbit)) + input_event(dev, EV_ABS, ABS_PRESSURE, 0); + } ++ ++ input_event(dev, EV_KEY, BTN_TOUCH, count > 0); ++ if (use_count) ++ input_mt_report_finger_count(dev, count); + } + EXPORT_SYMBOL(input_mt_report_pointer_emulation); + diff --git a/repos/dde_linux/ports/dde_linux.hash b/repos/dde_linux/ports/dde_linux.hash index a44c9c01a..6fe905347 100644 --- a/repos/dde_linux/ports/dde_linux.hash +++ b/repos/dde_linux/ports/dde_linux.hash @@ -1 +1 @@ -85b33124266df46e53981153e5014fd372d0680d +4832c9de27d57c6e6eb3c04a6ff6be61b0237216 diff --git a/repos/dde_linux/ports/dde_linux.port b/repos/dde_linux/ports/dde_linux.port index 684718df7..bd72fdf76 100644 --- a/repos/dde_linux/ports/dde_linux.port +++ b/repos/dde_linux/ports/dde_linux.port @@ -178,6 +178,7 @@ USB_OPT = -p1 -d$(SRC_DIR_USB) PATCH_OPT(patches/usb_ax88179.patch) := $(USB_OPT) PATCH_OPT(patches/usb_csum.patch) := $(USB_OPT) PATCH_OPT(patches/usb_evdev.patch) := $(USB_OPT) +PATCH_OPT(patches/usb_input_mt.patch) := $(USB_OPT) PATCH_OPT(patches/usb_mem.patch) := $(USB_OPT) PATCH_OPT(patches/usb_usbnet.patch) := $(USB_OPT) PATCH_OPT(patches/usb_rndis.patch) := $(USB_OPT) diff --git a/repos/dde_linux/src/lib/usb/input/evdev.cc b/repos/dde_linux/src/lib/usb/input/evdev.cc index 7891f0c48..f5c136ded 100644 --- a/repos/dde_linux/src/lib/usb/input/evdev.cc +++ b/repos/dde_linux/src/lib/usb/input/evdev.cc @@ -133,7 +133,7 @@ static void handle_absolute_axis(input_dev *dev, unsigned code, int value, Axis { slots[slot].event = code; - input_event_type type; + input_event_type type = EVENT_TYPE_MOTION; switch (axis) { case AXIS_X: