From patchwork Tue Mar 6 18:48:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Armstrong Skomra X-Patchwork-Id: 10262405 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 144AD6016D for ; Tue, 6 Mar 2018 18:50:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 057F0290B6 for ; Tue, 6 Mar 2018 18:50:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0446729145; Tue, 6 Mar 2018 18:50: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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 AFEFA290B6 for ; Tue, 6 Mar 2018 18:50:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754039AbeCFSux (ORCPT ); Tue, 6 Mar 2018 13:50:53 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:34397 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753936AbeCFSux (ORCPT ); Tue, 6 Mar 2018 13:50:53 -0500 Received: by mail-pl0-f66.google.com with SMTP id u13-v6so12360944plq.1 for ; Tue, 06 Mar 2018 10:50:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QaypFaHCDa/9bkISMqrBJJfXBNkZyC0GjHZ/1zUWZrg=; b=Z6m8xUwL906zclT4R5blvL3jECNic//hlCjYpBmoS3lC3VDmo+m/GdBw5huYRAPeDd WodNHyuPNDVwrWdE1f32Vifl8UMxlsHZhqoGncyR5LH8kdtsMFAEYGCXOQ1IRseQI8ND qY2Taw9CsXYjl0K9wjhOWyToMTPFuoYuSF/2Va6x6aDR6WooaEf35kt7HZQL4rYMnr5m XEEtirkPPHoJCd0ETfg1MaBHW+GP9UBrfqJZJPBnJmtBJ/ttUz/+aIVLKAF0geJM1DRp f9nqUfPrJUN3858NGXyMMTzq7eFOi6sw7ukQKHaKkz/sXeEbT2ttqjHX2kGIWmKPA8pz x/aA== 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:in-reply-to :references; bh=QaypFaHCDa/9bkISMqrBJJfXBNkZyC0GjHZ/1zUWZrg=; b=MFEEKbNJV5HUCyB/mCaPCSZrlR47fAlLVmMXGQx7tgD7Mxld7MGsG4UhudGPN3S8vC FzolocaMZp8HnzHl1oYc8Q9IXrmMTSW4/4FT5gG2F0a+LgohS1taF/dRY3CuzIDiJAiv 1IuPK92pqDC4WCWgJru6OVAMhiEvCRB53lUWou+ihwDvJmrjigSjC5I3C70hkSpF+/Y9 SgWsJGDVjNhtbZ+fkgsQstL8yvIYW8OhN7uuji6CktI005E6s7dm5gekTAUxZUnggdiA n4KMgm7zHw0zJ3Mm55NKE4m20fV2iq3yuCFhm6EPZumgqukR5wSZQJ1whX6eVNQhXaMG d2vg== X-Gm-Message-State: APf1xPDXxU36vlKq7RTy85cqtS1ROuEs7FufTAjDxfdKAxLecy9laTZW b+TfFcwgzjs/B6xsm830cZinlQ== X-Google-Smtp-Source: AG47ELvozXONwj4Bn2P15PURy4JRHCERq9/gctG/rflTTXZuzx2qamNzMA3IilkvBXO118CIaJh4rg== X-Received: by 2002:a17:902:822:: with SMTP id 31-v6mr17835784plk.362.1520362252167; Tue, 06 Mar 2018 10:50:52 -0800 (PST) Received: from juhua.Home (184-100-226-242.ptld.qwest.net. [184.100.226.242]) by smtp.googlemail.com with ESMTPSA id l2sm25503469pgu.46.2018.03.06.10.50.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Mar 2018 10:50:50 -0800 (PST) From: Aaron Armstrong Skomra To: linux-input@vger.kernel.org, pinglinux@gmail.com, killertofu@gmail.com, jkosina@suse.cz Cc: Aaron Armstrong Skomra Subject: [PATCH 3/3] HID: wacom: generic: add the "Report Valid" usage Date: Tue, 6 Mar 2018 10:48:35 -0800 Message-Id: <1520362115-21431-3-git-send-email-skomra@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520362115-21431-1-git-send-email-skomra@gmail.com> References: <1520362115-21431-1-git-send-email-skomra@gmail.com> 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 Wacom Bluetooth reports contain multiple pen frames per report. Each frame contains a flag indicating if the frame is valid. Future Wacom devices with this type of report may contain HID descriptors, add support for this usage to the generic codepath of the Wacom driver. Signed-off-by: Aaron Armstrong Skomra Reviewed-by: Ping Cheng Reviewed-by: Jason Gerecke --- drivers/hid/wacom_wac.c | 16 +++++++++++++++- drivers/hid/wacom_wac.h | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 7a0a7f67e7ed..afa8c9f24a42 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1715,7 +1715,8 @@ int wacom_equivalent_usage(int usage) usage == WACOM_HID_WD_TOUCHSTRIP || usage == WACOM_HID_WD_TOUCHSTRIP2 || usage == WACOM_HID_WD_TOUCHRING || - usage == WACOM_HID_WD_TOUCHRINGSTATUS) { + usage == WACOM_HID_WD_TOUCHRINGSTATUS || + usage == WACOM_HID_WD_REPORT_VALID) { return usage; } @@ -2199,6 +2200,9 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field struct input_dev *input = wacom_wac->pen_input; unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); + if (wacom_wac->is_invalid_bt_frame) + return; + switch (equivalent_usage) { case HID_GD_Z: /* @@ -2295,6 +2299,9 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field features->offset_bottom); features->offset_bottom = value; return; + case WACOM_HID_WD_REPORT_VALID: + wacom_wac->is_invalid_bt_frame = !value; + return; } /* send pen events only when touch is up or forced out @@ -2313,6 +2320,10 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field static void wacom_wac_pen_pre_report(struct hid_device *hdev, struct hid_report *report) { + struct wacom *wacom = hid_get_drvdata(hdev); + struct wacom_wac *wacom_wac = &wacom->wacom_wac; + + wacom_wac->is_invalid_bt_frame = false; return; } @@ -2325,6 +2336,9 @@ static void wacom_wac_pen_report(struct hid_device *hdev, bool range = wacom_wac->hid_data.inrange_state; bool sense = wacom_wac->hid_data.sense_state; + if (wacom_wac->is_invalid_bt_frame) + return; + if (!wacom_wac->tool[0] && range) { /* first in range */ /* Going into range select tool */ if (wacom_wac->hid_data.invert_state) diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index 827d8fc4a3f2..295fd3718caa 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -118,6 +118,7 @@ #define WACOM_HID_WD_TOUCHSTRIP2 (WACOM_HID_UP_WACOMDIGITIZER | 0x0137) #define WACOM_HID_WD_TOUCHRING (WACOM_HID_UP_WACOMDIGITIZER | 0x0138) #define WACOM_HID_WD_TOUCHRINGSTATUS (WACOM_HID_UP_WACOMDIGITIZER | 0x0139) +#define WACOM_HID_WD_REPORT_VALID (WACOM_HID_UP_WACOMDIGITIZER | 0x01d0) #define WACOM_HID_WD_ACCELEROMETER_X (WACOM_HID_UP_WACOMDIGITIZER | 0x0401) #define WACOM_HID_WD_ACCELEROMETER_Y (WACOM_HID_UP_WACOMDIGITIZER | 0x0402) #define WACOM_HID_WD_ACCELEROMETER_Z (WACOM_HID_UP_WACOMDIGITIZER | 0x0403) @@ -353,7 +354,7 @@ struct wacom_wac { bool has_mute_touch_switch; bool has_mode_change; bool is_direct_mode; - + bool is_invalid_bt_frame; }; #endif