From patchwork Sun Feb 10 10:13:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolai Kondrashov X-Patchwork-Id: 10804673 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 A07E01515 for ; Sun, 10 Feb 2019 10:14:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9268B29F45 for ; Sun, 10 Feb 2019 10:14:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86DD729F4B; Sun, 10 Feb 2019 10:14:55 +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 D9D5D29F45 for ; Sun, 10 Feb 2019 10:14:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726035AbfBJKOy (ORCPT ); Sun, 10 Feb 2019 05:14:54 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33417 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726009AbfBJKOy (ORCPT ); Sun, 10 Feb 2019 05:14:54 -0500 Received: by mail-lj1-f194.google.com with SMTP id f24-v6so6475064ljk.0 for ; Sun, 10 Feb 2019 02:14:52 -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=l+tp8PaVOHhia7otABDP8tN4XQuR2MhQ9qQB+YksZdw=; b=XL86gpIdig5zFXYalzI29nQ2Fvo+uvNvPlDkxkhVg3YmcU/wtGsvXtSTQDTbudJHS3 TqUQXvwZZYiMr4YWgXIL6gP1JRIRZDnxeWQ6Ktf7QCKhPQc091ydFbmyTtsQt/4zGofx yXqCTdPWZBdOz6bUFvh77Q5zMzFINKtZzOfV7rHZGWqeIeOTk6X5NsxRLScC1zhXhTwF RlNIqeuU8gg4Fm4uviE+QQ32s8M+asXpHAvDXa5Rxk4ZlbBhio31cgmkG+NOBcFfdvhi 9/Ofr8xb1lwJlGBIfr8jfKcKt27gHhJxf3PggYDvv+UV5aRfozUHgWHdvMdNCMpRbkN4 vDXg== 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=l+tp8PaVOHhia7otABDP8tN4XQuR2MhQ9qQB+YksZdw=; b=TinY76lEkspQ0yaZIk7r4ZN4WPfkFg+uSSGRUKHfcKx2KiDg34/hzy8XTmiMki1QJr biE3kGoJMAHfufIsORcm7muWuC7rLCMO34kqRFdToSIFF6jWyeFFQgOTmiMV+xnhopLo CzaRXPCVYOMDQZjgZXwG0A1nVCnBymuliQW9d+KznM0hguwCAVj2hgZTG6vw7dsTYAj2 SxQltMhsXz/K9zJbVNlCI0xUUeENPv/kYzTbDgcR01U2Rm/MVQ9nWNaPsaxYpWfmWM+j 6v8NzdTb0dwMmhEb4OmjdBcyu6/rzGzH8mXXndtT61yYRsqvhbmy6ZyBXpiTrZUCJ6O+ klYg== X-Gm-Message-State: AHQUAuZw3PCM5xw/yTPE81hXVZDl6Hc/z0IelogPkfUEpk1HO3JNC9rD HA0wGR6r9tyW5s9NthI/aFI= X-Google-Smtp-Source: AHgI3IbLVPLEuiqAIWmaoTdTtD+bED2ZFG+Cv0ktCjMK9Cn6+ZYz4Te2cax8h6HGdJi8NfRJQLb8dQ== X-Received: by 2002:a2e:8006:: with SMTP id j6-v6mr18386107ljg.186.1549793691694; Sun, 10 Feb 2019 02:14:51 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Feb 2019 02:14:50 -0800 (PST) From: Nikolai Kondrashov To: Benjamin Tissoires Cc: Jiri Kosina , linux-input@vger.kernel.org, Nikolai Kondrashov Subject: [PATCH v2 07/23] HID: uclogic: Designate current protocol v1 Date: Sun, 10 Feb 2019 12:13:53 +0200 Message-Id: <20190210101409.3511-8-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 Designate the current UC-Logic tablet initialization protocol v1, in preparation for adding support for v2 protocol. Signed-off-by: Nikolai Kondrashov --- drivers/hid/hid-uclogic-params.c | 50 ++++++++++++++++---------------- drivers/hid/hid-uclogic-rdesc.c | 16 +++++----- drivers/hid/hid-uclogic-rdesc.h | 20 ++++++------- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 2f8870d58f9a..f555db120baa 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -117,8 +117,8 @@ static void uclogic_params_pen_cleanup(struct uclogic_params_pen *pen) } /** - * uclogic_params_pen_init() - initialize tablet interface pen - * input and retrieve its parameters from the device. + * uclogic_params_pen_init_v1() - initialize tablet interface pen + * input and retrieve its parameters from the device, using v1 protocol. * * @pen: Pointer to the pen parameters to initialize (to be * cleaned up with uclogic_params_pen_cleanup()). Not modified in @@ -132,9 +132,9 @@ static void uclogic_params_pen_cleanup(struct uclogic_params_pen *pen) * Returns: * Zero, if successful. A negative errno code on error. */ -static int uclogic_params_pen_init(struct uclogic_params_pen *pen, - bool *pfound, - struct hid_device *hdev) +static int uclogic_params_pen_init_v1(struct uclogic_params_pen *pen, + bool *pfound, + struct hid_device *hdev) { int rc; bool found = false; @@ -202,8 +202,8 @@ static int uclogic_params_pen_init(struct uclogic_params_pen *pen, * Generate pen report descriptor */ desc_ptr = uclogic_rdesc_template_apply( - uclogic_rdesc_pen_template_arr, - uclogic_rdesc_pen_template_size, + uclogic_rdesc_pen_v1_template_arr, + uclogic_rdesc_pen_v1_template_size, desc_params, ARRAY_SIZE(desc_params)); if (desc_ptr == NULL) { rc = -ENOMEM; @@ -216,8 +216,8 @@ static int uclogic_params_pen_init(struct uclogic_params_pen *pen, memset(pen, 0, sizeof(*pen)); pen->desc_ptr = desc_ptr; desc_ptr = NULL; - pen->desc_size = uclogic_rdesc_pen_template_size; - pen->id = UCLOGIC_RDESC_PEN_ID; + pen->desc_size = uclogic_rdesc_pen_v1_template_size; + pen->id = UCLOGIC_RDESC_PEN_V1_ID; pen->inrange = UCLOGIC_PARAMS_PEN_INRANGE_INVERTED; found = true; finish: @@ -280,8 +280,8 @@ static int uclogic_params_frame_init_with_desc( } /** - * uclogic_params_frame_init_buttonpad() - initialize abstract buttonpad - * on a tablet interface. + * uclogic_params_frame_init_v1_buttonpad() - initialize abstract buttonpad + * on a v1 tablet interface. * * @frame: Pointer to the frame parameters to initialize (to be cleaned * up with uclogic_params_frame_cleanup()). Not modified in case @@ -295,7 +295,7 @@ static int uclogic_params_frame_init_with_desc( * Returns: * Zero, if successful. A negative errno code on error. */ -static int uclogic_params_frame_init_buttonpad( +static int uclogic_params_frame_init_v1_buttonpad( struct uclogic_params_frame *frame, bool *pfound, struct hid_device *hdev) @@ -335,9 +335,9 @@ static int uclogic_params_frame_init_buttonpad( hid_dbg(hdev, "generic buttons enabled\n"); rc = uclogic_params_frame_init_with_desc( frame, - uclogic_rdesc_buttonpad_arr, - uclogic_rdesc_buttonpad_size, - UCLOGIC_RDESC_BUTTONPAD_ID); + uclogic_rdesc_buttonpad_v1_arr, + uclogic_rdesc_buttonpad_v1_size, + UCLOGIC_RDESC_BUTTONPAD_V1_ID); if (rc != 0) goto cleanup; found = true; @@ -577,23 +577,23 @@ static int uclogic_params_huion_init(struct uclogic_params *params, goto output; } - /* Try to probe pen parameters */ - rc = uclogic_params_pen_init(&p.pen, &found, hdev); + /* Try to probe v1 pen parameters */ + rc = uclogic_params_pen_init_v1(&p.pen, &found, hdev); if (rc != 0) { hid_err(hdev, - "failed probing pen parameters: %d\n", rc); + "failed probing pen v1 parameters: %d\n", rc); goto cleanup; } else if (found) { - hid_dbg(hdev, "pen parameters found\n"); - /* Try to probe buttonpad */ - rc = uclogic_params_frame_init_buttonpad( + hid_dbg(hdev, "pen v1 parameters found\n"); + /* Try to probe v1 buttonpad */ + rc = uclogic_params_frame_init_v1_buttonpad( &p.frame, &found, hdev); if (rc != 0) { hid_err(hdev, "v1 buttonpad probing failed: %d\n", rc); goto cleanup; } - hid_dbg(hdev, "buttonpad parameters%s found\n", + hid_dbg(hdev, "buttonpad v1 parameters%s found\n", (found ? "" : " not")); if (found) { /* Set bitmask marking frame reports */ @@ -601,7 +601,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params, } goto output; } - hid_dbg(hdev, "pen parameters not found\n"); + hid_dbg(hdev, "pen v1 parameters not found\n"); uclogic_params_init_invalid(&p); @@ -776,8 +776,8 @@ int uclogic_params_init(struct uclogic_params *params, USB_DEVICE_ID_UGEE_TABLET_EX07S): /* If this is the pen interface */ if (bInterfaceNumber == 1) { - /* Probe pen parameters */ - rc = uclogic_params_pen_init(&p.pen, &found, hdev); + /* 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; diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index e9053d28f4e0..359e72394d83 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -531,8 +531,8 @@ __u8 uclogic_rdesc_twha60_fixed1_arr[] = { const size_t uclogic_rdesc_twha60_fixed1_size = sizeof(uclogic_rdesc_twha60_fixed1_arr); -/* Fixed report descriptor template for (tweaked) pen reports */ -const __u8 uclogic_rdesc_pen_template_arr[] = { +/* Fixed report descriptor template for (tweaked) v1 pen reports */ +const __u8 uclogic_rdesc_pen_v1_template_arr[] = { 0x05, 0x0D, /* Usage Page (Digitizer), */ 0x09, 0x02, /* Usage (Pen), */ 0xA1, 0x01, /* Collection (Application), */ @@ -582,8 +582,8 @@ const __u8 uclogic_rdesc_pen_template_arr[] = { 0xC0 /* End Collection */ }; -const size_t uclogic_rdesc_pen_template_size = - sizeof(uclogic_rdesc_pen_template_arr); +const size_t uclogic_rdesc_pen_v1_template_size = + sizeof(uclogic_rdesc_pen_v1_template_arr); /** * Expand to the contents of a generic buttonpad report descriptor. @@ -631,12 +631,12 @@ const size_t uclogic_rdesc_pen_template_size = 0xC0, /* End Collection, */ \ 0xC0 /* End Collection */ -/* Fixed report descriptor for (tweaked) buttonpad reports */ -const __u8 uclogic_rdesc_buttonpad_arr[] = { +/* Fixed report descriptor for (tweaked) v1 buttonpad reports */ +const __u8 uclogic_rdesc_buttonpad_v1_arr[] = { UCLOGIC_RDESC_BUTTONPAD_BYTES(20) }; -const size_t uclogic_rdesc_buttonpad_size = - sizeof(uclogic_rdesc_buttonpad_arr); +const size_t uclogic_rdesc_buttonpad_v1_size = + sizeof(uclogic_rdesc_buttonpad_v1_arr); /** * uclogic_rdesc_template_apply() - apply report descriptor parameters to a diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h index 610575879522..cf03b98ae7cb 100644 --- a/drivers/hid/hid-uclogic-rdesc.h +++ b/drivers/hid/hid-uclogic-rdesc.h @@ -100,18 +100,18 @@ enum uclogic_rdesc_pen_ph_id { #define UCLOGIC_RDESC_PEN_PH(_ID) \ UCLOGIC_RDESC_PH_HEAD, UCLOGIC_RDESC_PEN_PH_ID_##_ID -/* Report ID for pen reports */ -#define UCLOGIC_RDESC_PEN_ID 0x07 +/* Report ID for v1 pen reports */ +#define UCLOGIC_RDESC_PEN_V1_ID 0x07 -/* Fixed report descriptor template for (tweaked) pen reports */ -extern const __u8 uclogic_rdesc_pen_template_arr[]; -extern const size_t uclogic_rdesc_pen_template_size; +/* Fixed report descriptor template for (tweaked) v1 pen reports */ +extern const __u8 uclogic_rdesc_pen_v1_template_arr[]; +extern const size_t uclogic_rdesc_pen_v1_template_size; -/* Fixed report descriptor for (tweaked) buttonpad reports */ -extern const __u8 uclogic_rdesc_buttonpad_arr[]; -extern const size_t uclogic_rdesc_buttonpad_size; +/* Fixed report descriptor for (tweaked) v1 buttonpad reports */ +extern const __u8 uclogic_rdesc_buttonpad_v1_arr[]; +extern const size_t uclogic_rdesc_buttonpad_v1_size; -/* Report ID for tweaked buttonpad reports */ -#define UCLOGIC_RDESC_BUTTONPAD_ID 0xf7 +/* Report ID for tweaked v1 buttonpad reports */ +#define UCLOGIC_RDESC_BUTTONPAD_V1_ID 0xf7 #endif /* _HID_UCLOGIC_RDESC_H */