From patchwork Mon Jun 25 20:24:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 10487243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9F055604D3 for ; Mon, 25 Jun 2018 20:24:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91461286A0 for ; Mon, 25 Jun 2018 20:24:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8480C286A1; Mon, 25 Jun 2018 20:24:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD8282869D for ; Mon, 25 Jun 2018 20:24:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755673AbeFYUYx (ORCPT ); Mon, 25 Jun 2018 16:24:53 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36442 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752292AbeFYUYw (ORCPT ); Mon, 25 Jun 2018 16:24:52 -0400 Received: by mail-pf0-f196.google.com with SMTP id u16-v6so3197876pfh.3 for ; Mon, 25 Jun 2018 13:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=MxgWtnMlcWGzffLcazzTWH51ptZYHoAYDez7HeLo2+0=; b=JHQWkeEti6hI8m7AsD+u0Zuc4Jl76MYrrf+c6lnM69PdKLehMhePl2YZPxeViukWwt F3OU2FAgh0pcUyzE2yMlAMxgDMFC0jcq8heZK0O0buy7JfKUjFSjf6lWOuF3Cr2czIjS TvhdBm9EfowF6BYQmI+xjeDcSkJBHPH8Ryiif1JSqSlubC3UuZDf0i5rZklJkiM2/NrR 7rJOS27d9batx/tLTX8Pmw+F4Mo1YI0bybq5AIPyhcFuVJn+wEgURTBf01VDyJXpQwKO xJAi7z5oknDOUSh6/kPj562mrIY7eJu4v+dyPbn652Sc6oOEMLWvrVtzsgwpobAQg37f lZHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MxgWtnMlcWGzffLcazzTWH51ptZYHoAYDez7HeLo2+0=; b=Yosa3jBHs1QAgBjyiTiX3CvK1uVreQYySwa4PiHjvEFU6p4MBX088X/AGKPLhfPglV Dl+zJZgOtZ0NdJp1EG+b5fcBssIwQWQtiH7Hh+s/BrHBW1cGdQFpe3tZ+eytawdMCqqA p5DrmSWij+MdFZT4ROaBziByYhSqya7rOlvm9Gzr/lKj+C3PuFCJMabeTxaVx8TR6fOv rDNZZ0DDrCQvlDNFzYoQErwtB/v6KUlzOcRBbMdCimmFUke2RnPDAg6ZXCZi2CAahfT9 LmFNWCsReFcaTK8ZFuB697NdeNaKJ8dwP6gLQbiFhPSw0mRGxHfYsZSCtxR1qtDiOGXe UeTA== X-Gm-Message-State: APt69E2CJ+x6B0Rsm2iDjVZWNhBmUtb4XhVEZgfGfM9gXtIBop9/pyLA N2eVywQV5qsWz8POZ+p3+8YxTpxs X-Google-Smtp-Source: ADUXVKIPFaX9NMg0MzKoET9uWGSWrQNDMnoGT2oKYG7xdPHBaLCvPJLKM7YZ9tUtkmh9ps6joCz9AA== X-Received: by 2002:a63:2dc2:: with SMTP id t185-v6mr12120468pgt.204.1529958291810; Mon, 25 Jun 2018 13:24:51 -0700 (PDT) Received: from wacom-arch2.corp.onewacom.com ([50.225.60.4]) by smtp.gmail.com with ESMTPSA id z26-v6sm31865677pfd.60.2018.06.25.13.24.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 13:24:50 -0700 (PDT) From: Jason Gerecke To: linux-input@vger.kernel.org, Jiri Kosina Cc: Benjamin Tissoires , Ping Cheng , Aaron Skomra , Jason Gerecke , Jason Gerecke Subject: [PATCH 1/3] HID: wacom: Replace touch_max fixup code with static touch_max definitions Date: Mon, 25 Jun 2018 13:24:34 -0700 Message-Id: <20180625202436.25114-1-killertofu@gmail.com> X-Mailer: git-send-email 2.18.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Detecting the number of supported touches for a particular device used to be tricky, both because early forms of the driver didn't have a very good HID parser and because early hardware didn't always advertise the actual number. At the time, we added a block of code which would ensure that touch_max would always be equal to at least 1 on any touch device, and relied on setting touch_max to e.g. 2 only for the multitouch-capable exceptions. The common case has since flipped, and the driver and descriptors can reliably detect the number of touches supported by modern sensors. Because of this, it makes sense to remove the fixup code and instead place static declarations of "touch_max = 1" for these old devices. It isn't entirely clear if all 2-finger devices actually report a maximum number of touches so we leave these declarations still in place. For the eagle-eyed, the "> BAMBOO_PT" condition was originally equivalent to ">= TABLETPC", which is what the intent was. This commit doesn't have to consider the types introduced in the interim since they shouldn't be affected, hence why only the tablet PC definitions have been modified. Signed-off-by: Jason Gerecke --- drivers/hid/wacom_sys.c | 10 ---------- drivers/hid/wacom_wac.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 545986cfb978..fd40037c2bcc 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -361,16 +361,6 @@ static void wacom_usage_mapping(struct hid_device *hdev, else return; - /* - * Bamboo models do not support HID_DG_CONTACTMAX. - * And, Bamboo Pen only descriptor contains touch. - */ - if (features->type > BAMBOO_PT) { - /* ISDv4 touch devices at least supports one touch point */ - if (finger && !features->touch_max) - features->touch_max = 1; - } - /* * ISDv4 devices which predate HID's adoption of the * HID_DG_BARELSWITCH2 usage use 0x000D0000 in its diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 0bb44d0088ed..e0842241f692 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -4351,19 +4351,19 @@ static const struct wacom_features wacom_features_0x5E = .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; static const struct wacom_features wacom_features_0x90 = { "Wacom ISDv4 90", 26202, 16325, 255, 0, - TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ static const struct wacom_features wacom_features_0x93 = { "Wacom ISDv4 93", 26202, 16325, 255, 0, - TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; static const struct wacom_features wacom_features_0x97 = { "Wacom ISDv4 97", 26202, 16325, 511, 0, - TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ static const struct wacom_features wacom_features_0x9A = { "Wacom ISDv4 9A", 26202, 16325, 255, 0, - TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; static const struct wacom_features wacom_features_0x9F = { "Wacom ISDv4 9F", 26202, 16325, 255, 0, - TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; static const struct wacom_features wacom_features_0xE2 = { "Wacom ISDv4 E2", 26202, 16325, 255, 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; @@ -4378,13 +4378,13 @@ static const struct wacom_features wacom_features_0xE6 = TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; static const struct wacom_features wacom_features_0xEC = { "Wacom ISDv4 EC", 25710, 14500, 255, 0, - TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ static const struct wacom_features wacom_features_0xED = { "Wacom ISDv4 ED", 26202, 16325, 255, 0, - TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; static const struct wacom_features wacom_features_0xEF = { "Wacom ISDv4 EF", 26202, 16325, 255, 0, - TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ static const struct wacom_features wacom_features_0x100 = { "Wacom ISDv4 100", 26202, 16325, 255, 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; @@ -4402,10 +4402,10 @@ static const struct wacom_features wacom_features_0x10F = MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; static const struct wacom_features wacom_features_0x116 = { "Wacom ISDv4 116", 26202, 16325, 255, 0, - TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 1 }; static const struct wacom_features wacom_features_0x12C = { "Wacom ISDv4 12C", 27848, 15752, 2047, 0, - TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; + TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; /* Pen-only */ static const struct wacom_features wacom_features_0x4001 = { "Wacom ISDv4 4001", 26202, 16325, 255, 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };