From patchwork Wed Oct 10 20:40:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gerecke X-Patchwork-Id: 10635233 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 285A346E4 for ; Wed, 10 Oct 2018 20:40:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BAED2ACFC for ; Wed, 10 Oct 2018 20:40:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F1F32AD1F; Wed, 10 Oct 2018 20:40:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B99782ACFC for ; Wed, 10 Oct 2018 20:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725822AbeJKEEn (ORCPT ); Thu, 11 Oct 2018 00:04:43 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:39606 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbeJKEEn (ORCPT ); Thu, 11 Oct 2018 00:04:43 -0400 Received: by mail-pl1-f196.google.com with SMTP id w14-v6so3070695plp.6; Wed, 10 Oct 2018 13:40:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=J4WQHKB7QFZJ9qt0LeMNiXu6V93DNolIFAMjZteNNow=; b=b8N4LbTllschNq81Qu7UvMyCJnuO122OR5AIErCAEfOp2o+3rrLPM9f+D4nB25J9Ox HGN+usFXemH2onhL4MzwMlAJj5ForZjmavKX7PWuYfA+uX8zaR8CjMv0b3zp1cSRcAIx vb/v8Fe5jXgvPZz6nShjwr0D5NB8Qa0n/hMPxg5/lG7zkPPdrX8FzAsQ6CMEQ8W6/T/W rQEKrL2dOtKh2CME0w3UfWvlUxg3zBiukvKrKHC1mDIjjDl+TwJbuyQ34iEIDlcVuZqi SwkirbKZ9xItE+jwEic73F6NMc9qklB2/S7G9I3YeNYLgHsouP2KWlSzNbENknr6ck2G 36Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=J4WQHKB7QFZJ9qt0LeMNiXu6V93DNolIFAMjZteNNow=; b=d+7JYP0JX6JlJ2O6Pm5XYKwz/O4GVJ2ZzcRt6Z29kZYXwG2Guouqaulj+i9++F61Eh 25k4qHKd+SwO1mDAk8/YwW6HZrW8qewfxv9sPT9uX4KC07kLveu3KxPIbX+hl4oI+6bN l0LcK2NNpLKgVfl9Hr8C9kkDOHVzUhJp/W13vG0wP8Ka6EcX9M6hgynFkIIT2QsjyIUZ Z3hCP/s6AttENG54raJLEgXCsC4WYePXUWqEN5ukMHqh88p9SFumcpWIwp6Zyvx/JXd9 QoKBw5oplPr/pujbKqxRQSBX2OAx6mlnVB91CSryK8mR6OkWNH7YDf+vRxHlkHhKXwlH WkVA== X-Gm-Message-State: ABuFfogVaTXOg5NdC6r8lqiWQgkT+ahHwXesEKeZJiedzCmgFUIKzlMg KrPbIqu5j4TDrbsMdvCa/IQo6jpA X-Google-Smtp-Source: ACcGV61poZXshmn7xPl4ASTtDYuOPUIWAtwiD6FgAXEqsNpoIAR1KbtR4+TWk0ja8i29ymr2g/oaTA== X-Received: by 2002:a17:902:7007:: with SMTP id y7-v6mr124817plk.185.1539204051794; Wed, 10 Oct 2018 13:40:51 -0700 (PDT) Received: from wacom-arch2.corp.onewacom.com ([50.225.60.4]) by smtp.gmail.com with ESMTPSA id c124-v6sm39917723pfa.119.2018.10.10.13.40.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 13:40:50 -0700 (PDT) From: Jason Gerecke To: linux-input@vger.kernel.org, Jiri Kosina , Benjamin Tissoires , Ping Cheng Cc: Jason Gerecke , Jason Gerecke , stable@vger.kernel.org Subject: [PATCH] HID: wacom: Work around HID descriptor bug in DTK-2451 and DTH-2452 Date: Wed, 10 Oct 2018 13:40:26 -0700 Message-Id: <20181010204026.4555-1-killertofu@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The DTK-2451 and DTH-2452 have a buggy HID descriptor which incorrectly contains a Cintiq-like report, complete with pen tilt, rotation, twist, serial number, etc. The hardware doesn't actually support this data but our driver duitifully sets up the device as though it does. To ensure userspace has a correct view of devices without updated firmware, we clean up this incorrect data in wacom_setup_device_quirks. We're also careful to clear the WACOM_QUIRK_TOOLSERIAL flag since its presence causes the driver to wait for serial number information (via wacom_wac_pen_serial_enforce) that never comes, resulting in the pen being non-responsive. Signed-off-by: Jason Gerecke Fixes: 8341720642 ("HID: wacom: Queue events with missing type/serial data for later processing") Cc: stable@vger.kernel.org # v4.16+ --- drivers/hid/wacom_wac.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index e0a06be5ef5c..b4b4a30e3982 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -3335,6 +3335,7 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac) void wacom_setup_device_quirks(struct wacom *wacom) { + struct wacom_wac *wacom_wac = &wacom->wacom_wac; struct wacom_features *features = &wacom->wacom_wac.features; /* The pen and pad share the same interface on most devices */ @@ -3464,6 +3465,25 @@ void wacom_setup_device_quirks(struct wacom *wacom) if (features->type == REMOTE) features->device_type |= WACOM_DEVICETYPE_WL_MONITOR; + + /* HID descriptor for DTK-2451 / DTH-2452 claims to report lots + * of things it shouldn't. Lets fix up the damage... + */ + if (wacom->hdev->product == 0x382 || wacom->hdev->product == 0x37d) { + features->quirks &= ~WACOM_QUIRK_TOOLSERIAL; + __clear_bit(BTN_TOOL_BRUSH, wacom_wac->pen_input->keybit); + __clear_bit(BTN_TOOL_PENCIL, wacom_wac->pen_input->keybit); + __clear_bit(BTN_TOOL_AIRBRUSH, wacom_wac->pen_input->keybit); + __clear_bit(ABS_Z, wacom_wac->pen_input->absbit); + __clear_bit(ABS_DISTANCE, wacom_wac->pen_input->absbit); + __clear_bit(ABS_TILT_X, wacom_wac->pen_input->absbit); + __clear_bit(ABS_TILT_Y, wacom_wac->pen_input->absbit); + __clear_bit(ABS_WHEEL, wacom_wac->pen_input->absbit); + __clear_bit(ABS_MISC, wacom_wac->pen_input->absbit); + __clear_bit(MSC_SERIAL, wacom_wac->pen_input->mscbit); + __clear_bit(EV_MSC, wacom_wac->pen_input->evbit); + } } int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, -- 2.19.1