From patchwork Tue Nov 18 21:29:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 5333371 X-Patchwork-Delegate: jikos@jikos.cz 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 557F7C11AC for ; Tue, 18 Nov 2014 21:29:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EB1D20125 for ; Tue, 18 Nov 2014 21:29:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3AAD4201CD for ; Tue, 18 Nov 2014 21:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932165AbaKRV32 (ORCPT ); Tue, 18 Nov 2014 16:29:28 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36142 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932079AbaKRV31 (ORCPT ); Tue, 18 Nov 2014 16:29:27 -0500 Received: by mail-pa0-f46.google.com with SMTP id lj1so1157699pab.19 for ; Tue, 18 Nov 2014 13:29: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=/D1mA6x8zjpOScFyLTExnnSf4ykyCCvdSaagD9redaY=; b=xI8nlREjsbtrAzZOdWbvREPhBMx2pZEE/0JXXHtk6bo6Ka9GDRN/XYZG+c6RiUQc2h BYJtNDBIY/phMRnJmNS/uliFxvZCnRyhEeo9TmO+78WtyvITnIxXBqgw6HHJI5DeD5Xd EtLq74xHQeqesyD0lQYXj+KrjdiFB9weYKm9lofTbG8n767nsO/676PMyD3ZCcFHyigN lQsN9it1mck/vGc8GFN2ogwqlGViG7A3nFucBS1jaQcDRTOQLLJFe7LQTijsaJxV0gOi VoTW9So9f7am8RhSX/Alf0cIff0yGi2kvWltXrXy2fA8aAS6TLVIZ8orDHq4J4Ti33uq OI2Q== X-Received: by 10.66.222.231 with SMTP id qp7mr40222154pac.39.1416346167505; Tue, 18 Nov 2014 13:29:27 -0800 (PST) Received: from wacom-XPS-8500.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id of9sm38760527pbc.6.2014.11.18.13.29.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Nov 2014 13:29:26 -0800 (PST) From: Ping Cheng X-Google-Original-From: Ping Cheng To: jkosina@suse.cz Cc: linux-input@vger.kernel.org, benjamin.tissoires@gmail.com, Ping Cheng Subject: [PATCH 3/3] HID: wacom - Bamboo pen-only tablet does not support PAD Date: Tue, 18 Nov 2014 13:29:16 -0800 Message-Id: <1416346156-11346-1-git-send-email-pingc@wacom.com> X-Mailer: git-send-email 1.9.1 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 Bamboo models do not support HID_DG_CONTACTMAX. Plus, Bamboo pen-only has touch descriptor. This leads to some complications in the code. This patch also fixes duplicated PAD interfeaces for Intuos Pen models. Signed-off-by: Ping Cheng Reviewed-by: Benjamin Tissoires --- v2: updated with Benjamin's comments --- drivers/hid/wacom.h | 2 +- drivers/hid/wacom_sys.c | 25 +++++++++++++++---------- drivers/hid/wacom_wac.c | 9 +++++++-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/hid/wacom.h b/drivers/hid/wacom.h index 0cc5344..7db4328 100644 --- a/drivers/hid/wacom.h +++ b/drivers/hid/wacom.h @@ -140,7 +140,7 @@ extern const struct hid_device_id wacom_ids[]; void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); void wacom_setup_device_quirks(struct wacom_features *features); -int wacom_setup_input_capabilities(struct input_dev *input_dev, +int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, struct wacom_wac *wacom_wac); int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, struct wacom_wac *wacom_wac); diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 8593047..68b6cd6 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -192,9 +192,15 @@ static void wacom_usage_mapping(struct hid_device *hdev, if (!pen && !finger) return; - if (finger && !features->touch_max) - /* touch device at least supports one touch point */ - features->touch_max = 1; + /* + * Bamboo models do not support HID_DG_CONTACTMAX. + * And, Bamboo Pen only descriptor contains touch. + */ + if (features->type != BAMBOO_PT) { + /* ISDv4 touch devices at least supports one touch point */ + if (finger && !features->touch_max) + features->touch_max = 1; + } switch (usage->hid) { case HID_GD_X: @@ -1151,13 +1157,12 @@ static int wacom_register_inputs(struct wacom *wacom) if (!input_dev || !pad_input_dev) return -EINVAL; - error = wacom_setup_input_capabilities(input_dev, wacom_wac); - if (error) - return error; - - error = input_register_device(input_dev); - if (error) - return error; + error = wacom_setup_pentouch_input_capabilities(input_dev, wacom_wac); + if (!error) { + error = input_register_device(input_dev); + if (error) + return error; + } error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); if (error) { diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 792569c..6bed92c 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2029,7 +2029,7 @@ static void wacom_abs_set_axis(struct input_dev *input_dev, } } -int wacom_setup_input_capabilities(struct input_dev *input_dev, +int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev, struct wacom_wac *wacom_wac) { struct wacom_features *features = &wacom_wac->features; @@ -2243,6 +2243,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, __clear_bit(ABS_X, input_dev->absbit); __clear_bit(ABS_Y, input_dev->absbit); __clear_bit(BTN_TOUCH, input_dev->keybit); + + /* PAD is setup by wacom_setup_pad_input_capabilities later */ + return 1; } } else if (features->device_type == BTN_TOOL_PEN) { __set_bit(INPUT_PROP_POINTER, input_dev->propbit); @@ -2441,7 +2444,9 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, case INTUOSHT: case BAMBOO_PT: /* pad device is on the touch interface */ - if (features->device_type != BTN_TOOL_FINGER) + if ((features->device_type != BTN_TOOL_FINGER) || + /* Bamboo Pen only tablet does not have pad */ + ((features->type == BAMBOO_PT) && !features->touch_max)) return -ENODEV; __clear_bit(ABS_MISC, input_dev->absbit);