From patchwork Fri Jun 14 08:56:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tatsunosuke Tobita X-Patchwork-Id: 2720631 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C48D5C0AB1 for ; Fri, 14 Jun 2013 08:56:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A206C20200 for ; Fri, 14 Jun 2013 08:56:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F966201FC for ; Fri, 14 Jun 2013 08:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751268Ab3FNI4v (ORCPT ); Fri, 14 Jun 2013 04:56:51 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:39274 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211Ab3FNI4t (ORCPT ); Fri, 14 Jun 2013 04:56:49 -0400 Received: by mail-pd0-f173.google.com with SMTP id v14so376525pde.18 for ; Fri, 14 Jun 2013 01:56:49 -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:x-mailer; bh=dONFdXIrIHIkg6PwJC8OcYQ804tjOv0VFFSLXG+If9Y=; b=QqAsL63P1CD5dy0QRD/kmTxshckuNs+4YBSploWYR8h4Ky7x0CSfYjRLKyHFfDuaWM l0cNp76KPMVtKch89+fKzkF3laczOrVnFWhyhlI6lt7c3DmKt/mZEyU/5neH7MgrG39A 9uPafBVgn9zC0FZy9fpTA/0kAN/O4lLF9EUXFkVDJCuC9D+AZYyYtA+7rcOTUsN2PuhR 1DdJfROOxSgyWenQTGK+tiuobMJhSfWCAyeB8vOYKTrMsDhYZ57DYVQ64TJ/JeKXfTEe QnvovSsJjTifAabV4Ky09CqQbL1AwnKsHCbLkqwK2dvJtgB8tEW09/gUpYcG6WEm1QgF H7dA== X-Received: by 10.68.179.99 with SMTP id df3mr1518201pbc.198.1371200209202; Fri, 14 Jun 2013 01:56:49 -0700 (PDT) Received: from localhost.localdomain (FLA1Aax035.stm.mesh.ad.jp. [219.107.188.35]) by mx.google.com with ESMTPSA id lq4sm1590087pab.19.2013.06.14.01.56.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Jun 2013 01:56:48 -0700 (PDT) From: Tatsunosuke Tobita To: Cc: Tatsunosuke Tobita Subject: [PATCH] Input: Added hovering capability Date: Fri, 14 Jun 2013 17:56:39 +0900 Message-Id: <1371200199-17718-1-git-send-email-tobita.tatsunosuke@wacom.co.jp> X-Mailer: git-send-email 1.7.9.5 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Tatsunosuke Tobita Although BTN_TOOL_PEN and BTN_TOOL_RUBBER function properly, the driver didn't have hover functionality, so it's been added. Also, I noticed that "WACOM_RETRY_CNT" was not used, so it was removed. Signed-off-by: Tatsunosuke Tobita --- drivers/input/touchscreen/wacom_i2c.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index bf0d076..7ccaa1b 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -1,7 +1,7 @@ /* * Wacom Penabled Driver for I2C * - * Copyright (c) 2011 Tatsunosuke Tobita, Wacom. + * Copyright (c) 2011 - 2013 Tatsunosuke Tobita, Wacom. * * * This program is free software; you can redistribute it @@ -27,7 +27,6 @@ #define WACOM_CMD_THROW0 0x05 #define WACOM_CMD_THROW1 0x00 #define WACOM_QUERY_SIZE 19 -#define WACOM_RETRY_CNT 100 struct wacom_features { int x_max; @@ -40,6 +39,8 @@ struct wacom_i2c { struct i2c_client *client; struct input_dev *input; u8 data[WACOM_QUERY_SIZE]; + bool prox; + int tool; }; static int wacom_query_device(struct i2c_client *client, @@ -112,9 +113,14 @@ static irqreturn_t wacom_i2c_irq(int irq, void *dev_id) y = le16_to_cpup((__le16 *)&data[6]); pressure = le16_to_cpup((__le16 *)&data[8]); + if (!wac_i2c->prox) + wac_i2c->tool = (data[3] & 0x0c) ? + BTN_TOOL_RUBBER : BTN_TOOL_PEN; + + wac_i2c->prox = data[3] & 0x20; + input_report_key(input, BTN_TOUCH, tsw || ers); - input_report_key(input, BTN_TOOL_PEN, tsw); - input_report_key(input, BTN_TOOL_RUBBER, ers); + input_report_key(input, wac_i2c->tool, wac_i2c->prox); input_report_key(input, BTN_STYLUS, f1); input_report_key(input, BTN_STYLUS2, f2); input_report_abs(input, ABS_X, x);