Received: by 10.213.65.68 with SMTP id h4csp469328imn; Fri, 16 Mar 2018 08:42:10 -0700 (PDT) X-Google-Smtp-Source: AG47ELvDkJPlHWvuREYt7uz4YWISizn+VRcu3UEF6Ic6SqWTFYDiKnmlSUrBkqpPBUUYRoe2Tmk1 X-Received: by 2002:a17:902:8f89:: with SMTP id z9-v6mr2557266plo.370.1521214930489; Fri, 16 Mar 2018 08:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521214930; cv=none; d=google.com; s=arc-20160816; b=MzxFGfHkqdYUMobUCnT1GJhiuFcPKNIkRouN0HK/Yg0JFRmVRNPYNRh2YuYNVni0OI 6WXdEUMcG1iP0bq5Oq+gEbjreb1ONT+EbJ3X8sNzpBvs3h7Mpz2IetD5WD7fYZPva8OH 4Er69bt3UGxz2V5+2lzOfJT9wc+kpHJ/9HDLFw1zF6M2pv9TlMeRTXtMabrNZ+08+NGn Yd05TjpWqsA0xU/2UdtK6mPqc0iA+DNOOjLDmqGV7xoxV65HqIMFaUSgTMyjeWw+A0i8 atGQTnpXXyZQnBofRsVZEtBJZvOVXyFgv2hVK+gAD4mA5hKifctdUj3Ng5DilL8wCxe7 pvnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3Hm8lwaD6qT0n1yIOBYMrx3u8+vIezIRedzJzHgPpIA=; b=MK64YHXP4CjMBiia8Ir1ziwioSHainfoVpwiJgHSdlnVKZqDdVFUTDpbG/+cBe5DPA DhpfYQSryMTnw/f0gxYtZblGn0r5XvtrcHcAee6zjXUy3py++zPJo9rpO9OehfkMe/n0 o9ROa2dTQ+H0UPbY8tAtl7uOcWXKyowfN/aoXMekYPVLbBm5lg3iIIht48RAfbCjzFQC uaFLLH4PvHaUXiz9+gFyqUdKnZN8VebD1qcPOJvWoQpXhjnuD43ldDpX1MWVgJ+tA26W lhKjoLMadN0TSdBLe+omEAp7zaAGU6s4edCjSj7IRZ4djxKU5mQyGXdDNX1+7Bfm6+hU WFeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6-v6si6446993plg.618.2018.03.16.08.41.56; Fri, 16 Mar 2018 08:42:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965058AbeCPPk1 (ORCPT + 99 others); Fri, 16 Mar 2018 11:40:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43566 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964989AbeCPPkY (ORCPT ); Fri, 16 Mar 2018 11:40:24 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C9EBFDEB; Fri, 16 Mar 2018 15:40:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Benjamin Tissoires , Jiri Kosina , Sasha Levin Subject: [PATCH 4.15 030/128] HID: multitouch: Only look at non touch fields in first packet of a frame Date: Fri, 16 Mar 2018 16:22:51 +0100 Message-Id: <20180316152338.045316429@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans de Goede [ Upstream commit 55746d28d66860bccaae20a67b55b9d5db7c14af ] Devices in "single finger hybrid mode" will send one report per finger, on some devices only the first report of such a multi-packet frame will contain a value for BTN_LEFT, in subsequent reports (if multiple fingers are down) the value is always 0, causing hid-mt to report BTN_LEFT going 1 - 0 - 1 - 0 when pressing a clickpad and putting down a second finger. This happens for example on USB 0603:0002 mt touchpads. This commit fixes this by only reporting non touch fields for the first packet of a (possibly) multi-packet frame. Signed-off-by: Hans de Goede Reviewed-by: Benjamin Tissoires Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-multitouch.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 65ea23be9677..397592959238 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -778,9 +778,11 @@ static int mt_touch_event(struct hid_device *hid, struct hid_field *field, } static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, - struct hid_usage *usage, __s32 value) + struct hid_usage *usage, __s32 value, + bool first_packet) { struct mt_device *td = hid_get_drvdata(hid); + __s32 cls = td->mtclass.name; __s32 quirks = td->mtclass.quirks; struct input_dev *input = field->hidinput->input; @@ -837,6 +839,15 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, break; default: + /* + * For Win8 PTP touchpads we should only look at + * non finger/touch events in the first_packet of + * a (possible) multi-packet frame. + */ + if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) && + !first_packet) + return; + if (usage->type) input_event(input, usage->type, usage->code, value); @@ -856,6 +867,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report) { struct mt_device *td = hid_get_drvdata(hid); struct hid_field *field; + bool first_packet; unsigned count; int r, n; @@ -874,6 +886,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report) td->num_expected = value; } + first_packet = td->num_received == 0; for (r = 0; r < report->maxfield; r++) { field = report->field[r]; count = field->report_count; @@ -883,7 +896,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report) for (n = 0; n < count; n++) mt_process_mt_event(hid, field, &field->usage[n], - field->value[n]); + field->value[n], first_packet); } if (td->num_received >= td->num_expected) -- 2.16.2