From patchwork Sun Feb 10 10:13:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolai Kondrashov X-Patchwork-Id: 10804687 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 7DA681515 for ; Sun, 10 Feb 2019 10:15:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D0A329F45 for ; Sun, 10 Feb 2019 10:15:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C54629F4A; Sun, 10 Feb 2019 10:15:02 +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 0504B29F45 for ; Sun, 10 Feb 2019 10:15:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726088AbfBJKPB (ORCPT ); Sun, 10 Feb 2019 05:15:01 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34173 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbfBJKPB (ORCPT ); Sun, 10 Feb 2019 05:15:01 -0500 Received: by mail-lj1-f196.google.com with SMTP id v14-v6so6480629ljv.1 for ; Sun, 10 Feb 2019 02:15:00 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=4mh56JFLbIWkust8+CV/wSEKZEPzwu6dYAwxjEoBgwk=; b=RpBTjzeH0EAK24HLPkALB8kLckVx6PJa/OdULqAyd3tZUNdw1GedmJauAKdssC2sut o3lRnqaIUfHTf34yT1T5OFstV079DGRrG192mejVTnT5H7t7mbqL7u+echmCl49FR7mr lyEKsX7lHpbFOjtZnS3hsm7l5+gw0Pn+/OTlClkSzRnn8A49P/h0q9D+wJM5zlmDK0Fc O9peLWjdwBAwak2xSh3m2+HrWRAwOB5ycjCdhN5prKbtik9l8jN4t1llge3v8nw02V7Z TCch81mgMkeD7t1tydM9MSHLht+2+fXgU6guNJK/phv8s6cCxnZFrXmVT79nPh6fgUNn YCsg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=4mh56JFLbIWkust8+CV/wSEKZEPzwu6dYAwxjEoBgwk=; b=e190GcpJkGp1eZMEHHdaGReNlnaEKN/ToqR++83gnpTzlZxpOC3UOMrYHAD4Jy3HEW JPNybKwll/BAPPKrClLwVhn/cbXV5J4mLYQnzqWSILHMrfBK68fjg4p73raOmQOUQlo7 6U3XJ5Z6xOZM82c7+Cc3N0Prz4Isyc31WxScWcdRTeqojnG+bSqKVXjdzP0xk+LvH4wb GRLjho+H1xC5bkXVmHmDMxnMhJpNmef5R44GpahHyY5gdpX2wgUoWVCeRbFB+YNXBtRm QmPWmBgKHc3ozGaYy3IdpodNWqS+MvN4am/bLDbUBj26HCiAtiNtjpkFcr6bAeJB1OnK aQ/g== X-Gm-Message-State: AHQUAuaJiJfTMY4IEDtby2JmLKnHtaZCqbN8horK0sfIU8zZHVsbsVn8 GhdQ1JbckfVPAaCoiY2W1OA= X-Google-Smtp-Source: AHgI3IalhQDCZLeBMvUbFhnqzAy6SKRG3GV3BUdZ8s8iY/HF7OiQuahUbaB8qvxRhjyh+MAqtMapfA== X-Received: by 2002:a2e:99d4:: with SMTP id l20-v6mr1384974ljj.142.1549793699135; Sun, 10 Feb 2019 02:14:59 -0800 (PST) Received: from bard.ponomarevs.fi (88-112-122-53.elisa-laajakaista.fi. [88.112.122.53]) by smtp.gmail.com with ESMTPSA id l21-v6sm1472010ljj.48.2019.02.10.02.14.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Feb 2019 02:14:58 -0800 (PST) From: Nikolai Kondrashov To: Benjamin Tissoires Cc: Jiri Kosina , linux-input@vger.kernel.org, Nikolai Kondrashov Subject: [PATCH v2 12/23] HID: uclogic: Add support for Ugee M540 Date: Sun, 10 Feb 2019 12:13:58 +0200 Message-Id: <20190210101409.3511-13-spbnick@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190210101409.3511-1-spbnick@gmail.com> References: <20181227171625.11164-1-spbnick@gmail.com> <20190210101409.3511-1-spbnick@gmail.com> 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 Add support for Ugee M540 to hid-uclogic. Signed-off-by: Nikolai Kondrashov --- drivers/hid/hid-uclogic-params.c | 26 +++++++++++++++++++++++--- drivers/hid/hid-uclogic-rdesc.h | 3 +++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index f57bf2698374..72a073ae454c 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -897,9 +897,29 @@ int uclogic_params_init(struct uclogic_params *params, break; case VID_PID(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U): - rc = WITH_OPT_DESC(WPXXXXU_ORIG, wp5540u_fixed); - if (rc != 0) - goto cleanup; + if (hdev->dev_rsize == UCLOGIC_RDESC_WP5540U_V2_ORIG_SIZE) { + if (bInterfaceNumber == 0) { + /* Try to probe v1 pen parameters */ + rc = uclogic_params_pen_init_v1(&p.pen, + &found, hdev); + if (rc != 0) { + hid_err(hdev, + "pen probing failed: %d\n", + rc); + goto cleanup; + } + if (!found) { + hid_warn(hdev, + "pen parameters not found"); + } + } else { + uclogic_params_init_invalid(&p); + } + } else { + rc = WITH_OPT_DESC(WPXXXXU_ORIG, wp5540u_fixed); + if (rc != 0) + goto cleanup; + } break; case VID_PID(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U): diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h index f205254a733c..cc5f3dd3804a 100644 --- a/drivers/hid/hid-uclogic-rdesc.h +++ b/drivers/hid/hid-uclogic-rdesc.h @@ -34,6 +34,9 @@ extern const size_t uclogic_rdesc_wp5540u_fixed_size; extern __u8 uclogic_rdesc_wp8060u_fixed_arr[]; extern const size_t uclogic_rdesc_wp8060u_fixed_size; +/* Size of the original descriptor of the new WP5540U tablet */ +#define UCLOGIC_RDESC_WP5540U_V2_ORIG_SIZE 232 + /* Size of the original descriptor of WP1062 tablet */ #define UCLOGIC_RDESC_WP1062_ORIG_SIZE 254