From patchwork Thu Oct 6 21:22:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 9365335 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 B26C06077E for ; Thu, 6 Oct 2016 21:22:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D27A29253 for ; Thu, 6 Oct 2016 21:22:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91F0629256; Thu, 6 Oct 2016 21:22:55 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 3FE5229253 for ; Thu, 6 Oct 2016 21:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935200AbcJFVWy (ORCPT ); Thu, 6 Oct 2016 17:22:54 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:33380 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935190AbcJFVWx (ORCPT ); Thu, 6 Oct 2016 17:22:53 -0400 Received: by mail-qt0-f193.google.com with SMTP id m5so836214qtb.0 for ; Thu, 06 Oct 2016 14:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zZtGkm14a8e+8LoHe/yostsaSwB4Iq62Ii65H1MvEts=; b=Zyt/Z4HKCrKiBsMJfflT32A3aNPdbdEgd08R/g4t7C8MGqI7MutFAr8d/+QJZKtZJy 30Tf0TfjE0azgajebWaNwoJUhxY+P24pGJqKmZpw9enc4SdfyBgK2kME1xyjADGJCilX EfvB1RuLBRh44rpHx+3bKe7ucLMyLXrx1t+vFtW5ML6jg7fb52R+x44zYYuhIuejB8WJ kKHT2ocbR4Gdnvvr0jCmbSw2o521/xNUFFHVFoLXVajuiqjiacG3z8JOldv8ooweOIQh o7qHe1SBrAOeusOvslZeRQFaq7dQ/ot+SeCAvN4UHAZto+C+H5rhmo33tudOvTREJe6t loJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zZtGkm14a8e+8LoHe/yostsaSwB4Iq62Ii65H1MvEts=; b=K0e6NXutTUFR5nIbgWgEQ05228F1Lbn4R8CrR3IPqlT4YR0bpKZLFuPeHXv68JxEfW 352bSuXuSeOXjIzAuoMhIB3LnLk2yGINkHeKcFT97sBYqaJDZFYZ98R4TaPGy+/H7Bfz I3G/y9oEYoJAqoz9L+QHTO+KXYyYXEPJGIl7ysTZrvGbXZk758RYsxLV4k9esEr3CEN6 riI9LurL7UjeUtcZxNDcVg/Ba00snmq2UK9urjkmhzWgN+qxlYNLZVZwxo+Lz5WPLPgt Ey/Y7xr5D5d5dzk606ihb7ESjBxVnOyqSeJ3QC5veCne8GKZvfzbfvPOtvWqRvRFsvnZ vaPw== X-Gm-Message-State: AA6/9RntBDN6tl/Lf0R3pZMFQwWvqlFVjVZIdX8SCIJuHiN9EJJpyJNjPhWblQ7dx2i2GA== X-Received: by 10.200.47.61 with SMTP id j58mr16080091qta.106.1475788972985; Thu, 06 Oct 2016 14:22:52 -0700 (PDT) Received: from wacom-arch2.corp.onewacom.com ([50.225.60.4]) by smtp.gmail.com with ESMTPSA id m4sm5773714qkf.29.2016.10.06.14.22.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Oct 2016 14:22:52 -0700 (PDT) From: Jason Gerecke To: linux-input@vger.kernel.org, Jiri Kosina Cc: Benjamin Tissoires , Ping Cheng , Ping Cheng , Aaron Skomra , Jason Gerecke , Jason Gerecke Subject: [PATCH 08/19] HID: wacom: generic: Add support for vendor-defined "Distance" usage Date: Thu, 6 Oct 2016 14:22:20 -0700 Message-Id: <20161006212231.31440-9-killertofu@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161006212231.31440-1-killertofu@gmail.com> References: <20161006212231.31440-1-killertofu@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 The vendor-defined 0xFF0D01032 ("Distance") usage is nearly equivalent to HID_GD_Z, except that the axis direction is inverted. Unlike HID_GD_Z which increases in value as the pen-to-surface distance is decreased, this usage decreases. Treat this usage as a special case to ensure we don't invert the scale to be ABS_DISTANCE compatible like we do for HID_GD_Z. Signed-off-by: Jason Gerecke --- drivers/hid/wacom_wac.c | 4 +++- drivers/hid/wacom_wac.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index edc2c14..aa51684 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1442,7 +1442,8 @@ static int wacom_equivalent_usage(int usage) int subusage = (usage & 0xFF); if (subpage == WACOM_HID_SP_DIGITIZER || - subpage == WACOM_HID_SP_DIGITIZERINFO) { + subpage == WACOM_HID_SP_DIGITIZERINFO || + usage == WACOM_HID_WD_DISTANCE) { return usage; } @@ -1502,6 +1503,7 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, case HID_GD_Y: wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4); break; + case WACOM_HID_WD_DISTANCE: case HID_GD_Z: wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0); break; diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index c82233d..1ced6e4 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -88,6 +88,7 @@ #define WACOM_HID_SP_DIGITIZER 0x000d0000 #define WACOM_HID_SP_DIGITIZERINFO 0x00100000 #define WACOM_HID_WD_DIGITIZER (WACOM_HID_UP_WACOMDIGITIZER | 0x01) +#define WACOM_HID_WD_DISTANCE (WACOM_HID_UP_WACOMDIGITIZER | 0x0132) #define WACOM_HID_WD_DATAMODE (WACOM_HID_UP_WACOMDIGITIZER | 0x1002) #define WACOM_HID_UP_G9 0xff090000 #define WACOM_HID_G9_PEN (WACOM_HID_UP_G9 | 0x02)