From patchwork Fri Mar 6 19:47:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 5957631 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B25D59F380 for ; Fri, 6 Mar 2015 19:48:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D059220263 for ; Fri, 6 Mar 2015 19:48:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 214CE2038D for ; Fri, 6 Mar 2015 19:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755716AbbCFTsF (ORCPT ); Fri, 6 Mar 2015 14:48:05 -0500 Received: from mail-pd0-f170.google.com ([209.85.192.170]:43539 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755190AbbCFTsE (ORCPT ); Fri, 6 Mar 2015 14:48:04 -0500 Received: by pdjp10 with SMTP id p10so40311608pdj.10 for ; Fri, 06 Mar 2015 11:48:04 -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:in-reply-to:references; bh=dYC2kc4Ta88Xq07QbiyBjI465LHxLBbpSdqkVGtyfdM=; b=bXsI5d1ZukkZ9y0F8d6GTVMKulrZnjUf4lI/4Vv5XQ6gjJI5v3pUdmWYrYXRWIYHCb c6KYmyyQdDDJdIwMhNOctCj36nIUuXrrwoK9pJjIffo94FjjDAO/eyVPqq+BEotSuwpt h+QTEzeg4SG/NRc+szDEfVfmdx2a0EKrPD04fvlayNX5/7wRPyp2VsWi0+4LAQxFdWPk YW8SK8QaXgLGAGHwNH+R0yQG6wZOVIskscQR9wNEi3uGlnwZsS4gm9Oau7xCCkh3VYv6 8hldvGvXqL3Mbnyfifq64qIjnoYKxqqrULMCm2ZJSXazAFSyGK0gThtyYGSUVqrnz3U9 Q7Tg== X-Received: by 10.68.57.200 with SMTP id k8mr27816914pbq.163.1425671284307; Fri, 06 Mar 2015 11:48:04 -0800 (PST) Received: from wacom-arch2.localdomain ([67.51.163.2]) by mx.google.com with ESMTPSA id gf2sm2367452pbc.60.2015.03.06.11.48.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Mar 2015 11:48:03 -0800 (PST) From: Jason Gerecke To: jkosina@suse.cz, linux-input@vger.kernel.org Cc: pinglinux@gmail.com, benjamin.tissoires@redhat.com, Jason Gerecke Subject: [PATCH 1/7] HID: wacom: Move handling of Intuos status packets to seperate function Date: Fri, 6 Mar 2015 11:47:38 -0800 Message-Id: <1425671264-4944-8-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1425671264-4944-1-git-send-email-killertofu@gmail.com> References: <1425671264-4944-1-git-send-email-killertofu@gmail.com> 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 In addition to the touchswitch state for "Intuos", these packets are also sent by the Intuos Pro, Intuos5, and last-generation Bamboo tablets when using a wired connection. They contain, among other things, information about the optional wireless module and battery charge state (to be supported in subsuquent patches). Signed-off-by: Jason Gerecke --- drivers/hid/wacom_wac.c | 36 +++++++++++++++++++++++------------- drivers/hid/wacom_wac.h | 1 + 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index bbf72f9..cb308c5 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1740,20 +1740,9 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) unsigned char *data = wacom->data; int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0; - if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_USB) + if (data[0] != WACOM_REPORT_PENABLED) return 0; - if (data[0] == WACOM_REPORT_USB) { - if (features->type == INTUOSHT && - wacom->shared->touch_input && - features->touch_max) { - input_report_switch(wacom->shared->touch_input, - SW_MUTE_DEVICE, data[8] & 0x40); - input_sync(wacom->shared->touch_input); - } - return 0; - } - prox = (data[1] & 0x20) == 0x20; /* @@ -1960,6 +1949,24 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) return 0; } +static int wacom_status_irq(struct wacom_wac *wacom_wac, size_t len) +{ + struct wacom_features *features = &wacom_wac->features; + unsigned char *data = wacom_wac->data; + + if (data[0] != WACOM_REPORT_USB) + return 0; + + if (features->type == INTUOSHT && + wacom_wac->shared->touch_input && + features->touch_max) { + input_report_switch(wacom_wac->shared->touch_input, + SW_MUTE_DEVICE, data[8] & 0x40); + input_sync(wacom_wac->shared->touch_input); + } + return 0; +} + void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) { bool sync; @@ -2044,7 +2051,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) case BAMBOO_PT: case INTUOSHT: - sync = wacom_bpt_irq(wacom_wac, len); + if (wacom_wac->data[0] == WACOM_REPORT_USB) + sync = wacom_status_irq(wacom_wac, len); + else + sync = wacom_bpt_irq(wacom_wac, len); break; case BAMBOO_PAD: diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index a3d0828..ee6a545 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -71,6 +71,7 @@ #define WACOM_REPORT_USB 192 #define WACOM_REPORT_BPAD_PEN 3 #define WACOM_REPORT_BPAD_TOUCH 16 +#define WACOM_PKGLEN_STATUS 10 /* device quirks */ #define WACOM_QUIRK_MULTI_INPUT 0x0001