From patchwork Sun Feb 10 10:13:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolai Kondrashov X-Patchwork-Id: 10804689 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 D02021515 for ; Sun, 10 Feb 2019 10:15:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0A5F29F46 for ; Sun, 10 Feb 2019 10:15:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B524A29F4B; Sun, 10 Feb 2019 10:15:03 +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 3E3DA29F46 for ; Sun, 10 Feb 2019 10:15:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726093AbfBJKPC (ORCPT ); Sun, 10 Feb 2019 05:15:02 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:40935 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbfBJKPC (ORCPT ); Sun, 10 Feb 2019 05:15:02 -0500 Received: by mail-lj1-f196.google.com with SMTP id z25-v6so6418642ljk.7 for ; Sun, 10 Feb 2019 02:15:01 -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=p6naigFuhNcKdhKKWbyZ9CsQvLQs0OAH6plQx4jP89A=; b=Vg8AxEYtEJDWr1Kgvvm6to6cZgI1ixpgQTj0avZCdNnavZpL1JyaDQeByj9lSvERVA wuSTaWoynSsqt2WykxfMoFYdu6KJiSikXfqoCysPnNswWYtdzUD2JdcNPY37c67mdWgG UXG2Gz3LIphaiyjn6lckQr5l0O2zPP95+S2Ws8pyxAJS/NMEFoWAkLi9UDGt82/egaSx BFGhGmgwISLYftLX6ZyzbUx9mplUI88g6G3bnu1QYZwRKsYM0FeFY6OZm8JkYM5UW2WO mLayDAIPtkzVmBqUYALt+iFLAiktQWxctIUIdh84H4AFUpHA3dpgOi7slI80idu5wPSr g4dg== 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=p6naigFuhNcKdhKKWbyZ9CsQvLQs0OAH6plQx4jP89A=; b=SSYpQRPQsmgPZxfqcw6HhZg5F3M5I4zRg1mhs5CXTKn8MLc4RB+haqXp+b7Qa2Rdpw RfWMnvcu0SVinHW7mtR8UJgwjFaAXtYhYRHx/xjBvbDZ8swSBveWOI9TY2zOsRnI/c5O v16e7MzqrL4bkAPobKYYZVQsWmXxgvtgaz/g0UDfI6s/8Vg2XieHHaWpibdR8RXWmOqD 96nO9nBW4bgY4q+dyxXlWqqn7BHWgi9lZKjXwJdZr7nukgCPUQZgZgZw7y1gQNemMPvk WUvM3LUUqTUoXDsvqQxtsIkLVi7GDt9dQGiX4YRr+yIhxA8m9Gsj9rYLUKEo57lCVJ0U aJnA== X-Gm-Message-State: AHQUAuYbLuYooty0KzG0I6XFaNHt80JtHOZIXkQUGuIOW4e5VG9gldqm Ok6Bdv4TUVSC132JfkQcEv9epDHVoKM= X-Google-Smtp-Source: AHgI3Iai0P18AM0ls4MSXgN9gOOa80gdOJfXVqtcQNENkyrVLvPRnoOv0GyuXjRpYwmNXCvwhskXPg== X-Received: by 2002:a2e:7316:: with SMTP id o22-v6mr15186155ljc.82.1549793700501; Sun, 10 Feb 2019 02:15:00 -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.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Feb 2019 02:14:59 -0800 (PST) From: Nikolai Kondrashov To: Benjamin Tissoires Cc: Jiri Kosina , linux-input@vger.kernel.org, Nikolai Kondrashov Subject: [PATCH v2 13/23] HID: uclogic: Add support for Ugee EX07S frame controls Date: Sun, 10 Feb 2019 12:13:59 +0200 Message-Id: <20190210101409.3511-14-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 proper support for Ugee EX07(S) frame controls to hid-uclogic. Signed-off-by: Nikolai Kondrashov --- drivers/hid/hid-uclogic-params.c | 32 ++++++++++++++++++++++++++++++-- drivers/hid/hid-uclogic-rdesc.c | 27 +++++++++++++++++++++++++++ drivers/hid/hid-uclogic-rdesc.h | 4 ++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 72a073ae454c..b22815cec06d 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -997,8 +997,6 @@ int uclogic_params_init(struct uclogic_params *params, break; case VID_PID(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610): - case VID_PID(USB_VENDOR_ID_UGEE, - USB_DEVICE_ID_UGEE_TABLET_EX07S): /* If this is the pen interface */ if (bInterfaceNumber == 1) { /* Probe v1 pen parameters */ @@ -1015,6 +1013,36 @@ int uclogic_params_init(struct uclogic_params *params, /* 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 */ + if (bInterfaceNumber != 1) { + uclogic_params_init_invalid(&p); + break; + } + + rc = uclogic_params_pen_init_v1(&p.pen, &found, hdev); + if (rc != 0) { + hid_err(hdev, "pen probing failed: %d\n", rc); + goto cleanup; + } else if (found) { + rc = uclogic_params_frame_init_with_desc( + &p.frame, + uclogic_rdesc_ugee_ex07_buttonpad_arr, + uclogic_rdesc_ugee_ex07_buttonpad_size, + 0); + if (rc != 0) { + hid_err(hdev, + "failed creating buttonpad parameters: %d\n", + rc); + goto cleanup; + } + } else { + hid_warn(hdev, "pen parameters not found"); + uclogic_params_init_invalid(&p); + } + break; } diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index ef1d3cf918a4..2ab8747e87b7 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -701,6 +701,33 @@ const __u8 uclogic_rdesc_buttonpad_v2_arr[] = { const size_t uclogic_rdesc_buttonpad_v2_size = sizeof(uclogic_rdesc_buttonpad_v2_arr); +/* Fixed report descriptor for Ugee EX07 buttonpad */ +const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[] = { + 0x05, 0x01, /* Usage Page (Desktop), */ + 0x09, 0x07, /* Usage (Keypad), */ + 0xA1, 0x01, /* Collection (Application), */ + 0x85, 0x06, /* Report ID (6), */ + 0x05, 0x0D, /* Usage Page (Digitizer), */ + 0x09, 0x39, /* Usage (Tablet Function Keys), */ + 0xA0, /* Collection (Physical), */ + 0x05, 0x09, /* Usage Page (Button), */ + 0x75, 0x01, /* Report Size (1), */ + 0x19, 0x03, /* Usage Minimum (03h), */ + 0x29, 0x06, /* Usage Maximum (06h), */ + 0x95, 0x04, /* Report Count (4), */ + 0x81, 0x02, /* Input (Variable), */ + 0x95, 0x1A, /* Report Count (26), */ + 0x81, 0x03, /* Input (Constant, Variable), */ + 0x19, 0x01, /* Usage Minimum (01h), */ + 0x29, 0x02, /* Usage Maximum (02h), */ + 0x95, 0x02, /* Report Count (2), */ + 0x81, 0x02, /* Input (Variable), */ + 0xC0, /* End Collection, */ + 0xC0 /* End Collection */ +}; +const size_t uclogic_rdesc_ugee_ex07_buttonpad_size = + sizeof(uclogic_rdesc_ugee_ex07_buttonpad_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 cc5f3dd3804a..3cb6e1725f43 100644 --- a/drivers/hid/hid-uclogic-rdesc.h +++ b/drivers/hid/hid-uclogic-rdesc.h @@ -131,4 +131,8 @@ extern const size_t uclogic_rdesc_buttonpad_v2_size; /* Report ID for tweaked v2 buttonpad reports */ #define UCLOGIC_RDESC_BUTTONPAD_V2_ID 0xf7 +/* Fixed report descriptor for Ugee EX07 buttonpad */ +extern const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[]; +extern const size_t uclogic_rdesc_ugee_ex07_buttonpad_size; + #endif /* _HID_UCLOGIC_RDESC_H */