HID: multitouch: handle faulty Elo touch device [Linux 5.2]

HID: multitouch: handle faulty Elo touch device [Linux 5.2]

This Linux kernel change "HID: multitouch: handle faulty Elo touch device" is included in the Linux 5.2 release. This change is authored by Benjamin Tissoires <benjamin.tissoires [at] redhat.com> on Tue May 21 15:38:31 2019 +0200. The commit for this change in Linux stable tree is 81bcbad (patch).

HID: multitouch: handle faulty Elo touch device

Since kernel v5.0, one single win8 touchscreen device failed.
And it turns out this is because it reports 2 InRange usage per touch.

It's a first, and I *really* wonder how this was allowed by Microsoft in
the first place. But IIRC, Breno told me this happened *after* a firmware
upgrade...

Anyway, better be safe for those crappy devices, and make sure we have
a full slot before jumping to the next.
This won't prevent all crappy devices to fail here, but at least we will
have a safeguard as long as the contact ID and the X and Y coordinates
are placed in the report after the grabage.

Fixes: 01eaac7e5713 ("HID: multitouch: remove one copy of values")
CC: [email protected] # v5.0+
Reported-and-tested-by: Breno Leitao <[email protected]bian.org>
Signed-off-by: Benjamin Tissoires <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>

There are 7 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/hid/hid-multitouch.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index c02d4ca..1565a30 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -641,6 +641,13 @@ static void mt_store_field(struct hid_device *hdev,
    if (*target != DEFAULT_TRUE &&
        *target != DEFAULT_FALSE &&
        *target != DEFAULT_ZERO) {
+       if (usage->contactid == DEFAULT_ZERO ||
+           usage->x == DEFAULT_ZERO ||
+           usage->y == DEFAULT_ZERO) {
+           hid_dbg(hdev,
+               "ignoring duplicate usage on incomplete");
+           return;
+       }
        usage = mt_allocate_usage(hdev, application);
        if (!usage)
            return;

Leave a Reply

Your email address will not be published. Required fields are marked *