Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp804879pxb; Tue, 3 Nov 2020 13:02:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwW62AV/A0NvtDo9JrRlt0PAPJGdqizPiH7eYorxTt1EAK/v2CUTe2iON9hnGPRT6ELwiKf X-Received: by 2002:a17:906:39d1:: with SMTP id i17mr21331156eje.284.1604437329058; Tue, 03 Nov 2020 13:02:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437329; cv=none; d=google.com; s=arc-20160816; b=WTY4XOxY+q7xysgHsW7YYJzMV7x1/VY0mrbJssdTOnjN1iFq2DDmUaWpOa7r0QjwhQ N5sakWadyJqLbI/NgTcr9oo4CFW5T9GuRTG3mRo6F1AhAJWvpCoiVjaKAZ4b+9VJ1stq Z71R+JIJcCJYi2vRasBeN5EZ6GzPX2O8UQWSjm9tHxLWijbAQZoKhGlNi5EsRR/Rufcv S9sxlD5qAnACn6gVIM8wItb0TstZ64D/Y8A9DhvKSy/3OXFImvvFlyuAOYhGmQPP8jGR 32tXW1OZCbIt759abGNBfb0pXCl7fWnd8+rhsr0YmumhWCodbDi2Dypkh9nTr2wZg6yU BQtw== 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=lXiqLV0jSMCkH+ftkRGbZwni6nFdOSCHkBlExoJcyGLcE5vlhgtnRbbjWJjVVtwrpC 7MI2OBURqGwJ7qtLAhTu+rEZRg8wmPUffwK/2Eg1cuLpqyVuQQeNuRYf5ZHICcBBisrl 6MV9cTW5JNe3C7tNQ0WOS0SscQmGaERAVyLCImD4308l/81rkyfuOgkD4WoGMhzWIbIq cHzvIoQf5mqW34osv5jGqgCZIqDm4nUOVGXrVJmL7tuZ02Z7kBpnqjhjjyrL6aN99gdV Byb+Xu11qssWBEXrc5AfmuQ+Xr7y5QiccjvZD+C2VBTiym3M/0rnIvnFMu/YEVQSHZ63 BZag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D4lXy1El; 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 d19si13519812edp.276.2020.11.03.13.01.45; Tue, 03 Nov 2020 13:02:09 -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=D4lXy1El; 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 S1732975AbgKCU62 (ORCPT + 99 others); Tue, 3 Nov 2020 15:58:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:32838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732967AbgKCU6Z (ORCPT ); Tue, 3 Nov 2020 15:58:25 -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 2C0AC223C7; Tue, 3 Nov 2020 20:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437104; bh=YMsQInCazoApgrY+92/b5y6QEoKHwNezzaCHAZQXFWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4lXy1ElA9Uv0DU96pJZ622kHN8T1keyCxDE6NWit/gX9+OwoLZPGPh1OmKJRGm7H si2CaqwUR10mg52F9SS58LEnajCbBkE4YN+h74+XNxVIGekMsm5gGSMe4yu8QgvyFV bVQU2+mqolcJzmKveXi13lN+wL+oryVzkDOYVnIE= 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.4 147/214] HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery Date: Tue, 3 Nov 2020 21:36:35 +0100 Message-Id: <20201103203304.591985448@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@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);