From patchwork Mon Nov 17 21:45:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 5323821 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 D4E8B9F2ED for ; Mon, 17 Nov 2014 21:46:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0004320125 for ; Mon, 17 Nov 2014 21:46:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11EDE20120 for ; Mon, 17 Nov 2014 21:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751499AbaKQVqJ (ORCPT ); Mon, 17 Nov 2014 16:46:09 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:59947 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464AbaKQVqI (ORCPT ); Mon, 17 Nov 2014 16:46:08 -0500 Received: by mail-pa0-f44.google.com with SMTP id et14so8274194pad.17 for ; Mon, 17 Nov 2014 13:46:06 -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=2Tzn5s97k156pBupKl8ayF77QjcmL8yAnhA7wzyfa38=; b=MbUjxhtQSXoLWO2C1RnUlFws34g1c4QfYRaZVvaUlY/LEV7HodkQfGTScPOu6bsG3Y LslABxD1vVH0v5wHffdS9ZRvxGtD1OZlAx3xcQ8r3D4krm72kLzoHXrTBgLHK9wf9CYS oOJQBa+oNJZJX+g1cl5Pc8Qpsm3gskWBlyWHwO51KgxfaANoi8Os2ERAEWjQuJcM4VId 2/T0QV4YMN0MM/v6AH3rY+q6Ea4qmRJukPf/COdeHO978vwwc8bSWczwp9VHMGbI83n+ q8kfkTNjv6fF5dqAZ9tiG66KzUdP9Ba7iTKBrZbmLndByv2pkCmbkTkhslUwv6yHUon9 wPkg== X-Received: by 10.66.161.197 with SMTP id xu5mr31552789pab.3.1416260766606; Mon, 17 Nov 2014 13:46:06 -0800 (PST) Received: from wacom-XPS-8500.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id xd3sm6332086pbc.54.2014.11.17.13.46.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Nov 2014 13:46:05 -0800 (PST) From: Ping Cheng X-Google-Original-From: Ping Cheng To: jkosina@suse.cz Cc: linux-input@vger.kernel.org, Ping Cheng Subject: [PATCH] HID: wacom - Bamboo pen only tablet does not support PAD Date: Mon, 17 Nov 2014 13:45:55 -0800 Message-Id: <1416260755-13635-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. We should not rely on that description to decide touch_max for them. Plus, no Bamboo device supports single touch. Signed-off-by: Ping Cheng --- drivers/hid/wacom_sys.c | 4 ++-- drivers/hid/wacom_wac.c | 30 ++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 8593047..46147b4 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -192,8 +192,8 @@ 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 */ + if (finger && !features->touch_max && (features->type != BAMBOO_PT)) + /* ISDv4 touch devices at least supports one touch point */ features->touch_max = 1; switch (usage->hid) { diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 586b240..fc9b492 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2402,7 +2402,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, case INTUOSPS: /* touch interface does not have the pad device */ if (features->device_type != BTN_TOOL_PEN) - return 1; + goto no_pad; for (i = 0; i < 7; i++) __set_bit(BTN_0 + i, input_dev->keybit); @@ -2447,22 +2447,36 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, case BAMBOO_PT: /* pad device is on the touch interface */ if (features->device_type != BTN_TOOL_FINGER) - return 1; + goto no_pad; __clear_bit(ABS_MISC, input_dev->absbit); - __set_bit(BTN_LEFT, input_dev->keybit); - __set_bit(BTN_FORWARD, input_dev->keybit); - __set_bit(BTN_BACK, input_dev->keybit); - __set_bit(BTN_RIGHT, input_dev->keybit); + /* Bamboo Pen only tablet does not have pad */ + if ((features->type != BAMBOO_PT) || + ((features->type == BAMBOO_PT) && features->touch_max)) { + __set_bit(BTN_LEFT, input_dev->keybit); + __set_bit(BTN_FORWARD, input_dev->keybit); + __set_bit(BTN_BACK, input_dev->keybit); + __set_bit(BTN_RIGHT, input_dev->keybit); + } else + goto no_pad; break; default: - /* no pad supported */ - return 1; + goto no_pad; } return 0; + +no_pad: + input_dev->evbit[0] &= ~BIT_MASK(EV_KEY) & ~BIT_MASK(EV_ABS); + __clear_bit(ABS_MISC, input_dev->absbit); + __clear_bit(ABS_X, input_dev->absbit); + __clear_bit(ABS_Y, input_dev->absbit); + __clear_bit(BTN_STYLUS, input_dev->keybit); + + return 1; + } static const struct wacom_features wacom_features_0x00 =