From patchwork Mon Aug 15 14:29:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 597391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EB7CC00140 for ; Mon, 15 Aug 2022 14:30:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242146AbiHOOaH (ORCPT ); Mon, 15 Aug 2022 10:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243069AbiHOOaH (ORCPT ); Mon, 15 Aug 2022 10:30:07 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B8A724092; Mon, 15 Aug 2022 07:30:05 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id e27so4566001wra.11; Mon, 15 Aug 2022 07:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=hXEApsgmJM0YpgsYBqtez7wZ8rBpB7fQbxI7//Qi7zM=; b=ipmvXLXs+gv35tXJ4yKTdE2Z2xOhShZghngxXyTsHmM+8q5/m6LviejTioEurJGPv1 gbfv5c1CozHLnSr2RxI5BXxotwbwac4CgspDPSTfltuqKzkZT1U3PmoHpYL0ifWJUaYN MMJyvWta1YF57Pw1D4fyyMTMFgL8cvaCqW4zu44dbtbeLnuhjcp/mJo34Xvzp8Yn8vX7 cq+0RpLUEyYDUSWzQWUw5kY1siDJRRdxH67JHOad/IPv0dW0vlCZZWmyOmJcs+TrQoXZ 2cUa9dmyRkJJvj+2z3+DG5bWWMEiEquv3rqNPF1EIp2JL6Iav0jbFteuIwPKhPeKVura yivg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=hXEApsgmJM0YpgsYBqtez7wZ8rBpB7fQbxI7//Qi7zM=; b=dqVtVeb3W37H9dRUPMc3AZ/AB01EdG6FOzgaLMtLeHSAzdXriqA273joCBFVCiENwk THazB9OKm0fMJ9p/hVeK39r+R8GDS952D/OAKmeXn5fS1/E3+hSDi/Wa47WM6Uq9hlHh 8Gsebew9pstr/kDvVH0dvuwyLsIt4Ng4ZAz7PrLaVRv1bOf6BWOnj9gfZ8Z59ju0Nddn rOS60d+0LEG6VrytKs5ZBLBMSqswtKhX8XnQIdwDWSbCiChgIXHhtAfFcWDiAVjO0ogf 65tR/kQX27suJcz5Zxnlkqv9YoBB1+jnmtyRSCgNs3qF6AbJ45nX6yAETl00hLI6PU4a qdmw== X-Gm-Message-State: ACgBeo2rFAUPWFuTADLRB2lPF5G13dDjzyVXK3asqLCvHC7JxYozROZ1 EW8C5vELAGQVngpO/yduZ1Bljt2zDvGV7A== X-Google-Smtp-Source: AA6agR7gG1EVzjFVMD8itiN0eb7Q87uXr5BvAgTHg1FxPoH/NghPsOaKxX4UORJ6Xau+cVJ/oFAWaQ== X-Received: by 2002:a05:6000:1b92:b0:220:7d86:2e30 with SMTP id r18-20020a0560001b9200b002207d862e30mr9195405wru.530.1660573803913; Mon, 15 Aug 2022 07:30:03 -0700 (PDT) Received: from localhost.localdomain ([94.73.32.249]) by smtp.gmail.com with ESMTPSA id m7-20020a056000008700b00224f895d620sm5456894wrx.48.2022.08.15.07.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:30:03 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, j.witteveen@gmail.com, nathan@kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= , Daniel Latypov Subject: [PATCH v4 1/8] HID: uclogic: KUnit best practices and naming conventions Date: Mon, 15 Aug 2022 16:29:49 +0200 Message-Id: <20220815142956.19180-2-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815142956.19180-1-jose.exposito89@gmail.com> References: <20220815142956.19180-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The KUnit documentation [1] suggests allowing build tests as a module. In addition, it is recommended [2] to use snake case names for kunit_suite and test cases. Change the Kconfig entry from bool to tristate and stick to the naming conventions to avoid style issues with future tests. Link: https://docs.kernel.org/dev-tools/kunit/style.html#test-kconfig-entries [1] Link: https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html [2] Acked-by: Daniel Latypov Signed-off-by: José Expósito --- drivers/hid/Kconfig | 2 +- drivers/hid/Makefile | 3 ++- drivers/hid/hid-uclogic-rdesc-test.c | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 6ce92830b5d1..36a17958493f 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -1307,7 +1307,7 @@ config HID_MCP2221 will be called hid-mcp2221.ko. config HID_KUNIT_TEST - bool "KUnit tests for HID" if !KUNIT_ALL_TESTS + tristate "KUnit tests for HID" if !KUNIT_ALL_TESTS depends on KUNIT=y depends on HID_UCLOGIC default KUNIT_ALL_TESTS diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index b0bef8098139..82d8fd97d96c 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -144,8 +144,9 @@ obj-$(CONFIG_HID_WIIMOTE) += hid-wiimote.o obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o -obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-rdesc.o \ +hid-uclogic-test-objs := hid-uclogic-rdesc.o \ hid-uclogic-rdesc-test.o +obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-test.o obj-$(CONFIG_USB_HID) += usbhid/ obj-$(CONFIG_USB_MOUSE) += usbhid/ diff --git a/drivers/hid/hid-uclogic-rdesc-test.c b/drivers/hid/hid-uclogic-rdesc-test.c index ebebffef5f8a..3971a0854c3e 100644 --- a/drivers/hid/hid-uclogic-rdesc-test.c +++ b/drivers/hid/hid-uclogic-rdesc-test.c @@ -97,7 +97,7 @@ static const __u8 template_params_none[] = { static struct uclogic_template_case uclogic_template_cases[] = { { - .name = "Empty template", + .name = "empty_template", .template = template_empty, .template_size = sizeof(template_empty), .param_list = params_pen_all, @@ -105,7 +105,7 @@ static struct uclogic_template_case uclogic_template_cases[] = { .expected = template_empty, }, { - .name = "Template smaller than the placeholder", + .name = "template_smaller_than_the_placeholder", .template = template_small, .template_size = sizeof(template_small), .param_list = params_pen_all, @@ -113,7 +113,7 @@ static struct uclogic_template_case uclogic_template_cases[] = { .expected = template_small, }, { - .name = "No placeholder", + .name = "no_placeholder", .template = template_no_ph, .template_size = sizeof(template_no_ph), .param_list = params_pen_all, @@ -121,7 +121,7 @@ static struct uclogic_template_case uclogic_template_cases[] = { .expected = template_no_ph, }, { - .name = "Pen placeholder at the end, without ID", + .name = "pen_placeholder_at_the_end_without_id", .template = template_pen_ph_end, .template_size = sizeof(template_pen_ph_end), .param_list = params_pen_all, @@ -129,7 +129,7 @@ static struct uclogic_template_case uclogic_template_cases[] = { .expected = template_pen_ph_end, }, { - .name = "Frame button placeholder at the end, without ID", + .name = "frame_button_placeholder_at_the_end_without_id", .template = template_btn_ph_end, .template_size = sizeof(template_btn_ph_end), .param_list = params_frame_all, @@ -137,7 +137,7 @@ static struct uclogic_template_case uclogic_template_cases[] = { .expected = template_btn_ph_end, }, { - .name = "All params present in the pen template", + .name = "all_params_present_in_the_pen_template", .template = template_pen_all_params, .template_size = sizeof(template_pen_all_params), .param_list = params_pen_all, @@ -145,7 +145,7 @@ static struct uclogic_template_case uclogic_template_cases[] = { .expected = expected_pen_all_params, }, { - .name = "All params present in the frame template", + .name = "all_params_present_in_the_frame_template", .template = template_frame_all_params, .template_size = sizeof(template_frame_all_params), .param_list = params_frame_all, @@ -153,7 +153,7 @@ static struct uclogic_template_case uclogic_template_cases[] = { .expected = expected_frame_all_params, }, { - .name = "Some params present in the pen template (complete param list)", + .name = "some_params_present_in_the_pen_template_with_complete_param_list", .template = template_pen_some_params, .template_size = sizeof(template_pen_some_params), .param_list = params_pen_all, @@ -161,7 +161,7 @@ static struct uclogic_template_case uclogic_template_cases[] = { .expected = expected_pen_some_params, }, { - .name = "Some params present in the pen template (incomplete param list)", + .name = "some_params_present_in_the_pen_template_with_incomplete_param_list", .template = template_pen_some_params, .template_size = sizeof(template_pen_some_params), .param_list = params_pen_some, @@ -169,7 +169,7 @@ static struct uclogic_template_case uclogic_template_cases[] = { .expected = expected_pen_some_params, }, { - .name = "No params present in the template", + .name = "no_params_present_in_the_template", .template = template_params_none, .template_size = sizeof(template_params_none), .param_list = params_pen_some, @@ -208,7 +208,7 @@ static struct kunit_case hid_uclogic_rdesc_test_cases[] = { }; static struct kunit_suite hid_uclogic_rdesc_test_suite = { - .name = "hid-uclogic-rdesc-test", + .name = "hid_uclogic_rdesc_test", .test_cases = hid_uclogic_rdesc_test_cases, }; From patchwork Mon Aug 15 14:29:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 597735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2685AC25B0E for ; Mon, 15 Aug 2022 14:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243088AbiHOOaI (ORCPT ); Mon, 15 Aug 2022 10:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232004AbiHOOaH (ORCPT ); Mon, 15 Aug 2022 10:30:07 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A63D23BE9; Mon, 15 Aug 2022 07:30:06 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id j26so1689219wms.0; Mon, 15 Aug 2022 07:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=KPkgY9vFkRCjtu+ihxWghFOjoX4mBhfV2FhH1CEdjXA=; b=PgCUunonQLGdTJkX9HMZANJxhtKfp5V7Vzog/cC6EIOyHt1GIHCb9wMSLyv96OyJOO 06PXwX95tkR5I27G5eLRQ/DaC1gu5yRe/et2cqx49/SqDnzcyKHk5l6s/nerLif/n4Op YiG3Ho2y1qR6sfppiiS2wOTaNkMnIKyVlWA6NlJ251Ci6hwtHU9IKHxEJMZf5hJzYJGt TodFjqFx3nq2rJFaeVG2LYUnqER8QyAf3Goj3B3G3x+xnbB9AF9npaRWhZpm4AyyislE z2kh2vZ+qlK13hcyyi39oFZknvqP0COrWoBnAU1oqUMq49IT+DayDL8FIksBXiVhpdv5 3Kcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=KPkgY9vFkRCjtu+ihxWghFOjoX4mBhfV2FhH1CEdjXA=; b=5DVOHjU7pD1fdfA37z9h928/+mosgUb0PD1cJEq2WllmdSvj+0eH/Ncho3nIb9XLHG wim6zOEZR1kUtOS2qb3fdmMew5NfsKUJAAd8ygNSsol0wt/nrU+Wy8MPfl7hKRQrMBE3 iDgqUYb2VBtLfCQjbrQRVCJ+MLSL5bGqj+el99f/DxE7YkBnO3H06aGbWGTPOcJMo+6H fYPc0/QSMFP1qsLgH47MCyXSVLSy7zJYaB23imHscy9NBOmz4qLu2/YdK8WMuLZpxheO oHPHQcx7CpQum6qtrKtLBx6+K+GBM4DINjWF7c0Kb9UBa8bMLqeQLJSjvNM829X6zs7i izqA== X-Gm-Message-State: ACgBeo19qhGbtjrk7bQ5vKPZy7/V53OsQnudxF7lA6wgrQTmYjXDCwUK DzIKAxmMx3dmnfUUUBReuW8= X-Google-Smtp-Source: AA6agR7LhfJzHCleZ91HdpEzwkGRxrx2p2Aa6cx8p783CZyeGVsc9HPiPsodS/HIcZckDJg739reuw== X-Received: by 2002:a05:600c:4e12:b0:3a5:dac2:5cec with SMTP id b18-20020a05600c4e1200b003a5dac25cecmr7527914wmq.183.1660573804840; Mon, 15 Aug 2022 07:30:04 -0700 (PDT) Received: from localhost.localdomain ([94.73.32.249]) by smtp.gmail.com with ESMTPSA id m7-20020a056000008700b00224f895d620sm5456894wrx.48.2022.08.15.07.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:30:04 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, j.witteveen@gmail.com, nathan@kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH v4 2/8] HID: uclogic: Refactor UGEE v2 string descriptor parsing Date: Mon, 15 Aug 2022 16:29:50 +0200 Message-Id: <20220815142956.19180-3-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815142956.19180-1-jose.exposito89@gmail.com> References: <20220815142956.19180-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The UGEE v2 tablets expose a string descriptor with their capabilities. Move the code used to parse the descriptors and generate a parameter list from it to its own function and add KUnit tests to validate the parser. Tested-by: Jouke Witteveen Signed-off-by: José Expósito --- drivers/hid/Makefile | 1 + drivers/hid/hid-uclogic-params-test.c | 159 ++++++++++++++++++++++++++ drivers/hid/hid-uclogic-params.c | 86 ++++++++++---- 3 files changed, 226 insertions(+), 20 deletions(-) create mode 100644 drivers/hid/hid-uclogic-params-test.c diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 82d8fd97d96c..fe69dece2a46 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -145,6 +145,7 @@ obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o hid-uclogic-test-objs := hid-uclogic-rdesc.o \ + hid-uclogic-params.o \ hid-uclogic-rdesc-test.o obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-test.o diff --git a/drivers/hid/hid-uclogic-params-test.c b/drivers/hid/hid-uclogic-params-test.c new file mode 100644 index 000000000000..9f043f2ab387 --- /dev/null +++ b/drivers/hid/hid-uclogic-params-test.c @@ -0,0 +1,159 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* + * HID driver for UC-Logic devices not fully compliant with HID standard + * + * Copyright (c) 2022 José Expósito + */ + +#include +#include "./hid-uclogic-rdesc.h" + +#define MAX_STR_DESC_SIZE 14 + +struct uclogic_parse_ugee_v2_desc_case { + const char *name; + int res; + const __u8 str_desc[MAX_STR_DESC_SIZE]; + size_t str_desc_size; + const s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; +}; + +static struct uclogic_parse_ugee_v2_desc_case uclogic_parse_ugee_v2_desc_cases[] = { + { + .name = "invalid_str_desc", + .res = -EINVAL, + .str_desc = {}, + .str_desc_size = 0, + .desc_params = {}, + }, + { + .name = "resolution_with_value_0", + .res = 0, + .str_desc = { + 0x0E, 0x03, + 0x70, 0xB2, + 0x10, 0x77, + 0x08, + 0x00, + 0xFF, 0x1F, + 0x00, 0x00, + }, + .str_desc_size = 12, + .desc_params = { + [UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xB270, + [UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0, + [UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 0x7710, + [UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0, + [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, + [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x08, + }, + }, + /* XP-PEN Deco L str_desc: Frame with 8 buttons */ + { + .name = "frame_type_buttons", + .res = 0, + .str_desc = { + 0x0E, 0x03, + 0x70, 0xB2, + 0x10, 0x77, + 0x08, + 0x00, + 0xFF, 0x1F, + 0xD8, 0x13, + }, + .str_desc_size = 12, + .desc_params = { + [UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xB270, + [UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0x2320, + [UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 0x7710, + [UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0x1770, + [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, + [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x08, + }, + }, + /* PARBLO A610 PRO str_desc: Frame with 9 buttons and dial */ + { + .name = "frame_type_dial", + .res = 0, + .str_desc = { + 0x0E, 0x03, + 0x96, 0xC7, + 0xF9, 0x7C, + 0x09, + 0x01, + 0xFF, 0x1F, + 0xD8, 0x13, + }, + .str_desc_size = 12, + .desc_params = { + [UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xC796, + [UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0x2749, + [UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 0x7CF9, + [UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0x1899, + [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, + [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x09, + }, + }, +}; + +static void uclogic_parse_ugee_v2_desc_case_desc(struct uclogic_parse_ugee_v2_desc_case *t, + char *desc) +{ + strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE); +} + +KUNIT_ARRAY_PARAM(uclogic_parse_ugee_v2_desc, uclogic_parse_ugee_v2_desc_cases, + uclogic_parse_ugee_v2_desc_case_desc); + +static void uclogic_parse_ugee_v2_desc_test(struct kunit *test) +{ + int res; + s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; + const struct uclogic_parse_ugee_v2_desc_case *params = test->param_value; + + res = uclogic_params_parse_ugee_v2_desc(params->str_desc, + params->str_desc_size, + desc_params, + ARRAY_SIZE(desc_params)); + KUNIT_ASSERT_EQ(test, res, params->res); + + if (res) + return; + + KUNIT_EXPECT_EQ(test, + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM], + desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM]); + KUNIT_EXPECT_EQ(test, + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM], + desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM]); + KUNIT_EXPECT_EQ(test, + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM], + desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM]); + KUNIT_EXPECT_EQ(test, + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM], + desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM]); + KUNIT_EXPECT_EQ(test, + params->desc_params[UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM], + desc_params[UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM]); + KUNIT_EXPECT_EQ(test, + params->desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM], + desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM]); +} + +static struct kunit_case hid_uclogic_params_test_cases[] = { + KUNIT_CASE_PARAM(uclogic_parse_ugee_v2_desc_test, + uclogic_parse_ugee_v2_desc_gen_params), + {} +}; + +static struct kunit_suite hid_uclogic_params_test_suite = { + .name = "hid_uclogic_params_test", + .test_cases = hid_uclogic_params_test_cases, +}; + +kunit_test_suite(hid_uclogic_params_test_suite); + +MODULE_DESCRIPTION("KUnit tests for the UC-Logic driver"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("José Expósito "); diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index c11fa239e6a2..07c5a21112ce 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1056,6 +1056,62 @@ static int uclogic_probe_interface(struct hid_device *hdev, u8 *magic_arr, return rc; } +/** + * uclogic_params_parse_ugee_v2_desc - parse the string descriptor containing + * pen and frame parameters returned by UGEE v2 devices. + * + * @str_desc: String descriptor, cannot be NULL. + * @str_desc_size: Size of the string descriptor. + * @desc_params: Output description params list. + * @desc_params_size: Size of the output description params list. + * + * Returns: + * Zero, if successful. A negative errno code on error. + */ +static int uclogic_params_parse_ugee_v2_desc(const __u8 *str_desc, + size_t str_desc_size, + s32 *desc_params, + size_t desc_params_size) +{ + s32 pen_x_lm, pen_y_lm; + s32 pen_x_pm, pen_y_pm; + s32 pen_pressure_lm; + s32 frame_num_buttons; + s32 resolution; + + /* Minimum descriptor length required, maximum seen so far is 14 */ + const int min_str_desc_size = 12; + + if (!str_desc || str_desc_size < min_str_desc_size) + return -EINVAL; + + if (desc_params_size != UCLOGIC_RDESC_PH_ID_NUM) + return -EINVAL; + + pen_x_lm = get_unaligned_le16(str_desc + 2); + pen_y_lm = get_unaligned_le16(str_desc + 4); + frame_num_buttons = str_desc[6]; + pen_pressure_lm = get_unaligned_le16(str_desc + 8); + + resolution = get_unaligned_le16(str_desc + 10); + if (resolution == 0) { + pen_x_pm = 0; + pen_y_pm = 0; + } else { + pen_x_pm = pen_x_lm * 1000 / resolution; + pen_y_pm = pen_y_lm * 1000 / resolution; + } + + desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM] = pen_x_lm; + desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM] = pen_x_pm; + desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = pen_y_lm; + desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = pen_y_pm; + desc_params[UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = pen_pressure_lm; + desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM] = frame_num_buttons; + + return 0; +} + /** * uclogic_params_ugee_v2_init() - initialize a UGEE graphics tablets by * discovering their parameters. @@ -1086,7 +1142,6 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, __u8 *rdesc_pen = NULL; __u8 *rdesc_frame = NULL; s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; - s32 resolution; __u8 magic_arr[] = { 0x02, 0xb0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -1128,25 +1183,12 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, goto output; } - desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM] = - get_unaligned_le16(str_desc + 2); - desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = - get_unaligned_le16(str_desc + 4); - desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM] = str_desc[6]; - desc_params[UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = - get_unaligned_le16(str_desc + 8); - resolution = get_unaligned_le16(str_desc + 10); - if (resolution == 0) { - desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0; - desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0; - } else { - desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_PM] = - desc_params[UCLOGIC_RDESC_PEN_PH_ID_X_LM] * 1000 / - resolution; - desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = - desc_params[UCLOGIC_RDESC_PEN_PH_ID_Y_LM] * 1000 / - resolution; - } + rc = uclogic_params_parse_ugee_v2_desc(str_desc, str_desc_len, + desc_params, + ARRAY_SIZE(desc_params)); + if (rc) + goto cleanup; + kfree(str_desc); str_desc = NULL; @@ -1517,3 +1559,7 @@ int uclogic_params_init(struct uclogic_params *params, uclogic_params_cleanup(&p); return rc; } + +#ifdef CONFIG_HID_KUNIT_TEST +#include "hid-uclogic-params-test.c" +#endif From patchwork Mon Aug 15 14:29:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 597734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00AD7C25B06 for ; Mon, 15 Aug 2022 14:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243098AbiHOOaK (ORCPT ); Mon, 15 Aug 2022 10:30:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243062AbiHOOaI (ORCPT ); Mon, 15 Aug 2022 10:30:08 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DE3223BF1; Mon, 15 Aug 2022 07:30:07 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id n4so9242933wrp.10; Mon, 15 Aug 2022 07:30:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=vQYUEj4RA75eO79mG5fQuMt5VepEBA+QRmCJhUes6lI=; b=Y2r80NvARtlOgnB1PQvTTQMnT3Zc+ZIBmBIU8/4vzDfa+7kQW0pT2OQr9mvnuCcyEL IWYiIxUk7Prw2cjT+7FlMKSRWAHf8wsdU4vHVa/qlN7VANjwKl/MW1Dzud0TPQ0hOA/p sN55uivGXepsf/XCuHH1JUNWdagXEQE5LqzwwRM/YdE0JXZQjFjY/ed30FVzsemb+t4q WNNK9JRBif7oFeYzdJfX0PpPGk969o+/vw+DzaFzgZB99sK9LU5KSgQ0nEL4AY88hepn qWRato8U53tGLsr3UyRqzjZn0XC+4Q+WvzR7d0blYcYh4nWwX1KMucSicJfUXXpkuN9h nZpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=vQYUEj4RA75eO79mG5fQuMt5VepEBA+QRmCJhUes6lI=; b=ThLV2wrTaAWeDlfL4qYFIkbCeUPVxqQXm9bBTQTOhColt2keOKpWriZzXxKeWcET8v Epljixji4P9DpLAt1uVqWsZqfdK/cUrmgCxkDPh3VnHbifaUrrbYw8xJwyB4Rzmz/Qx4 p8L9u61xoxEHkqlc6Q2AV0zd0u1k7zX+pUufLHmErrbdXJRz6408KEG8oqrgfn+DEQm1 wtNlUCUqUwIPzAlImj3SU0xUjjQYvWeQenBi80EtiCN0K4223vnQFMlaKu15J9ZF67vS eSa6SJa799DTB+O82m3e7zYNoT8kIMieGpe4o//4fEgr1FTeA8BjfdpE+xJxgG0HL/lq bBTw== X-Gm-Message-State: ACgBeo3vgjPGYEqkABnoH7JsWmWWCkzyGtQXuhhfZ/ocTSx/8i3TdHAK iZuAbQRDwNPxYRTPJknvD1FSc0YVWIp7fQ== X-Google-Smtp-Source: AA6agR4VZTJ+ZlNviJS9syq1nz0S9z+KDe5K3bkEJQo8zgeVGGjRh3waFgb+irFgUMDLVvHeTgwaaw== X-Received: by 2002:a5d:4e52:0:b0:21f:15aa:1174 with SMTP id r18-20020a5d4e52000000b0021f15aa1174mr8816403wrt.106.1660573805731; Mon, 15 Aug 2022 07:30:05 -0700 (PDT) Received: from localhost.localdomain ([94.73.32.249]) by smtp.gmail.com with ESMTPSA id m7-20020a056000008700b00224f895d620sm5456894wrx.48.2022.08.15.07.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:30:05 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, j.witteveen@gmail.com, nathan@kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH v4 3/8] HID: uclogic: Refactor UGEE v2 frame initialization Date: Mon, 15 Aug 2022 16:29:51 +0200 Message-Id: <20220815142956.19180-4-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815142956.19180-1-jose.exposito89@gmail.com> References: <20220815142956.19180-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org At the moment, the driver only supports UGEE v2 devices that have buttons in their frames. In order to support other types of frames in the future, move the code used to initialize this kind of frames to its own function. Tested-by: Jouke Witteveen Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-params.c | 56 ++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 07c5a21112ce..182e6f8f027a 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1112,6 +1112,41 @@ static int uclogic_params_parse_ugee_v2_desc(const __u8 *str_desc, return 0; } +/** + * uclogic_params_ugee_v2_init_frame_buttons() - initialize a UGEE v2 frame with + * buttons. + * @p: Parameters to fill in, cannot be NULL. + * @desc_params: Device description params list. + * @desc_params_size: Size of the description params list. + * + * Returns: + * Zero, if successful. A negative errno code on error. + */ +static int uclogic_params_ugee_v2_init_frame_buttons(struct uclogic_params *p, + const s32 *desc_params, + size_t desc_params_size) +{ + __u8 *rdesc_frame = NULL; + int rc = 0; + + if (!p || desc_params_size != UCLOGIC_RDESC_PH_ID_NUM) + return -EINVAL; + + rdesc_frame = uclogic_rdesc_template_apply( + uclogic_rdesc_ugee_v2_frame_btn_template_arr, + uclogic_rdesc_ugee_v2_frame_btn_template_size, + desc_params, UCLOGIC_RDESC_PH_ID_NUM); + if (!rdesc_frame) + return -ENOMEM; + + rc = uclogic_params_frame_init_with_desc(&p->frame_list[0], + rdesc_frame, + uclogic_rdesc_ugee_v2_frame_btn_template_size, + UCLOGIC_RDESC_V1_FRAME_ID); + kfree(rdesc_frame); + return rc; +} + /** * uclogic_params_ugee_v2_init() - initialize a UGEE graphics tablets by * discovering their parameters. @@ -1140,7 +1175,6 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, const int str_desc_len = 12; __u8 *str_desc = NULL; __u8 *rdesc_pen = NULL; - __u8 *rdesc_frame = NULL; s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; __u8 magic_arr[] = { 0x02, 0xb0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 @@ -1209,24 +1243,10 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, p.pen.subreport_list[0].id = UCLOGIC_RDESC_V1_FRAME_ID; /* Initialize the frame interface */ - rdesc_frame = uclogic_rdesc_template_apply( - uclogic_rdesc_ugee_v2_frame_btn_template_arr, - uclogic_rdesc_ugee_v2_frame_btn_template_size, - desc_params, ARRAY_SIZE(desc_params)); - if (!rdesc_frame) { - rc = -ENOMEM; + rc = uclogic_params_ugee_v2_init_frame_buttons(&p, desc_params, + ARRAY_SIZE(desc_params)); + if (rc) goto cleanup; - } - - rc = uclogic_params_frame_init_with_desc(&p.frame_list[0], - rdesc_frame, - uclogic_rdesc_ugee_v2_frame_btn_template_size, - UCLOGIC_RDESC_V1_FRAME_ID); - kfree(rdesc_frame); - if (rc) { - uclogic_params_init_invalid(&p); - goto output; - } output: /* Output parameters */ From patchwork Mon Aug 15 14:29:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 597389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A09B8C3F6B0 for ; Mon, 15 Aug 2022 14:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232805AbiHOOaL (ORCPT ); Mon, 15 Aug 2022 10:30:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243091AbiHOOaK (ORCPT ); Mon, 15 Aug 2022 10:30:10 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2A5523BE9; Mon, 15 Aug 2022 07:30:07 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id b4so6158616wrn.4; Mon, 15 Aug 2022 07:30:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=dZ/fJ6w2SYC/Ln+9NqEZ1OHHpZ+16zxJeQL4xfoSVpg=; b=ZKBl6WmblXCCEdtmTV6UdlAJQ+EquxNccUIpsdKUW4xGfIuzeCTlmI44IUvQ/doclH pIEV/EL46nGHEAQr/ekElGDKUCoctTAzeoPjmgrp49GRuRs6s5HVpDe9lDiAFQt+siAj DYDspM/e3wP+E43Hlst/ZIqk5vxbZna/huX7zuUQ5uNLr4Ej3V/SZ155uPtRLfSC+quC 9BKo3Uw/8aHInRKkZAEH+L203ffCEe3NU3NDG8hBK7MZ3Ag6Llrn7QQw+/l7ClQzGO+c NGUeMtxjlzqHkDaviCDSHgCD8Xz9/y/IodHN3XhqR9GLCnelqiIoHl7rfTK2N0di8SyE fDSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=dZ/fJ6w2SYC/Ln+9NqEZ1OHHpZ+16zxJeQL4xfoSVpg=; b=cf9kUd4qG9Ek+5SX0U4jDKEenVfdaQyHw4nXy66CPBDypbHqDHp+qKejAvYaT6iwl7 8Qoy2j18OI7UJ9B5FRAxvbVAPQA7i7yyqZ/jYr2TEvAYQG7/czPHosDva2KIT27/OSU5 Su9Ik4u9yGvbkeovvKrkSPOiGeFboY3ZDzZQ5FTHtc83CknNs9WThYaqNl/m2jZhkEK0 oHs7ct225ABtZXMXtTdXmEioSqG+YxSC7PzC4dTbUQQdK80tJIrqTh5mh9csAeQeJrJH gVxoqeH2cpCBG1aplvXavCNRKbjCRd+jDvU2BEapCQlOWIUhehkl9LueZLaleiZIf8Qd sVSA== X-Gm-Message-State: ACgBeo0R64GyMrJTaOOsR3cx/p8hR0Z/kMXjOvhnMLaZs/rtQdGIU8dO AW2lZDdF/296dXKcJuZKOOBhlR9QtqfTuw== X-Google-Smtp-Source: AA6agR5qY9A6dP6/0xv4u7KW4XzWhBqOzIXWMrSY4+qx82xmYunKCp72s6Ag0BYPXcROZNxeGd0thQ== X-Received: by 2002:a5d:45cb:0:b0:220:63e6:da94 with SMTP id b11-20020a5d45cb000000b0022063e6da94mr8609571wrs.265.1660573806546; Mon, 15 Aug 2022 07:30:06 -0700 (PDT) Received: from localhost.localdomain ([94.73.32.249]) by smtp.gmail.com with ESMTPSA id m7-20020a056000008700b00224f895d620sm5456894wrx.48.2022.08.15.07.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:30:06 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, j.witteveen@gmail.com, nathan@kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH v4 4/8] HID: uclogic: Parse the UGEE v2 frame type Date: Mon, 15 Aug 2022 16:29:52 +0200 Message-Id: <20220815142956.19180-5-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815142956.19180-1-jose.exposito89@gmail.com> References: <20220815142956.19180-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The string descriptor returned by UGEE v2 devices contains a byte indicating the device frame type. The values discovered so far are: - 0: Frame with buttons, present in the XP-PEN Deco L. - 1: Frame with buttons and dial, present in the PARBLO A610 PRO. - 2: Frame with buttons and a mouse, shaped as a dial + touchpad. Present in the XP-PEN Deco Pro S. Parse the frame type and add KUnit tests. Tested-by: Jouke Witteveen Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-params-test.c | 35 ++++++++++++++++++++++++++- drivers/hid/hid-uclogic-params.c | 19 ++++++++++++--- drivers/hid/hid-uclogic-params.h | 10 ++++++++ 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/drivers/hid/hid-uclogic-params-test.c b/drivers/hid/hid-uclogic-params-test.c index 9f043f2ab387..57ef5d3e4b74 100644 --- a/drivers/hid/hid-uclogic-params-test.c +++ b/drivers/hid/hid-uclogic-params-test.c @@ -7,6 +7,7 @@ */ #include +#include "./hid-uclogic-params.h" #include "./hid-uclogic-rdesc.h" #define MAX_STR_DESC_SIZE 14 @@ -17,6 +18,7 @@ struct uclogic_parse_ugee_v2_desc_case { const __u8 str_desc[MAX_STR_DESC_SIZE]; size_t str_desc_size; const s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; + enum uclogic_params_frame_type frame_type; }; static struct uclogic_parse_ugee_v2_desc_case uclogic_parse_ugee_v2_desc_cases[] = { @@ -26,6 +28,7 @@ static struct uclogic_parse_ugee_v2_desc_case uclogic_parse_ugee_v2_desc_cases[] .str_desc = {}, .str_desc_size = 0, .desc_params = {}, + .frame_type = UCLOGIC_PARAMS_FRAME_BUTTONS, }, { .name = "resolution_with_value_0", @@ -48,6 +51,7 @@ static struct uclogic_parse_ugee_v2_desc_case uclogic_parse_ugee_v2_desc_cases[] [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x08, }, + .frame_type = UCLOGIC_PARAMS_FRAME_BUTTONS, }, /* XP-PEN Deco L str_desc: Frame with 8 buttons */ { @@ -71,6 +75,7 @@ static struct uclogic_parse_ugee_v2_desc_case uclogic_parse_ugee_v2_desc_cases[] [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x08, }, + .frame_type = UCLOGIC_PARAMS_FRAME_BUTTONS, }, /* PARBLO A610 PRO str_desc: Frame with 9 buttons and dial */ { @@ -94,6 +99,31 @@ static struct uclogic_parse_ugee_v2_desc_case uclogic_parse_ugee_v2_desc_cases[] [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x09, }, + .frame_type = UCLOGIC_PARAMS_FRAME_DIAL, + }, + /* XP-PEN Deco Pro S str_desc: Frame with 8 buttons and mouse */ + { + .name = "frame_type_mouse", + .res = 0, + .str_desc = { + 0x0E, 0x03, + 0xC8, 0xB3, + 0x34, 0x65, + 0x08, + 0x02, + 0xFF, 0x1F, + 0xD8, 0x13, + }, + .str_desc_size = 12, + .desc_params = { + [UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xB3C8, + [UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0x2363, + [UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 0x6534, + [UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0x13EC, + [UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0x1FFF, + [UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0x08, + }, + .frame_type = UCLOGIC_PARAMS_FRAME_MOUSE, }, }; @@ -110,12 +140,14 @@ static void uclogic_parse_ugee_v2_desc_test(struct kunit *test) { int res; s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; + enum uclogic_params_frame_type frame_type; const struct uclogic_parse_ugee_v2_desc_case *params = test->param_value; res = uclogic_params_parse_ugee_v2_desc(params->str_desc, params->str_desc_size, desc_params, - ARRAY_SIZE(desc_params)); + ARRAY_SIZE(desc_params), + &frame_type); KUNIT_ASSERT_EQ(test, res, params->res); if (res) @@ -139,6 +171,7 @@ static void uclogic_parse_ugee_v2_desc_test(struct kunit *test) KUNIT_EXPECT_EQ(test, params->desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM], desc_params[UCLOGIC_RDESC_FRAME_PH_ID_UM]); + KUNIT_EXPECT_EQ(test, params->frame_type, frame_type); } static struct kunit_case hid_uclogic_params_test_cases[] = { diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 182e6f8f027a..7845dd5fb4b1 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1064,6 +1064,7 @@ static int uclogic_probe_interface(struct hid_device *hdev, u8 *magic_arr, * @str_desc_size: Size of the string descriptor. * @desc_params: Output description params list. * @desc_params_size: Size of the output description params list. + * @frame_type: Output frame type. * * Returns: * Zero, if successful. A negative errno code on error. @@ -1071,7 +1072,8 @@ static int uclogic_probe_interface(struct hid_device *hdev, u8 *magic_arr, static int uclogic_params_parse_ugee_v2_desc(const __u8 *str_desc, size_t str_desc_size, s32 *desc_params, - size_t desc_params_size) + size_t desc_params_size, + enum uclogic_params_frame_type *frame_type) { s32 pen_x_lm, pen_y_lm; s32 pen_x_pm, pen_y_pm; @@ -1091,6 +1093,7 @@ static int uclogic_params_parse_ugee_v2_desc(const __u8 *str_desc, pen_x_lm = get_unaligned_le16(str_desc + 2); pen_y_lm = get_unaligned_le16(str_desc + 4); frame_num_buttons = str_desc[6]; + *frame_type = str_desc[7]; pen_pressure_lm = get_unaligned_le16(str_desc + 8); resolution = get_unaligned_le16(str_desc + 10); @@ -1176,6 +1179,7 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, __u8 *str_desc = NULL; __u8 *rdesc_pen = NULL; s32 desc_params[UCLOGIC_RDESC_PH_ID_NUM]; + enum uclogic_params_frame_type frame_type; __u8 magic_arr[] = { 0x02, 0xb0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -1219,7 +1223,8 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, rc = uclogic_params_parse_ugee_v2_desc(str_desc, str_desc_len, desc_params, - ARRAY_SIZE(desc_params)); + ARRAY_SIZE(desc_params), + &frame_type); if (rc) goto cleanup; @@ -1243,8 +1248,14 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, p.pen.subreport_list[0].id = UCLOGIC_RDESC_V1_FRAME_ID; /* Initialize the frame interface */ - rc = uclogic_params_ugee_v2_init_frame_buttons(&p, desc_params, - ARRAY_SIZE(desc_params)); + switch (frame_type) { + case UCLOGIC_PARAMS_FRAME_BUTTONS: + default: + rc = uclogic_params_ugee_v2_init_frame_buttons(&p, desc_params, + ARRAY_SIZE(desc_params)); + break; + } + if (rc) goto cleanup; diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h index 5bef8daaa607..a97477c02ff8 100644 --- a/drivers/hid/hid-uclogic-params.h +++ b/drivers/hid/hid-uclogic-params.h @@ -29,6 +29,16 @@ enum uclogic_params_pen_inrange { UCLOGIC_PARAMS_PEN_INRANGE_NONE, }; +/* Types of frames */ +enum uclogic_params_frame_type { + /* Frame with buttons */ + UCLOGIC_PARAMS_FRAME_BUTTONS = 0, + /* Frame with buttons and a dial */ + UCLOGIC_PARAMS_FRAME_DIAL, + /* Frame with buttons and a mouse (shaped as a dial + touchpad) */ + UCLOGIC_PARAMS_FRAME_MOUSE, +}; + /* * Pen report's subreport data. */ From patchwork Mon Aug 15 14:29:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 597390 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C3D1C282E7 for ; Mon, 15 Aug 2022 14:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243069AbiHOOaM (ORCPT ); Mon, 15 Aug 2022 10:30:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243097AbiHOOaK (ORCPT ); Mon, 15 Aug 2022 10:30:10 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8619F240A2; Mon, 15 Aug 2022 07:30:09 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id r83-20020a1c4456000000b003a5cb389944so3983508wma.4; Mon, 15 Aug 2022 07:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=xEMJW+M4kKzzNZdzcoZxv1ikwmN5FhOm+J6/SYL2VKI=; b=a/F4U9dT7FO+CCTv3KQCctKEv4s/yj6g3Ebk691blo3XqWfYbIKV7at85rGTggSO0w 6oZb0Hap2a/ZTlCcQ5VouimwVYbSQhooCIS3tEcF8zuY+XY1NgitF7adue1ZXT1ckWi5 ZeCWC8GWA7ot0aZZQGwrDsldhPNvOoa6wOMR3JuX5KYNMX4IOfhqd9v4XfT4ha1d5dW1 bQaUFNQs3nn2gVYT840aoI7Pgoc59PCQE99pvX8J5sSjLCzfCgoXeNqLoHU+MwH/Ot3n cXUG/YuTAU9soS2wnZP/lArR/za+ra3BRKc68c8+SrokpzyovPSMmwTshCSXzOlquZZL Wijw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=xEMJW+M4kKzzNZdzcoZxv1ikwmN5FhOm+J6/SYL2VKI=; b=CU5dX83+t2RshAmmcnOYz2k/tNg3885CUq0NhCq47loTyvx89N4cl7ZlHoocxsF4N7 8SJ+7uTj1jMtPOY870Zd+TufvyYvdq9uWiVRzkJo7KJ+2pajii1FsSEZKz6svpbjcPkT XO9MtCyMQavHZMLgsfw/WWB7tqMpSxcr2Uzksc2rjZ4veEg1E7AKEm989gtWkCnGW13p B1+FKqorPHinp2vGbNb35rES+0tZqeHGxRiyUERqewH+yeHUHNuyUyFSAyX9m1Z0MfNc Per/fJYhf7lerguLEmgyXXxzly+rl823VkRjuMutLYHV4xJLb89Z8FCwOdPxnt/pJEnA 3Ipg== X-Gm-Message-State: ACgBeo3bi+PsgB8z698tGMXzJrP20oEkF/2Hebe6vLJXpJ4uqqtT3xxF E/Qu2uXcBQHKADrDFaxcSD+xT6MfKHsipg== X-Google-Smtp-Source: AA6agR6AfdeokKdyFrRyxrHca76D5uOPLLJCQ7jbVeM2DXyJh+5Xln7UvzMaQXTJpXfMu5j/0lzQYA== X-Received: by 2002:a05:600c:3aca:b0:3a5:fd94:ed7e with SMTP id d10-20020a05600c3aca00b003a5fd94ed7emr1800057wms.58.1660573807796; Mon, 15 Aug 2022 07:30:07 -0700 (PDT) Received: from localhost.localdomain ([94.73.32.249]) by smtp.gmail.com with ESMTPSA id m7-20020a056000008700b00224f895d620sm5456894wrx.48.2022.08.15.07.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:30:07 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, j.witteveen@gmail.com, nathan@kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH v4 5/8] HID: uclogic: Add support for UGEE v2 dial frames Date: Mon, 15 Aug 2022 16:29:53 +0200 Message-Id: <20220815142956.19180-6-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815142956.19180-1-jose.exposito89@gmail.com> References: <20220815142956.19180-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add the required HID descriptors and the initialization function for UGEE v2 frames with a bitmap dial. Tested-by: Jouke Witteveen Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-params.c | 44 ++++++++++++++++++++++++++++++++ drivers/hid/hid-uclogic-rdesc.c | 40 +++++++++++++++++++++++++++++ drivers/hid/hid-uclogic-rdesc.h | 4 +++ 3 files changed, 88 insertions(+) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 7845dd5fb4b1..950615f95abc 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1150,6 +1150,45 @@ static int uclogic_params_ugee_v2_init_frame_buttons(struct uclogic_params *p, return rc; } +/** + * uclogic_params_ugee_v2_init_frame_dial() - initialize a UGEE v2 frame with a + * bitmap dial. + * @p: Parameters to fill in, cannot be NULL. + * @desc_params: Device description params list. + * @desc_params_size: Size of the description params list. + * + * Returns: + * Zero, if successful. A negative errno code on error. + */ +static int uclogic_params_ugee_v2_init_frame_dial(struct uclogic_params *p, + const s32 *desc_params, + size_t desc_params_size) +{ + __u8 *rdesc_frame = NULL; + int rc = 0; + + if (!p || desc_params_size != UCLOGIC_RDESC_PH_ID_NUM) + return -EINVAL; + + rdesc_frame = uclogic_rdesc_template_apply( + uclogic_rdesc_ugee_v2_frame_dial_template_arr, + uclogic_rdesc_ugee_v2_frame_dial_template_size, + desc_params, UCLOGIC_RDESC_PH_ID_NUM); + if (!rdesc_frame) + return -ENOMEM; + + rc = uclogic_params_frame_init_with_desc(&p->frame_list[0], + rdesc_frame, + uclogic_rdesc_ugee_v2_frame_dial_template_size, + UCLOGIC_RDESC_V1_FRAME_ID); + kfree(rdesc_frame); + if (rc) + return rc; + + p->frame_list[0].bitmap_dial_byte = 7; + return 0; +} + /** * uclogic_params_ugee_v2_init() - initialize a UGEE graphics tablets by * discovering their parameters. @@ -1249,6 +1288,11 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, /* Initialize the frame interface */ switch (frame_type) { + case UCLOGIC_PARAMS_FRAME_DIAL: + case UCLOGIC_PARAMS_FRAME_MOUSE: + rc = uclogic_params_ugee_v2_init_frame_dial(&p, desc_params, + ARRAY_SIZE(desc_params)); + break; case UCLOGIC_PARAMS_FRAME_BUTTONS: default: rc = uclogic_params_ugee_v2_init_frame_buttons(&p, desc_params, diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index 3d68e8b0784d..22429df693fc 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -961,6 +961,46 @@ const __u8 uclogic_rdesc_ugee_v2_frame_btn_template_arr[] = { const size_t uclogic_rdesc_ugee_v2_frame_btn_template_size = sizeof(uclogic_rdesc_ugee_v2_frame_btn_template_arr); +/* Fixed report descriptor template for UGEE v2 frame reports (dial) */ +const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[] = { + 0x05, 0x01, /* Usage Page (Desktop), */ + 0x09, 0x07, /* Usage (Keypad), */ + 0xA1, 0x01, /* Collection (Application), */ + 0x85, UCLOGIC_RDESC_V1_FRAME_ID, + /* Report ID, */ + 0x05, 0x0D, /* Usage Page (Digitizer), */ + 0x09, 0x39, /* Usage (Tablet Function Keys), */ + 0xA0, /* Collection (Physical), */ + 0x75, 0x01, /* Report Size (1), */ + 0x95, 0x08, /* Report Count (8), */ + 0x81, 0x01, /* Input (Constant), */ + 0x05, 0x09, /* Usage Page (Button), */ + 0x19, 0x01, /* Usage Minimum (01h), */ + UCLOGIC_RDESC_FRAME_PH_BTN, + /* Usage Maximum (PLACEHOLDER), */ + 0x95, 0x0A, /* Report Count (10), */ + 0x14, /* Logical Minimum (0), */ + 0x25, 0x01, /* Logical Maximum (1), */ + 0x81, 0x02, /* Input (Variable), */ + 0x95, 0x06, /* Report Count (6), */ + 0x81, 0x01, /* Input (Constant), */ + 0x75, 0x08, /* Report Size (8), */ + 0x95, 0x03, /* Report Count (3), */ + 0x81, 0x01, /* Input (Constant), */ + 0x05, 0x01, /* Usage Page (Desktop), */ + 0x09, 0x38, /* Usage (Wheel), */ + 0x95, 0x01, /* Report Count (1), */ + 0x15, 0xFF, /* Logical Minimum (-1), */ + 0x25, 0x01, /* Logical Maximum (1), */ + 0x81, 0x06, /* Input (Variable, Relative), */ + 0x95, 0x02, /* Report Count (2), */ + 0x81, 0x01, /* Input (Constant), */ + 0xC0, /* End Collection, */ + 0xC0 /* End Collection */ +}; +const size_t uclogic_rdesc_ugee_v2_frame_dial_template_size = + sizeof(uclogic_rdesc_ugee_v2_frame_dial_template_arr); + /* Fixed report descriptor for Ugee EX07 frame */ const __u8 uclogic_rdesc_ugee_ex07_frame_arr[] = { 0x05, 0x01, /* Usage Page (Desktop), */ diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h index 86e64a9ee6bd..1a2d658bad3a 100644 --- a/drivers/hid/hid-uclogic-rdesc.h +++ b/drivers/hid/hid-uclogic-rdesc.h @@ -169,6 +169,10 @@ extern const size_t uclogic_rdesc_ugee_v2_pen_template_size; extern const __u8 uclogic_rdesc_ugee_v2_frame_btn_template_arr[]; extern const size_t uclogic_rdesc_ugee_v2_frame_btn_template_size; +/* Fixed report descriptor template for UGEE v2 frame reports (dial) */ +extern const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[]; +extern const size_t uclogic_rdesc_ugee_v2_frame_dial_template_size; + /* Fixed report descriptor for Ugee EX07 frame */ extern const __u8 uclogic_rdesc_ugee_ex07_frame_arr[]; extern const size_t uclogic_rdesc_ugee_ex07_frame_size; From patchwork Mon Aug 15 14:29:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 597733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45E95C00140 for ; Mon, 15 Aug 2022 14:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243104AbiHOOaM (ORCPT ); Mon, 15 Aug 2022 10:30:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243100AbiHOOaL (ORCPT ); Mon, 15 Aug 2022 10:30:11 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66AB0248C0; Mon, 15 Aug 2022 07:30:10 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id b4so6158773wrn.4; Mon, 15 Aug 2022 07:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=ap7GqyMuCh9a8meEeM9i/c24fMUejNJyKTIvsoAZZXI=; b=U83mxDNAW6l9ChGVGk8tQfNuo5k7h8sDbglfw/HLxUemAfXKUVmrKmib7YHCCKC2vJ F8FD65QPktZ7RrUgViPYJNiKLVPWX/lU0mkeQ5gtgrzHdywpRr7t2Qc43mukCBMFVlL1 h3t4vuMTWoO1GOFkjJD1UWmcAFbShjJyfIMgueEgz36/i9Niw8zgv4JqndyX/Lus1Tjo 8R9Cpwwuwv/VDqe+0oSpbitWOx2mzdbt2Ev1OhJ0dULIFjBBGmSrzNDa+BgldsySbmEn tD4/pFOHN60eqcMpvJBFXE9uMcaGxZfOJT7CzgCqFisT0iFFezaACYlNK83+1j0LmZps ea0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=ap7GqyMuCh9a8meEeM9i/c24fMUejNJyKTIvsoAZZXI=; b=Wq6MWg6kT4Wvk47rtSy8BrGSkU7NvzIq9i7yP8jKo2WAifhZuf+14BoldP8K3BHSiU ATLxnASsfbRDJmzjToGiewRDrNK/DUGOS2I6lkZrintBPpxlJkUS2BAu5DLNzhdcE/GL uHlQZ956Z5vDnCpDNHuEErOXexdY6tP9W/UEi01vbDCivv2uftnZx3Q0fNXzadVTzt8U xajKUV4zLGkvYRBB86eV1ao9cDSZTAs5GIX4wVzn4DHNEEORJKfXtuby8dgmUNeeLwwa Gndi5G6sDsSXJjGXgBkSZh/7eHu6GneiOXUkCkz6QtPWbPaxDM6hrnHTeBeYKmkVahcU Vh9Q== X-Gm-Message-State: ACgBeo3xZCAwOdzk2TdaQ4IrYF2WtbrtnMwNYfqbjLTqW4w3nS5Qk5rG ZBCJMfWHSw4sJhf7uzVL33A= X-Google-Smtp-Source: AA6agR7l6TyW+I2EIFhFT9LI0PtAjjqt+xAqlAX0hpWGtlruBKqxMO+6WGpeiMz2hhHUNfr8C+mLkQ== X-Received: by 2002:a5d:4201:0:b0:21d:7b63:1b43 with SMTP id n1-20020a5d4201000000b0021d7b631b43mr8566620wrq.225.1660573808884; Mon, 15 Aug 2022 07:30:08 -0700 (PDT) Received: from localhost.localdomain ([94.73.32.249]) by smtp.gmail.com with ESMTPSA id m7-20020a056000008700b00224f895d620sm5456894wrx.48.2022.08.15.07.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:30:08 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, j.witteveen@gmail.com, nathan@kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH v4 6/8] HID: uclogic: Add support for UGEE v2 mouse frames Date: Mon, 15 Aug 2022 16:29:54 +0200 Message-Id: <20220815142956.19180-7-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815142956.19180-1-jose.exposito89@gmail.com> References: <20220815142956.19180-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add the required HID descriptors and the initialization function for UGEE v2 frames with a mouse in the frame. Tested-by: Jouke Witteveen Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-params.c | 31 +++++++++++++++++++++++++++++ drivers/hid/hid-uclogic-rdesc.c | 34 ++++++++++++++++++++++++++++++++ drivers/hid/hid-uclogic-rdesc.h | 4 ++++ 3 files changed, 69 insertions(+) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 950615f95abc..648abda13a73 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1189,6 +1189,28 @@ static int uclogic_params_ugee_v2_init_frame_dial(struct uclogic_params *p, return 0; } +/** + * uclogic_params_ugee_v2_init_frame_mouse() - initialize a UGEE v2 frame with a + * mouse. + * @p: Parameters to fill in, cannot be NULL. + * + * Returns: + * Zero, if successful. A negative errno code on error. + */ +static int uclogic_params_ugee_v2_init_frame_mouse(struct uclogic_params *p) +{ + int rc = 0; + + if (!p) + return -EINVAL; + + rc = uclogic_params_frame_init_with_desc(&p->frame_list[1], + uclogic_rdesc_ugee_v2_frame_mouse_template_arr, + uclogic_rdesc_ugee_v2_frame_mouse_template_size, + UCLOGIC_RDESC_V1_FRAME_ID); + return rc; +} + /** * uclogic_params_ugee_v2_init() - initialize a UGEE graphics tablets by * discovering their parameters. @@ -1232,6 +1254,15 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, iface = to_usb_interface(hdev->dev.parent); bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; + + if (bInterfaceNumber == 0) { + rc = uclogic_params_ugee_v2_init_frame_mouse(&p); + if (rc) + goto cleanup; + + goto output; + } + if (bInterfaceNumber != 2) { uclogic_params_init_invalid(&p); goto output; diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index 22429df693fc..fb9ca69f72c2 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -1001,6 +1001,40 @@ const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[] = { const size_t uclogic_rdesc_ugee_v2_frame_dial_template_size = sizeof(uclogic_rdesc_ugee_v2_frame_dial_template_arr); +/* Fixed report descriptor template for UGEE v2 frame reports (mouse) */ +const __u8 uclogic_rdesc_ugee_v2_frame_mouse_template_arr[] = { + 0x05, 0x01, /* Usage Page (Desktop), */ + 0x09, 0x02, /* Usage (Mouse), */ + 0xA1, 0x01, /* Collection (Application), */ + 0x85, 0x01, /* Report ID (1), */ + 0x05, 0x01, /* Usage Page (Pointer), */ + 0xA0, /* Collection (Physical), */ + 0x75, 0x01, /* Report Size (1), */ + 0x95, 0x02, /* Report Count (2), */ + 0x05, 0x09, /* Usage Page (Button), */ + 0x19, 0x01, /* Usage Minimum (01h), */ + 0x29, 0x02, /* Usage Maximum (02h), */ + 0x14, /* Logical Minimum (0), */ + 0x25, 0x01, /* Logical Maximum (1), */ + 0x81, 0x02, /* Input (Variable), */ + 0x95, 0x06, /* Report Count (6), */ + 0x81, 0x01, /* Input (Constant), */ + 0x05, 0x01, /* Usage Page (Generic Desktop), */ + 0x09, 0x30, /* Usage (X), */ + 0x09, 0x31, /* Usage (Y), */ + 0x75, 0x10, /* Report Size (16), */ + 0x95, 0x02, /* Report Count (2), */ + 0x16, 0x00, 0x80, /* Logical Minimum (-32768), */ + 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ + 0x81, 0x06, /* Input (Variable, Relative), */ + 0x95, 0x01, /* Report Count (1), */ + 0x81, 0x01, /* Input (Constant), */ + 0xC0, /* End Collection, */ + 0xC0 /* End Collection */ +}; +const size_t uclogic_rdesc_ugee_v2_frame_mouse_template_size = + sizeof(uclogic_rdesc_ugee_v2_frame_mouse_template_arr); + /* Fixed report descriptor for Ugee EX07 frame */ const __u8 uclogic_rdesc_ugee_ex07_frame_arr[] = { 0x05, 0x01, /* Usage Page (Desktop), */ diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h index 1a2d658bad3a..0502a0656496 100644 --- a/drivers/hid/hid-uclogic-rdesc.h +++ b/drivers/hid/hid-uclogic-rdesc.h @@ -173,6 +173,10 @@ extern const size_t uclogic_rdesc_ugee_v2_frame_btn_template_size; extern const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[]; extern const size_t uclogic_rdesc_ugee_v2_frame_dial_template_size; +/* Fixed report descriptor template for UGEE v2 frame reports (mouse) */ +extern const __u8 uclogic_rdesc_ugee_v2_frame_mouse_template_arr[]; +extern const size_t uclogic_rdesc_ugee_v2_frame_mouse_template_size; + /* Fixed report descriptor for Ugee EX07 frame */ extern const __u8 uclogic_rdesc_ugee_ex07_frame_arr[]; extern const size_t uclogic_rdesc_ugee_ex07_frame_size; From patchwork Mon Aug 15 14:29:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 597388 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB2A3C28B2B for ; Mon, 15 Aug 2022 14:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233294AbiHOOaN (ORCPT ); Mon, 15 Aug 2022 10:30:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243106AbiHOOaM (ORCPT ); Mon, 15 Aug 2022 10:30:12 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5405323BE9; Mon, 15 Aug 2022 07:30:11 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id v3so9308599wrp.0; Mon, 15 Aug 2022 07:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=bRXt4bW44m9/UkTOv2HejE0QpMPchFfmA0YLq1fgjpk=; b=orG6YehBCcf6F/FyXIAUhX+NBrAuEgBIn63FFDCQI/a/xg8UbUa4BThx4Dy1y1Vqdg cZQ7MlTdsDUE8VeuUpAaRzJOwm+3K/XWpiQ9gDCE8/QY/6eyI0ZnZVVq7lXIxkpUuDCG liSCliT2Dv60f/ZcR8E+5+aaRTDZD3Xk2hoLdeBax3WgtKVSuA7PjBHhSwgaTMeZmOLr yuHmhMdWUaZZVo83xmVoVt/Zp8aKjlGkNZ+jQqX0OHvivq6slluBQBAU2Ge+YU3M6ICJ Np7fCzkhLgsnF0RE2PnNDS5eaqKlPAm2fxDhaxHCNSAb6cObvXU+qdXtFBbBjDsnt3qq ZhrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=bRXt4bW44m9/UkTOv2HejE0QpMPchFfmA0YLq1fgjpk=; b=2ivRczWhpiwWTd4ukkUq67/USqxDDOoQSuzh0KwjtGTr/QX4czOHQc2UEXSR/6fnY9 gnct+1cJHuN0fc7/Kew8hO1iHRF38CbHh1PDKwH6xzm3xcBkivqUghPLCeDLg+HKKSQU JTgA6xp6ri3t0TavaaMQkNqpT3SAVzKWsF9C1Q3vAYoo/f+Q/aZp/itcxydMMep2VIq4 2fjOTUuoYlgWVmK3IreDtPH2GzgiTWEjYfW+F1D9vq8xTveacmP0dVefstBJTeyNksnU SKHZoKUIObIYxVYJUW/KkQGKY8iVIV/0/7xWWOB0YA8tg/Bena0LtEayzohSHsQ/bC3C fegQ== X-Gm-Message-State: ACgBeo3LW/DCBNKLKDYxm2jmYuho6YT43mACMyfpAbVoV+Cll5WnP6/T ydy7AsKP2ghTRQNs6n5hgZQ= X-Google-Smtp-Source: AA6agR7bznPAIkBiJbUmrv8LNcombZBhfEcR2A5GH7DR2SdI51B80RrYlFizeUHKZN/q1tKWrq+/Cg== X-Received: by 2002:a5d:5343:0:b0:220:6203:ed4a with SMTP id t3-20020a5d5343000000b002206203ed4amr8528635wrv.146.1660573809911; Mon, 15 Aug 2022 07:30:09 -0700 (PDT) Received: from localhost.localdomain ([94.73.32.249]) by smtp.gmail.com with ESMTPSA id m7-20020a056000008700b00224f895d620sm5456894wrx.48.2022.08.15.07.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:30:09 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, j.witteveen@gmail.com, nathan@kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH v4 7/8] HID: uclogic: Add support for XP-PEN Deco Pro S Date: Mon, 15 Aug 2022 16:29:55 +0200 Message-Id: <20220815142956.19180-8-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815142956.19180-1-jose.exposito89@gmail.com> References: <20220815142956.19180-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The XP-PEN Deco Pro S is a UGEE v2 device with a frame with 8 buttons, a bitmap dial and a mouse. Its pen has 2 buttons, supports tilt and pressure. All the pieces to support it are already in place. Add its ID in order to support the device. The required Wireshark traces were captured by Jouke Witteveen. For more information check [1]. Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/738 [1] Tested-by: Jouke Witteveen Signed-off-by: José Expósito --- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-uclogic-core.c | 2 ++ drivers/hid/hid-uclogic-params.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 0fb720a96399..ecf1468404b3 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -1280,6 +1280,7 @@ #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_G640 0x0094 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01 0x0042 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L 0x0935 +#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S 0x0909 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06 0x0078 #define USB_DEVICE_ID_UGEE_TABLET_G5 0x0074 #define USB_DEVICE_ID_UGEE_TABLET_EX07S 0x0071 diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c index 47a17375c7fc..6fcdb141acec 100644 --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -523,6 +523,8 @@ static const struct hid_device_id uclogic_devices[] = { USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO01) }, { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L) }, + { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, + USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S) }, { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06) }, { } diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 648abda13a73..60ed94981a55 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1582,6 +1582,8 @@ int uclogic_params_init(struct uclogic_params *params, break; case VID_PID(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L): + case VID_PID(USB_VENDOR_ID_UGEE, + USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S): rc = uclogic_params_ugee_v2_init(&p, hdev); if (rc != 0) goto cleanup; From patchwork Mon Aug 15 14:29:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 597732 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7099CC25B06 for ; Mon, 15 Aug 2022 14:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243115AbiHOOaO (ORCPT ); Mon, 15 Aug 2022 10:30:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243111AbiHOOaN (ORCPT ); Mon, 15 Aug 2022 10:30:13 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4031D23BF1; Mon, 15 Aug 2022 07:30:12 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id j1so9294677wrw.1; Mon, 15 Aug 2022 07:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=xxHC06/Os8ziAl2SBnJlxSxiEi0i7a6+qXGKYnTl3x4=; b=AsBNtOtBuZg+ucZYXZPWvl+wLsJJeol+G+sKqa92iBhbiXAo8uWBpWtLMhgJEIqmyv 3hP+g6k87IaPdrYezqweW4coMvYD/TxcI1fv6pt4JnShAu8Fs2iyo3wq+x5hiBQT2PE5 4NT1llsmb6xy5taAdFSPFaJNkldVVHlv/QgMjXQHQ7/cS7S2U7kYdk+cXQCjGmOqSJF/ TToE6wxfq5uapQGBYB/2/lkBhy5kqGvirYX9i7xZHS6MpCLXkB5y/O7VW9f/u1/6P/VB tRqFvraFzI1QXQ5HWMR+tQw9axISGQ2fDmrVyht2XRQ4losfQK11ukaznMU3+WNBPpFT am7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=xxHC06/Os8ziAl2SBnJlxSxiEi0i7a6+qXGKYnTl3x4=; b=XMA6GZ8dGiJlsxX3hoBKsiAD8q2q63RZedKFLu9lx8flVhHhbYoJC24ALaHXgNHYBM pqeOK96pDvnwLg5KSF3f0oPgSeCor11kzChHr4UUTwIdkf+fIipw5lK35YUAOrZQoyGg KBpekkK86dAReFavwjAxg8ElRIFNUPydh3h4MIhrN5fQsEopath+0CGAWdsk4jt0EmEF JduudcCgd4TvBe2aB+MvbHmpNI3IU1MjEB6QaZZhpIOGvAFALUYXCI0CtAsoU1mAoA7Z zPyOUmJeVkjVLAizvMeqVDi2nE3sBIIdJZv9gvaGnFLrv+D2RKVj0H7vpHFefZWzo3zJ 5pZw== X-Gm-Message-State: ACgBeo2E7VL57esjJMu5rapbFFK3f34jJ1/dxqPELJhRh3aElX6wbbk5 55Zkm3qEk/N+lDCD4zBZr5rWYCgakAUc4Q== X-Google-Smtp-Source: AA6agR75zw4cdAZTd7ANv2PbiYz9wZE8aOZo7ES4acPI3bGepibaOMkkhMoX27dfOWFGVAUArhw5Jw== X-Received: by 2002:a5d:59a4:0:b0:220:805a:bc65 with SMTP id p4-20020a5d59a4000000b00220805abc65mr8929397wrr.302.1660573810800; Mon, 15 Aug 2022 07:30:10 -0700 (PDT) Received: from localhost.localdomain ([94.73.32.249]) by smtp.gmail.com with ESMTPSA id m7-20020a056000008700b00224f895d620sm5456894wrx.48.2022.08.15.07.30.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:30:10 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, j.witteveen@gmail.com, nathan@kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH v4 8/8] HID: uclogic: Add support for Parblo A610 PRO Date: Mon, 15 Aug 2022 16:29:56 +0200 Message-Id: <20220815142956.19180-9-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815142956.19180-1-jose.exposito89@gmail.com> References: <20220815142956.19180-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The Parblo A610 PRO is a UGEE v2 device with a frame with 9 buttons and a bitmap dial. Its pen has 2 buttons, supports tilt and pressure. Add its ID in order to support the device. Signed-off-by: José Expósito --- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-uclogic-core.c | 2 ++ drivers/hid/hid-uclogic-params.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index ecf1468404b3..6b4068eecc6f 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -1276,6 +1276,7 @@ #define USB_DEVICE_ID_YIYNOVA_TABLET 0x004d #define USB_VENDOR_ID_UGEE 0x28bd +#define USB_DEVICE_ID_UGEE_PARBLO_A610_PRO 0x1903 #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 diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c index 6fcdb141acec..2efcf48f91ba 100644 --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -509,6 +509,8 @@ static const struct hid_device_id uclogic_devices[] = { USB_DEVICE_ID_UGTIZER_TABLET_GP0610) }, { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GT5040) }, + { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, + USB_DEVICE_ID_UGEE_PARBLO_A610_PRO) }, { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_TABLET_G5) }, { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 60ed94981a55..34fa991e6267 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1580,6 +1580,8 @@ int uclogic_params_init(struct uclogic_params *params, uclogic_params_init_invalid(&p); } break; + case VID_PID(USB_VENDOR_ID_UGEE, + USB_DEVICE_ID_UGEE_PARBLO_A610_PRO): case VID_PID(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L): case VID_PID(USB_VENDOR_ID_UGEE,