From patchwork Wed Feb 17 17:22:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 384116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E84EEC433E6 for ; Wed, 17 Feb 2021 17:33:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C22A464DCF for ; Wed, 17 Feb 2021 17:33:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233782AbhBQRcx (ORCPT ); Wed, 17 Feb 2021 12:32:53 -0500 Received: from [139.28.40.42] ([139.28.40.42]:46874 "EHLO tarta.nabijaczleweli.xyz" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S234141AbhBQRcl (ORCPT ); Wed, 17 Feb 2021 12:32:41 -0500 X-Greylist: delayed 563 seconds by postgrey-1.27 at vger.kernel.org; Wed, 17 Feb 2021 12:32:26 EST Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 838B3360135; Wed, 17 Feb 2021 18:22:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nabijaczleweli.xyz; s=202006; t=1613582551; bh=Hf4nKRB8+MGr3EN3mWaLIlVmQ4/HMM8ISiBIcOu0J2s=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=TuSDx0HPyiuDxVlHcQJD4nnMUgLXHlBEizchqtaG25OUAe22XxQWtUOSD8hV+L5YV C57GZyr8gdXCJOqXv/r1m4DPRblI2bedTggIWAg0EAjRbDxgrt/ZFD50+za9l1HyKq jfO8MrYK9UqvR5aIc/LRLpsx75TZcDzLRymPx6iUdUHdltxycu1Gnt0kLHDnfzatW7 ZfGPjNI4zLdU/ZZT92PLsXl9tWQdFUw+10LkaagL9x0WKtd6g/rMFsnCxC4VBgL49T P663JFO/6fJl9tL382KzuAEfnhGQs20OTHg6WFCexhhI/h2kcbT2qQSW+3dQmcbuwQ 71p01ntMqa+Pw== Date: Wed, 17 Feb 2021 18:22:30 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Benjamin Tissoires , Peter Hutterer , Jiri Kosina , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] HID: multitouch: require Finger field to mark Win8 reports as MT Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20210205 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This effectively changes collection_is_mt from contact ID in report->field to (device is Win8 => collection is finger) && contact ID in report->field Some devices erroneously report Pen for fingers, and Win8 stylus-on-touchscreen devices report contact ID, but mark the accompanying touchscreen device's collection correctly Signed-off-by: Ahelenia ZiemiaƄska --- drivers/hid/hid-multitouch.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 8429ebe7097e..8580ace596c2 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -604,9 +604,13 @@ static struct mt_report_data *mt_allocate_report_data(struct mt_device *td, if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) continue; - for (n = 0; n < field->report_count; n++) { - if (field->usage[n].hid == HID_DG_CONTACTID) - rdata->is_mt_collection = true; + if (field->logical == HID_DG_FINGER || td->hdev->group != HID_GROUP_MULTITOUCH_WIN_8) { + for (n = 0; n < field->report_count; n++) { + if (field->usage[n].hid == HID_DG_CONTACTID) { + rdata->is_mt_collection = true; + break; + } + } } }