Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4480313ivc; Tue, 3 Nov 2020 13:08:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJw056OKZ/TI7nRk9RxKp8JjqeZ+fPR+SP8wzJo+FHfv2r5Cd9S1IGo9uqcCOkoy1n9lAq8/ X-Received: by 2002:a05:6402:1bdb:: with SMTP id ch27mr21199185edb.63.1604437704590; Tue, 03 Nov 2020 13:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437704; cv=none; d=google.com; s=arc-20160816; b=MgmjS3QEDk3gpWo2tPGe1TebWaFRk/VakKsgLGk7fx0pzJvEb9WM8HjMhjz57IJieI VRY512/EJrHSJS61PsSxKBNLMfnIIRZIyuAna3VjRHrk92eNyTn4vsDy/hAkG8bmSx4r tTRzNzn8wOkwRULclD+k5mQyHkkybo+mXPQ5f8ZzmJapsNllaMa4AHuLJf9g/muLQrYY qc8NRm/gFZ4j18wR4aDc2owW4DarDHB2eSyl9Bmblu1TUCKclIM7u22WD10N63ztDb3q +n17yxCl2RT054W2jjqj65Tt6vLgXdR6sz8kK6ZyBbpWlKCSM9DiMPkbcwuXsanFfcT5 A/Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ti27K5WfVAf5jLzohAn+OKZvlsWbFOCJ6GUAVVsx6No=; b=ULb+Cv8varTSY05BWmq3JMsgyi/92tmYj89a5UZcExGCn3caUX1T1FFDOViTYanTpy sUuHarl7cqrIfFbLyV7vrxrWcMaRDOy7HGp2Lrs8YcnCqlOVjVDqw8vXR/IMmHWyEUOf ir/XbLsWqtS8Z7JQ/AhWZQb9t6swRND1oeE5ONHmGHSB3KDed1cefzAaPV7AmOu1Nd5F kcSl6xoxgBA2TeQdTNeT5nX/o0OCPOuc5buWlUgz8UD0syBcHgrEUoaMKSsA1/y3c99p ybxjiZ5gicvfx7Ob95JSjuqf272FmrXoMN7fAZWhFYvV+Cw5Nwfqj0UjrECvjQpE8D/b F40A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="FMoA6m/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s19si20306eja.14.2020.11.03.13.08.01; Tue, 03 Nov 2020 13:08:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="FMoA6m/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387987AbgKCVGp (ORCPT + 99 others); Tue, 3 Nov 2020 16:06:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:45680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388199AbgKCVGm (ORCPT ); Tue, 3 Nov 2020 16:06:42 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B985420658; Tue, 3 Nov 2020 21:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437601; bh=gtGJRTeE1GYtV8jUwiVQZ1nLMsjyOwDDWUZtwMSjvA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FMoA6m/8TWVxnqVQnd2nTIwy1UEtbBA1GhHmf3fbRQZkTP2o7AH+/PHBQTNVCA7hP fJNsx6UazW07JQSzxlvYa8GQ0+NwNhwoFHU7g8bUh5Fct7IQwtephvUx/dlGXEDhPH 8mcYaxZQHyExuMdXszxDeYwn1RJjQTxYpwqdPV7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gerecke , Ping Cheng , Jiri Kosina Subject: [PATCH 4.19 146/191] HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery Date: Tue, 3 Nov 2020 21:37:18 +0100 Message-Id: <20201103203246.442871831@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Gerecke commit d9216d753b2b1406b801243b12aaf00a5ce5b861 upstream. It has recently been reported that the "heartbeat" report from devices like the 2nd-gen Intuos Pro (PTH-460, PTH-660, PTH-860) or the 2nd-gen Bluetooth-enabled Intuos tablets (CTL-4100WL, CTL-6100WL) can cause the driver to send a spurious BTN_TOUCH=0 once per second in the middle of drawing. This can result in broken lines while drawing on Chrome OS. The source of the issue has been traced back to a change which modified the driver to only call `wacom_wac_pad_report()` once per report instead of once per collection. As part of this change, pad-handling code was removed from `wacom_wac_collection()` under the assumption that the `WACOM_PEN_FIELD` and `WACOM_TOUCH_FIELD` checks would not be satisfied when a pad or battery collection was being processed. To be clear, the macros `WACOM_PAD_FIELD` and `WACOM_PEN_FIELD` do not currently check exclusive conditions. In fact, most "pad" fields will also appear to be "pen" fields simply due to their presence inside of a Digitizer application collection. Because of this, the removal of the check from `wacom_wac_collection()` just causes pad / battery collections to instead trigger a call to `wacom_wac_pen_report()` instead. The pen report function in turn resets the tip switch state just prior to exiting, resulting in the observed BTN_TOUCH=0 symptom. To correct this, we restore a version of the `WACOM_PAD_FIELD` check in `wacom_wac_collection()` and return early. This effectively prevents pad / battery collections from being reported until the very end of the report as originally intended. Fixes: d4b8efeb46d9 ("HID: wacom: generic: Correct pad syncing") Cc: stable@vger.kernel.org # v4.17+ Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng Tested-by: Ping Cheng Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/wacom_wac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2729,7 +2729,9 @@ static int wacom_wac_collection(struct h if (report->type != HID_INPUT_REPORT) return -1; - if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) + if (WACOM_PAD_FIELD(field)) + return 0; + else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) wacom_wac_pen_report(hdev, report); else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) wacom_wac_finger_report(hdev, report);