Received: by 10.192.165.148 with SMTP id m20csp2523809imm; Sun, 22 Apr 2018 08:49:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/y4DxdmsiaUNK0VfGCLdU9OdehrEjZzVB+FKCc8ITCmFNxLLJefx+T9fu4+BuFCEP2yB3n X-Received: by 10.99.110.198 with SMTP id j189mr14199378pgc.86.1524412169145; Sun, 22 Apr 2018 08:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524412169; cv=none; d=google.com; s=arc-20160816; b=tS8xnkZ5qNFUEhw4G6lbqsLDOzjMPBgi7MMgAY5pRdGJxrJTTh4YYCjevIVCIvj7+h p2tgrT7VkJixcnc7m9jpZgzOOpRvfWa7OaRAHRZhObbzFZ03hqEdUgsvEOrmBgiPUNyA qIY+WDko+Jkq2Gkb2D6DLo8un8oAh+hpiS7A7DWMcRfUs2RHiPw1SVo4/M6ixnGhzGvp yaogi2mTuR1msWY8By8v9Oj1/cBo9LpgTq95OmHm8OV5CgwO43kVZH92irbFNMaijKjc U7+t5SFsMyw9mZ5gCfn0jBdclHmTpxInQ6g/dY98pN6JGBE5jR6zGS3USwWgzZzrYCZX mqBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=txbRmqX7XuHhb1cJ5rAzPnb/OyZe91EIkTddocRnvp8=; b=Xw9qtylpe8PNnZUKLhDanJZa6OEq4nYT0wrgKrV1ihJFOxQs6Esegv1YVyqBaFT9XW JylQmDlcgeYfeutIIWU+DvvPUsTFV9ystGmw3uMK3mMTu+RpjYrFVLbD6j/4/n3mBaEs qdwyN7FBkgpjbzy/gEaeqfnbRZgTK/GAdZQunPKboULdft7AefQzE1xMZqh1qPIC695o D3an99wjXRPWf6t9VYwdonu7itumbHXgWTBlPXlFVAbE4fqxIPkool3/dGK9k3+yPVQm 3AbFu5v+ZwDhTB5Y53BmgGJ8v5w/f0kXIBCQmC8OE7ROft3kT24vgpfR5W9Ls7ML+REC 8tbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si8684773pfi.88.2018.04.22.08.49.15; Sun, 22 Apr 2018 08:49:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755074AbeDVPr0 (ORCPT + 99 others); Sun, 22 Apr 2018 11:47:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48252 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754773AbeDVOCB (ORCPT ); Sun, 22 Apr 2018 10:02:01 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D0353941; Sun, 22 Apr 2018 14:02:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaron Armstrong Skomra , Ping Cheng , Jiri Kosina Subject: [PATCH 4.16 171/196] HID: wacom: bluetooth: send exit report for recent Bluetooth devices Date: Sun, 22 Apr 2018 15:53:11 +0200 Message-Id: <20180422135113.095020360@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aaron Armstrong Skomra commit 619d3a2922ce623ca2eca443cc936810d328317c upstream. The code path for recent Bluetooth devices omits an exit report which resets all the values of the device. Fixes: 4922cd26f0 ("HID: wacom: Support 2nd-gen Intuos Pro's Bluetooth classic interface") Cc: # 4.11 Signed-off-by: Aaron Armstrong Skomra Reviewed-by: Ping Cheng Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/wacom_wac.c | 76 +++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 30 deletions(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -689,6 +689,45 @@ static int wacom_intuos_get_tool_type(in return tool_type; } +static void wacom_exit_report(struct wacom_wac *wacom) +{ + struct input_dev *input = wacom->pen_input; + struct wacom_features *features = &wacom->features; + unsigned char *data = wacom->data; + int idx = (features->type == INTUOS) ? (data[1] & 0x01) : 0; + + /* + * Reset all states otherwise we lose the initial states + * when in-prox next time + */ + input_report_abs(input, ABS_X, 0); + input_report_abs(input, ABS_Y, 0); + input_report_abs(input, ABS_DISTANCE, 0); + input_report_abs(input, ABS_TILT_X, 0); + input_report_abs(input, ABS_TILT_Y, 0); + if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { + input_report_key(input, BTN_LEFT, 0); + input_report_key(input, BTN_MIDDLE, 0); + input_report_key(input, BTN_RIGHT, 0); + input_report_key(input, BTN_SIDE, 0); + input_report_key(input, BTN_EXTRA, 0); + input_report_abs(input, ABS_THROTTLE, 0); + input_report_abs(input, ABS_RZ, 0); + } else { + input_report_abs(input, ABS_PRESSURE, 0); + input_report_key(input, BTN_STYLUS, 0); + input_report_key(input, BTN_STYLUS2, 0); + input_report_key(input, BTN_TOUCH, 0); + input_report_abs(input, ABS_WHEEL, 0); + if (features->type >= INTUOS3S) + input_report_abs(input, ABS_Z, 0); + } + input_report_key(input, wacom->tool[idx], 0); + input_report_abs(input, ABS_MISC, 0); /* reset tool id */ + input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); + wacom->id[idx] = 0; +} + static int wacom_intuos_inout(struct wacom_wac *wacom) { struct wacom_features *features = &wacom->features; @@ -741,36 +780,7 @@ static int wacom_intuos_inout(struct wac if (!wacom->id[idx]) return 1; - /* - * Reset all states otherwise we lose the initial states - * when in-prox next time - */ - input_report_abs(input, ABS_X, 0); - input_report_abs(input, ABS_Y, 0); - input_report_abs(input, ABS_DISTANCE, 0); - input_report_abs(input, ABS_TILT_X, 0); - input_report_abs(input, ABS_TILT_Y, 0); - if (wacom->tool[idx] >= BTN_TOOL_MOUSE) { - input_report_key(input, BTN_LEFT, 0); - input_report_key(input, BTN_MIDDLE, 0); - input_report_key(input, BTN_RIGHT, 0); - input_report_key(input, BTN_SIDE, 0); - input_report_key(input, BTN_EXTRA, 0); - input_report_abs(input, ABS_THROTTLE, 0); - input_report_abs(input, ABS_RZ, 0); - } else { - input_report_abs(input, ABS_PRESSURE, 0); - input_report_key(input, BTN_STYLUS, 0); - input_report_key(input, BTN_STYLUS2, 0); - input_report_key(input, BTN_TOUCH, 0); - input_report_abs(input, ABS_WHEEL, 0); - if (features->type >= INTUOS3S) - input_report_abs(input, ABS_Z, 0); - } - input_report_key(input, wacom->tool[idx], 0); - input_report_abs(input, ABS_MISC, 0); /* reset tool id */ - input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]); - wacom->id[idx] = 0; + wacom_exit_report(wacom); return 2; } @@ -1226,6 +1236,12 @@ static void wacom_intuos_pro2_bt_pen(str if (!valid) continue; + if (!prox) { + wacom->shared->stylus_in_proximity = false; + wacom_exit_report(wacom); + input_sync(pen_input); + return; + } if (range) { /* Fix rotation alignment: userspace expects zero at left */ int16_t rotation = (int16_t)get_unaligned_le16(&frame[9]);