Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp834186pxb; Tue, 3 Nov 2020 13:54:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJyywtNnzCP2AI/JCeP3XvwNTJlLRLQjG2SCY5CTLX6U+XYs8l0cMakalnEtuoOQqyYAMMjq X-Received: by 2002:a17:907:10d9:: with SMTP id rv25mr16161883ejb.437.1604440463577; Tue, 03 Nov 2020 13:54:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604440463; cv=none; d=google.com; s=arc-20160816; b=iH8geoSj0rEJB+7PeJfqIKOGyEWl2RCZ1mpztL27kP8A5Ixb3zSYpWaqyzmb3FadvG PzRnBk82FAbeGWN9MRr0zNF7czHmlKnFuuRVxGXAZKikvCMIOrbovlVmCo6up8Yl6bFy Jl76aF/pqEM1RARXtmjgbScpdVCkNhEcEiIXFeiJiDMlKZaQVVWwsXzWk6MYRRz6LTG8 9s5oLDiayx/X5MTxXGraMoXnwVYQqIF4wqEe/KYZbyrKjYF38D8sOY9kvtedSK/dJgKc tUeaeF6yLcusLsYn55vg91s/QwoH4O6muYPZc4ki7NkgmnoEWanF2eHadbBRC2e3GFv+ Bl1w== 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=Mm1z448FRdncJzm2l+CUVII7aWEb88Qq3PfSHKiOEV8=; b=kRyK7WkKMtaxKs/2SH+MVWPYxj2wX3E9NhatV0zYb09Gj3BafVhM1eGOBBDcrjHri0 NWj1VpuSC79Ya8bxgsKe7dvVF+2rEwCJJRJNifvzWpp5a/Hd6ILlWCxtE5aIRF0HuJXI dfgrnqz8SbtMVZ4clfz4VF7VAVHWO7MsjEiuECy97fLxke3RJwd4gJg//otFDvGJYvHd NpKBoVo7OftFP8rjDM2LGL7jWANEqLEG/36BfhfXBn+mqV4QrM8GZ+KQmqvBjZ6Hgqv7 NLt8rLzGDKbfnHemHjftgJ7i9SlZj9ZljLRXBPVZwy2lnY3RdWFrFlNu+ph08NMkCeRf Ie8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YOLmiZNM; 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 y8si109282ejk.39.2020.11.03.13.54.00; Tue, 03 Nov 2020 13:54:23 -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=YOLmiZNM; 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 S1731364AbgKCUrm (ORCPT + 99 others); Tue, 3 Nov 2020 15:47:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:38142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731365AbgKCUrh (ORCPT ); Tue, 3 Nov 2020 15:47:37 -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 1F6D2223FD; Tue, 3 Nov 2020 20:47:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436456; bh=YMsQInCazoApgrY+92/b5y6QEoKHwNezzaCHAZQXFWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YOLmiZNMoHf/wFta4cI9PenQpO1yJcU1sFhgamAavViIduYrQQy+KXwlIeiyui4Vk Ub33QxVztGXA224zo/4ImvlV6vpEeszJnwuH69/+EoreNGOj0Ts0mCTn9+ES4O/kJY VjU6uVq+QaaZAcQyYPkF1sLoXikJzXGrfn9cbyZY= 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 5.9 257/391] HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery Date: Tue, 3 Nov 2020 21:35:08 +0100 Message-Id: <20201103203404.364231800@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@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 @@ -2773,7 +2773,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);