From patchwork Sun Feb 10 10:14:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolai Kondrashov X-Patchwork-Id: 10804697 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 978EB17E6 for ; Sun, 10 Feb 2019 10:15:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88B2429F46 for ; Sun, 10 Feb 2019 10:15:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CDCF29F4B; Sun, 10 Feb 2019 10:15: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 F26EC29F4A for ; Sun, 10 Feb 2019 10:15:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726078AbfBJKPH (ORCPT ); Sun, 10 Feb 2019 05:15:07 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35994 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbfBJKPH (ORCPT ); Sun, 10 Feb 2019 05:15:07 -0500 Received: by mail-lj1-f196.google.com with SMTP id g11-v6so6469260ljk.3 for ; Sun, 10 Feb 2019 02:15:04 -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=AZzZOOiefp8vpSHHB/8bJJ6hbr4UkRYzO9eMlhhsF1w=; b=aN7bk4FGFbxUbj7l6lkRvG92u7fyoiBV/WJcLthRrWD8+Hiz72vE963CHORAvCHtSB bI27T/fM6QNhjnuS1ry/zlxtQfNs1dcoHOssGPpd2Xl9MbMOCdTVLAnYfbWPkUEIEBeR TbGBalYjgXDfcrmkfENuDDizEvXKszqHeVdPfYgq0pQp7BgYHhkXOLKe+PSlf9X4vxgL iXopHXtSDzfIc2FuHz/mzl0FZEDaHG3Yl+OtR8fMMduW0dEAnNXDG4vy3JRxCUG+6HPw 8SQ9hrZN+tXEaJincxtvFln5BYucs9swgRlXoh+kmSDBT839iTe4CRFTMC8G7kgCFjBt MDKw== 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=AZzZOOiefp8vpSHHB/8bJJ6hbr4UkRYzO9eMlhhsF1w=; b=A+7sM69ztuigQ5xCEb5aYYRzIoP2LbikiTctilZ/AEksWtD0WuhLhcT/w9k97vYucC P6FInBNGNp2eDsbhj9/VyNlI70DUKSRLxmTyWgEyZKamdcZLDUfbzqFeK/lxyk3Bk3Hd vXuHgNgljv8kdwsN7jXq5CPIudahzhT+EOjNOi0HzlQWJ8Yo87xBb6zF9KmxUMRcNAjp nZM2H7SHH4xArQ8F3cjDJtdm01IHz8d1MGLf0xYrbdKQIFBVkEDxnXf241iOYOcPVesr ejxfF1CDBZfsMGxKmY8T83rVj8zgt3yx6D/pBDyIGH7qTZwyAb3kOIORdHFRgOAiceRZ gQWg== X-Gm-Message-State: AHQUAuatJlXnUS2aFKgSU8xfQzd8yDVFCUMofsyq6CRfAdQG9d8JnSz+ dnN4UYftP+DE0TsDis/fEcA= X-Google-Smtp-Source: AHgI3IZox3/WJvH2ijpQs6GyduYQ3g9zMTOq5BjAy4p2lWRjVUBmamhHGtLUNeSn5uzL7FuMELSalQ== X-Received: by 2002:a2e:9944:: with SMTP id r4-v6mr18525942ljj.185.1549793704060; Sun, 10 Feb 2019 02:15:04 -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.15.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Feb 2019 02:15:03 -0800 (PST) From: Nikolai Kondrashov To: Benjamin Tissoires Cc: Jiri Kosina , linux-input@vger.kernel.org, Nikolai Kondrashov Subject: [PATCH v2 16/23] HID: uclogic: Add support for XP-Pen Deco 01 Date: Sun, 10 Feb 2019 12:14:02 +0200 Message-Id: <20190210101409.3511-17-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 XP-Pen Deco 01 to hid-uclogic. Signed-off-by: Nikolai Kondrashov --- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-uclogic-core.c | 2 ++ drivers/hid/hid-uclogic-params.c | 23 +++++++++++++++++++++ drivers/hid/hid-uclogic-rdesc.c | 35 ++++++++++++++++++++++++++++++++ drivers/hid/hid-uclogic-rdesc.h | 4 ++++ 5 files changed, 65 insertions(+) diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index cadc8d4d6a4d..b38be58d61b6 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -1143,6 +1143,7 @@ #define USB_VENDOR_ID_UGEE 0x28bd #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540 0x0075 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640 0x0094 +#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01 0x0042 #define USB_DEVICE_ID_UGEE_TABLET_EX07S 0x0071 #define USB_VENDOR_ID_UNITEC 0x227d diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c index 5fdd8919902d..e4324ad86e58 100644 --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -350,6 +350,8 @@ static const struct hid_device_id uclogic_devices[] = { USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540) }, { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640) }, + { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, + USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01) }, { } }; MODULE_DEVICE_TABLE(hid, uclogic_devices); diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 709eeb15e7de..9b0fc4dd31af 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1018,6 +1018,29 @@ int uclogic_params_init(struct uclogic_params *params, uclogic_params_init_with_pen_unused(&p); } break; + case VID_PID(USB_VENDOR_ID_UGEE, + USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01): + /* If this is the pen and frame interface */ + if (bInterfaceNumber == 1) { + /* 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; + } + /* Initialize frame parameters */ + rc = uclogic_params_frame_init_with_desc( + &p.frame, + uclogic_rdesc_xppen_deco01_frame_arr, + uclogic_rdesc_xppen_deco01_frame_size, + 0); + if (rc != 0) + goto cleanup; + } else { + /* TODO: Consider marking the interface invalid */ + uclogic_params_init_with_pen_unused(&p); + } + break; case VID_PID(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_TABLET_EX07S): /* Ignore non-pen interfaces */ diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index 2ab8747e87b7..73996586993f 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -728,6 +728,41 @@ const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[] = { const size_t uclogic_rdesc_ugee_ex07_buttonpad_size = sizeof(uclogic_rdesc_ugee_ex07_buttonpad_arr); +/* Fixed report descriptor for XP-Pen Deco 01 frame controls */ +const __u8 uclogic_rdesc_xppen_deco01_frame_arr[] = { + 0x05, 0x01, /* Usage Page (Desktop), */ + 0x09, 0x07, /* Usage (Keypad), */ + 0xA1, 0x01, /* Collection (Application), */ + 0x85, 0x06, /* Report ID (6), */ + 0x14, /* Logical Minimum (0), */ + 0x25, 0x01, /* Logical Maximum (1), */ + 0x75, 0x01, /* Report Size (1), */ + 0x05, 0x0D, /* Usage Page (Digitizer), */ + 0x09, 0x39, /* Usage (Tablet Function Keys), */ + 0xA0, /* Collection (Physical), */ + 0x05, 0x09, /* Usage Page (Button), */ + 0x19, 0x01, /* Usage Minimum (01h), */ + 0x29, 0x08, /* Usage Maximum (08h), */ + 0x95, 0x08, /* Report Count (8), */ + 0x81, 0x02, /* Input (Variable), */ + 0x05, 0x0D, /* Usage Page (Digitizer), */ + 0x09, 0x44, /* Usage (Barrel Switch), */ + 0x95, 0x01, /* Report Count (1), */ + 0x81, 0x02, /* Input (Variable), */ + 0x05, 0x01, /* Usage Page (Desktop), */ + 0x09, 0x30, /* Usage (X), */ + 0x09, 0x31, /* Usage (Y), */ + 0x95, 0x02, /* Report Count (2), */ + 0x81, 0x02, /* Input (Variable), */ + 0x95, 0x15, /* Report Count (21), */ + 0x81, 0x01, /* Input (Constant), */ + 0xC0, /* End Collection, */ + 0xC0 /* End Collection */ +}; + +const size_t uclogic_rdesc_xppen_deco01_frame_size = + sizeof(uclogic_rdesc_xppen_deco01_frame_arr); + /** * uclogic_rdesc_template_apply() - apply report descriptor parameters to a * report descriptor template, creating a report descriptor. Copies the diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h index 3cb6e1725f43..0c5bd027f155 100644 --- a/drivers/hid/hid-uclogic-rdesc.h +++ b/drivers/hid/hid-uclogic-rdesc.h @@ -135,4 +135,8 @@ extern const size_t uclogic_rdesc_buttonpad_v2_size; extern const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[]; extern const size_t uclogic_rdesc_ugee_ex07_buttonpad_size; +/* Fixed report descriptor for XP-Pen Deco 01 frame controls */ +extern const __u8 uclogic_rdesc_xppen_deco01_frame_arr[]; +extern const size_t uclogic_rdesc_xppen_deco01_frame_size; + #endif /* _HID_UCLOGIC_RDESC_H */