From patchwork Wed Nov 19 00:50:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 5333921 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CD4F49F3ED for ; Wed, 19 Nov 2014 00:50:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA2FC20176 for ; Wed, 19 Nov 2014 00:50:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E0D520127 for ; Wed, 19 Nov 2014 00:50:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754575AbaKSAu2 (ORCPT ); Tue, 18 Nov 2014 19:50:28 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:38651 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754456AbaKSAu1 (ORCPT ); Tue, 18 Nov 2014 19:50:27 -0500 Received: by mail-pa0-f47.google.com with SMTP id kq14so6697299pab.6 for ; Tue, 18 Nov 2014 16:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=cplDQ6seDeI/vb8sokQqPJzR9134enlQvEuipPP3XJc=; b=nEQ8/jjOsZHwhQ0iXPjNKzmCdLq2KFJBKqOGdpMJjDnRUR4XjMSrZeoR/KQNadP35m 1Zi0L0Bmu3WyqvQUq0NQML0D5iueNWR5uwqsHYSby1gtBC4ppuXGNCcNusRTOXskQgW0 bOHmeSSQxuiVYfamKOZbGf28+bKCR4cIG+brM/TxOmMoDgiaYXjs+XlZwn+lJZT3CZjW V4OhgYP7VMrp12j2UiAXPXlZpRDW7g9jePQxK1m+/M+J4avDt+xjWE57+CrVFKqkdYlv w3YcQjVsH4b1VXmUESO7n+xCAcY4ZZSoSzn6sMYc5qZxJMxa/pYpc1ZSlRTBwrH+cGQp FXjg== X-Received: by 10.68.183.193 with SMTP id eo1mr5876959pbc.168.1416358227305; Tue, 18 Nov 2014 16:50:27 -0800 (PST) Received: from wacom-arch2.localdomain ([67.51.163.2]) by mx.google.com with ESMTPSA id s5sm47905pdc.52.2014.11.18.16.50.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Nov 2014 16:50:25 -0800 (PST) From: Jason Gerecke To: jkosina@suse.cz Cc: linux-input@vger.kernel.org, pinglinux@gmail.com, benjamin.tissores@gmail.com, Jason Gerecke Subject: [PATCH 1/2] HID: wacom: Report ABS_TILT_{X,Y} as signed values Date: Tue, 18 Nov 2014 16:50:08 -0800 Message-Id: <1416358209-3937-1-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 2.1.3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Centers the ABS_TILT_{X,Y} axes so that a value of zero is reported when the pen is vertical. Combined with resolution information in the next patch, this makes it possible for userspace to calculate the pen angle without needing hardware-specific knowledge. The xf86-input-wacom driver was updated to support signed tilt values in late-2012 (2f2acec). Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng for the series. --- drivers/hid/wacom_wac.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 8a83da9..525b648 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -600,8 +600,8 @@ static void wacom_intuos_general(struct wacom_wac *wacom) } input_report_abs(input, ABS_PRESSURE, t); input_report_abs(input, ABS_TILT_X, - ((data[7] << 1) & 0x7e) | (data[8] >> 7)); - input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f); + (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); + input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); input_report_key(input, BTN_STYLUS, data[1] & 2); input_report_key(input, BTN_STYLUS2, data[1] & 4); input_report_key(input, BTN_TOUCH, t > 10); @@ -612,8 +612,8 @@ static void wacom_intuos_general(struct wacom_wac *wacom) input_report_abs(input, ABS_WHEEL, (data[6] << 2) | ((data[7] >> 6) & 3)); input_report_abs(input, ABS_TILT_X, - ((data[7] << 1) & 0x7e) | (data[8] >> 7)); - input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f); + (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); + input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); } } @@ -915,8 +915,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) input_report_key(input, BTN_EXTRA, data[6] & 0x10); input_report_abs(input, ABS_TILT_X, - ((data[7] << 1) & 0x7e) | (data[8] >> 7)); - input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f); + (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64); + input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64); } else { /* 2D mouse packet */ input_report_key(input, BTN_LEFT, data[8] & 0x04); @@ -1926,8 +1926,8 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features.distance_max, 0, 0); input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); - input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); - input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0); + input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, 0, 0); + input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, 0, 0); } static void wacom_setup_intuos(struct wacom_wac *wacom_wac)