From patchwork Fri Oct 7 22:16:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 9367721 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 097636075E for ; Fri, 7 Oct 2016 22:18:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF6B92983D for ; Fri, 7 Oct 2016 22:18:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3C0429840; Fri, 7 Oct 2016 22:18:07 +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 91D082983D for ; Fri, 7 Oct 2016 22:18:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757312AbcJGWSG (ORCPT ); Fri, 7 Oct 2016 18:18:06 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:36610 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757419AbcJGWSB (ORCPT ); Fri, 7 Oct 2016 18:18:01 -0400 Received: by mail-qk0-f194.google.com with SMTP id z190so3303274qkc.3 for ; Fri, 07 Oct 2016 15:17:15 -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=COjiwCH6McElTBHm8PVuj9HZmJhgnAvZ6V1AoKwitJI=; b=O+0KXTianVX7iWXqhH3UclDOVgkSPM4fcJ9rM/C1vgQ9vLTDUjL/UfD3W3avTosC5r XPMkaH6DX4CiY1pug5WdTcwZrSM4YSyKzaLNDsYhaMDFO5VDVrZD1OegIkdRCpj3FuiJ /A60ohgSVqLQVsKbplCrL0PfhThnYeJDsrQWn7w8JvZKV9pJrmb5Z9/fCpP5cPLaswCG NR2XxBpNMjrlWdxwxGthzkMtBuj/wmBM0y2Gr9ukj3d4Nyq/rlX3//JELU5J8wGg7lwL DjmC3ukBFSatjxsG/jEF52O58KHbpBDFDtGlZF6mSDiYOzoHSAcajRm20CCkkeEsZ/u7 3Szw== 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=COjiwCH6McElTBHm8PVuj9HZmJhgnAvZ6V1AoKwitJI=; b=YEu6guwIVWSpFCSWbo6tgyPjGS8NmA6OwJ2W2R3b2PmpZo9WXbDfcW/iLmGPcLWYDz GEk9n9fMMv8NMn/TWn2Nh5Ane0NWXGSlZT5KG3qi+oZ0e1s2tyuF67HWYKfNgQxyt3uS t012QH00HqEn8mhWQLIKBya6No9Q2pJcZ58tLNrcn+pbZ9lAJmyAXyOR5hASteHDPS7n qlMZnMZSyfPpfa2vbjpyoxCco9eTXWgO8DyLrHB1Mdd6lPLD6u0Fo4hSagKgGiuQ6iKC dUzy6hY5s01V0Rh1iRu6ITP5tHrPx5SBxqOoOKnPyfetho5BzTuX0tIMWWr0O+pWbWH7 Mi9g== X-Gm-Message-State: AA6/9Rm4jgd/yqWsdFJlXwI0czwtJ81c2YQkrHzYrEUIJwuukFFiv9oheK69btFUlPkwrA== X-Received: by 10.55.201.141 with SMTP id m13mr21088634qkl.66.1475878635394; Fri, 07 Oct 2016 15:17:15 -0700 (PDT) Received: from wacom-arch2.corp.onewacom.com ([50.225.60.4]) by smtp.gmail.com with ESMTPSA id u63sm7633162qkd.16.2016.10.07.15.17.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Oct 2016 15:17:15 -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 v2 08/18] HID: wacom: generic: Add support for vendor-defined "Distance" usage Date: Fri, 7 Oct 2016 15:16:43 -0700 Message-Id: <20161007221653.26941-8-killertofu@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161007221653.26941-1-killertofu@gmail.com> References: <20161006212231.31440-1-killertofu@gmail.com> <20161007221653.26941-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 Reviewed-by: Benjamin Tissoires --- 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)