Received: by 10.213.65.68 with SMTP id h4csp502464imn; Fri, 16 Mar 2018 09:42:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELtMUIpzpt83BltTSuJaxBw/J6eHs66BC05YUwMI1gwJz5PqMWIaRkSylanv0xdMKQxQ14ZE X-Received: by 10.99.177.7 with SMTP id r7mr1968191pgf.76.1521218543216; Fri, 16 Mar 2018 09:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521218543; cv=none; d=google.com; s=arc-20160816; b=Sac0py5rjNAYPhGWboplEygV5UA8pYsA+8avJ5AsI9qm79MgPCZeUWT1Jt5tLPjG6u feYx/zWhR3rMk+6ecN71sz4zrJU2HsVKwgip/wpxOUBHbTHztrWU17xQU87HVpCXyhZW +QHmtf7p7nORP61LxeI+b0ZrFLWI+co+SNKZfRJObXg9VLGNmbQh5KB5YRbKYXQ3ZETB UVtFTPOos7pVSbk1accuA1V7tM32eM9r1g5no3ym+fa7Tn1F33UrTZxk12oZkIByN50v Arnmy69bemveVtaccP10yU+iSYh3kJbhuercwSHA5CfwjS5nGjR/u22PdQryHyLJax4g rlCg== 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=aXGJY1Vfu4jNjmFZLc8eojvfMco8J8enKkHyylt25qc=; b=cg+/Jdh35FxopQXrQfa7+q9i8wsO8bQ/09H/nqt85VDrqfBuNj0dXbFWK8ucJYT8ci bZ4CFeg6gA5N35KCONlIoYmCcWPu7YQxndJC6b4ox2yWXrOmsnnoZr9zDfdTH24Rb0KS HsjDKexJUAnHUhjrpV/V/X1S3wdiec+jiJf1IRn448G2sbMw8NzxDP+H1GGZS/jGAGDE 9f0VjgbdLmvTJKgPJ1l28A9oXVIaBMQYkdL6fvpRvHJ1D8JPUqYyA/2uBqXZR1xpsI11 Gj7PAq0kaKYau57KcaBVMPIbMbrO6br1od2bQ9ZSnhi16/sNZxRibcgUPXFtZHwGqfrj dk+A== 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 y16si73710pge.500.2018.03.16.09.42.09; Fri, 16 Mar 2018 09:42:23 -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 S934337AbeCPPgq (ORCPT + 99 others); Fri, 16 Mar 2018 11:36:46 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40402 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933422AbeCPPgn (ORCPT ); Fri, 16 Mar 2018 11:36:43 -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 6B7701065; Fri, 16 Mar 2018 15:36:42 +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.14 030/109] HID: multitouch: Only look at non touch fields in first packet of a frame Date: Fri, 16 Mar 2018 16:22:59 +0100 Message-Id: <20180316152331.605570881@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@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.14-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(-) --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -738,9 +738,11 @@ static int mt_touch_event(struct hid_dev } 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; @@ -794,6 +796,15 @@ static void mt_process_mt_event(struct h 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); @@ -813,6 +824,7 @@ static void mt_touch_report(struct hid_d { struct mt_device *td = hid_get_drvdata(hid); struct hid_field *field; + bool first_packet; unsigned count; int r, n; @@ -831,6 +843,7 @@ static void mt_touch_report(struct hid_d 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; @@ -840,7 +853,7 @@ static void mt_touch_report(struct hid_d 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)