From patchwork Thu Jan 24 19:09:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 10779869 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 7726391E for ; Thu, 24 Jan 2019 19:10:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C2CE30A1E for ; Thu, 24 Jan 2019 19:10:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10AB130AEF; Thu, 24 Jan 2019 19:10:08 +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 98AEA30A41 for ; Thu, 24 Jan 2019 19:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726825AbfAXTKH (ORCPT ); Thu, 24 Jan 2019 14:10:07 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41185 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbfAXTKG (ORCPT ); Thu, 24 Jan 2019 14:10:06 -0500 Received: by mail-pl1-f194.google.com with SMTP id u6so3315840plm.8 for ; Thu, 24 Jan 2019 11:10:06 -0800 (PST) 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=hGoZbY340cb9WG6bQ46cKxAomQOG02avf2/GFGKAttA=; b=N16lqKstgiPn02XdzPyVU7bBH+3rWmjn4UbuJMYPzL/XWUhjJEOAc8J1RbjaFaJrN2 zNkrKTRcl2mIJ3KMVXTwYUWiLZiBaRb1g6x0X6+FhTcQJ9lZgEIQ1iPGCMdo92hd0nij K2OB4vOtxw3BppeVeFnljPxehCrnNbz911hnH/5elc1Lxk5MkrJkgSbosB/FOiRjdrpI rnljRN/MWecTK+aj6c/QT4NNt39Zdlao1r+eSTgIFRiCqxUBq5Ghora3xnATO1Ym3v1W Qd+BTAV6PdZp18+4Y30xw6TkEqIOogVs4mbpNEUYsLRFRBRVyFdxsu0LFxCDUFMgAhbh r2cA== 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=hGoZbY340cb9WG6bQ46cKxAomQOG02avf2/GFGKAttA=; b=Os1iXdYS3FdpiJ9f3Io6zYjxzy83E1vtwvbZQNWTnaZyXfL4xudIxihUXAClD5cjv3 VW8IvvgE/4QMcuHrICY207ivYeDemoaBx9GqFGe+86m6INrqdhmGQDi8B3KpI/4xFNbm hoCqMxv5bYRniuo2PuSnk8lJq3HCzRHz4fCS3/IK3rIqL/LcqROcdec6AyfK0WlcQNFd v2eRfkVL6eId8c+fUGQdMeuNpf6a3GntBtzyZQyiHTxS+/YRD8/P6l6mpKRHuOqM6ge9 +YjATqK4xW+9uOCIm8UdTAO3H7ojKIBSCNsa4b9nYkwCPBDVKemDQlmF7ODJBaHWIJKT ldFw== X-Gm-Message-State: AJcUukdgaQF/kFllCYvLDUk9b2Bm9LApZjJcvBVTposf40N5CcgBW3O1 aUd+BOic7Gvx/eiVmfG4qAHYoH+n X-Google-Smtp-Source: ALg8bN4Lbq/3ICqqbmqxTv1sE/YEucCQIGAEyNuDbPGuzONpF/dWDkYMe40lVm8YmeughLmD6Fb5hQ== X-Received: by 2002:a17:902:8b88:: with SMTP id ay8mr7898147plb.55.1548357005564; Thu, 24 Jan 2019 11:10:05 -0800 (PST) Received: from wacom-arch2.corp.onewacom.com ([50.225.60.4]) by smtp.gmail.com with ESMTPSA id c7sm29618998pfa.24.2019.01.24.11.10.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 11:10:04 -0800 (PST) From: Jason Gerecke To: linux-input@vger.kernel.org Cc: Benjamin Tissoires , Ping Cheng , Aaron Skomra , Jason Gerecke , Jason Gerecke Subject: [PATCH] HID: wacom: Move HID fix for AES serial number into wacom_hid_usage_quirk Date: Thu, 24 Jan 2019 11:09:44 -0800 Message-Id: <20190124190944.27305-1-killertofu@gmail.com> X-Mailer: git-send-email 2.20.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 'wacom_hid_usage_quirk' function is the intended home for fixing up descriptors that are buggy or that don't quite fit the mold. Commit 578325120e was supposed to move all of these quirks but it missed the code to handle fixup the serial number usages for AES pens. Lets move this code out of 'wacom_wac_pen_usage_mapping' where it was previously lurking and put it into the same place as the others. Signed-off-by: Jason Gerecke --- drivers/hid/wacom_sys.c | 32 ++++++++++++++++++++++++++++++++ drivers/hid/wacom_wac.c | 21 --------------------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 0bdd85d486fe..a8633b1437b2 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -252,6 +252,38 @@ static void wacom_hid_usage_quirk(struct hid_device *hdev, } } + /* + * Wacom's AES devices use different vendor-defined usages to + * report serial number information compared to their branded + * hardware. The usages are also sometimes ill-defined and do + * not have the correct logical min/max values set. Lets patch + * the descriptor to use the branded usage convention and fix + * the errors. + */ + if (usage->hid == WACOM_HID_WT_SERIALNUMBER && + field->report_size == 16 && + field->index + 2 < field->report->maxfield) { + struct hid_field *a = field->report->field[field->index + 1]; + struct hid_field *b = field->report->field[field->index + 2]; + + if (a->maxusage > 0 && + a->usage[0].hid == HID_DG_TOOLSERIALNUMBER && + a->report_size == 32 && + b->maxusage > 0 && + b->usage[0].hid == 0xFF000000 && + b->report_size == 8) { + features->quirks |= WACOM_QUIRK_AESPEN; + usage->hid = WACOM_HID_WD_TOOLTYPE; + field->logical_minimum = S16_MIN; + field->logical_maximum = S16_MAX; + a->logical_minimum = S32_MIN; + a->logical_maximum = S32_MAX; + b->usage[0].hid = WACOM_HID_WD_SERIALHI; + b->logical_minimum = 0; + b->logical_maximum = U8_MAX; + } + } + /* 2nd-generation Intuos Pro Large has incorrect Y maximum */ if (hdev->vendor == USB_VENDOR_ID_WACOM && hdev->product == 0x0358 && diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 5dd3a8245f0f..72477e872324 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2159,27 +2159,6 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, case HID_DG_TOOLSERIALNUMBER: features->quirks |= WACOM_QUIRK_TOOLSERIAL; wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0); - - /* Adjust AES usages to match modern convention */ - if (usage->hid == WACOM_HID_WT_SERIALNUMBER && field->report_size == 16) { - if (field->index + 2 < field->report->maxfield) { - struct hid_field *a = field->report->field[field->index + 1]; - struct hid_field *b = field->report->field[field->index + 2]; - - if (a->maxusage > 0 && a->usage[0].hid == HID_DG_TOOLSERIALNUMBER && a->report_size == 32 && - b->maxusage > 0 && b->usage[0].hid == 0xFF000000 && b->report_size == 8) { - features->quirks |= WACOM_QUIRK_AESPEN; - usage->hid = WACOM_HID_WD_TOOLTYPE; - field->logical_minimum = S16_MIN; - field->logical_maximum = S16_MAX; - a->logical_minimum = S32_MIN; - a->logical_maximum = S32_MAX; - b->usage[0].hid = WACOM_HID_WD_SERIALHI; - b->logical_minimum = 0; - b->logical_maximum = U8_MAX; - } - } - } break; case WACOM_HID_WD_SENSE: features->quirks |= WACOM_QUIRK_SENSE;