From patchwork Sat Feb 19 10:01: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: 544545 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 89411C433FE for ; Sat, 19 Feb 2022 10:02:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241904AbiBSKCc (ORCPT ); Sat, 19 Feb 2022 05:02:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241907AbiBSKCa (ORCPT ); Sat, 19 Feb 2022 05:02:30 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECFE5AE70; Sat, 19 Feb 2022 02:02:11 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id k1so18480293wrd.8; Sat, 19 Feb 2022 02:02:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F5g1OGQu7KmLrerQIkf+CdpmHMxgsPe6tJUKuh6F0rw=; b=fQRDA7oDDA8uAclitux24krqqn/PC0T/OF1c+T5U1h76uDcDJdHdnAg1SSRCw32wHR Y+QdLahvh96+81rrOG4Zq58I18qcOEV+6VEp1kdBco8oi8BJMaxhmYTq4eZ5HQPmszpu U+SbeRxi89r0taQsMEgFM8vLDq6SEe+fUmteTAg1dp3rVopj/5akdmAxDumH30s5mEmD TpsQT6dcnNnZWx8h3IkcECnLecdb72cEvtXQYAXTOCf3Wkn68XO2wLjYZqPFrmUE+aa9 NNeoaQawfzIXs0nZdKNuv5ODVUzlTffDr/kiGg0EJHxTo60/Yn9SJKE+NnbQUvE9jxRh HsRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F5g1OGQu7KmLrerQIkf+CdpmHMxgsPe6tJUKuh6F0rw=; b=yZ6g15dNax9OGLxPdWontOCSOfWlyevjTUcdzoNoLS7C/SJi5z0t7G+DGL3wPfV6cA 0THveOArJi42O0C3ACtQ/nH1Vk+vxErnrhkqv7M1JfDb0SSpilJeAIfCM8Hsv8nMDYiy On26QDtx1nKhLerCGzJr5G/6WWtIQCK7fZiLF7rw1P04wVeUEGy9MyFGvLSKhzjsJ/JP a54SNNsJ5tW5SItroXOpORRgNb+RJviWc1TEK508TP4rMcykL3JGYefn+Zhk/iXYUw0r QjiiQCx7Tcm1VMjwqNi+mAA7WOAnlI5fcs2wGPXTtc2slWyrY5rGw5svzptZaZZbCVaQ My3Q== X-Gm-Message-State: AOAM531f5F9bJWsrzo3FoSK3udSH5a0/IVLvYkE2hnRAnRDfUb3h3waJ JSfUzklYlLTmTjXVeCjCokI= X-Google-Smtp-Source: ABdhPJwE7t1gHbAv/4AKt41EE0fAFsGsb4jWLty/E+RltTuIOKA7XJElsnl4u6NPC9yUxo3sO2BK3A== X-Received: by 2002:a5d:6a0f:0:b0:1e5:53db:4ddd with SMTP id m15-20020a5d6a0f000000b001e553db4dddmr8885834wru.614.1645264930353; Sat, 19 Feb 2022 02:02:10 -0800 (PST) Received: from localhost.localdomain ([94.73.33.246]) by smtp.gmail.com with ESMTPSA id az13sm24417244wrb.39.2022.02.19.02.02.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 02:02:10 -0800 (PST) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Sm9z?= =?utf-8?b?w6kgRXhww7NzaXRv?= Subject: [PATCH for-5.18/uclogic 1/9] HID: uclogic: Remove pen usage masking Date: Sat, 19 Feb 2022 11:01:49 +0100 Message-Id: <20220219100157.41920-2-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220219100157.41920-1-jose.exposito89@gmail.com> References: <20220219100157.41920-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Nikolai Kondrashov Remove support for pen usage masking from hid-uclogic. Disable whole interfaces instead. Most of those interfaces are useless, and if there is one which has an unused pen usage, but also has useful reports, its report descriptor should be rewritten instead. This simplifies the code and the data structures. Signed-off-by: Nikolai Kondrashov Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-core.c | 23 +---------------------- drivers/hid/hid-uclogic-params.c | 29 +++++------------------------ drivers/hid/hid-uclogic-params.h | 9 +-------- 3 files changed, 7 insertions(+), 54 deletions(-) diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c index 73d79d149869..26849f1f5459 100644 --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -81,24 +81,6 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, return rdesc; } -static int uclogic_input_mapping(struct hid_device *hdev, - struct hid_input *hi, - struct hid_field *field, - struct hid_usage *usage, - unsigned long **bit, - int *max) -{ - struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); - struct uclogic_params *params = &drvdata->params; - - /* discard the unused pen interface */ - if (params->pen_unused && (field->application == HID_DG_PEN)) - return -1; - - /* let hid-core decide what to do */ - return 0; -} - static int uclogic_input_configured(struct hid_device *hdev, struct hid_input *hi) { @@ -374,9 +356,7 @@ static int uclogic_raw_event(struct hid_device *hdev, return 0; /* Tweak pen reports, if necessary */ - if (!params->pen_unused && - (report_id == params->pen.id) && - (size >= 2)) { + if ((report_id == params->pen.id) && (size >= 2)) { /* If it's the "virtual" frame controls report */ if (params->frame.id != 0 && data[1] & params->pen_frame_flag) { @@ -464,7 +444,6 @@ static struct hid_driver uclogic_driver = { .remove = uclogic_remove, .report_fixup = uclogic_report_fixup, .raw_event = uclogic_raw_event, - .input_mapping = uclogic_input_mapping, .input_configured = uclogic_input_configured, #ifdef CONFIG_PM .resume = uclogic_resume, diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 98910d8dae92..71496735cbf0 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -514,8 +514,7 @@ void uclogic_params_cleanup(struct uclogic_params *params) { if (!params->invalid) { kfree(params->desc_ptr); - if (!params->pen_unused) - uclogic_params_pen_cleanup(¶ms->pen); + uclogic_params_pen_cleanup(¶ms->pen); uclogic_params_frame_cleanup(¶ms->frame); memset(params, 0, sizeof(*params)); } @@ -557,7 +556,7 @@ int uclogic_params_get_desc(const struct uclogic_params *params, size = 0; common_present = (params->desc_ptr != NULL); - pen_present = (!params->pen_unused && params->pen.desc_ptr != NULL); + pen_present = (params->pen.desc_ptr != NULL); frame_present = (params->frame.desc_ptr != NULL); if (common_present) @@ -680,21 +679,6 @@ static int uclogic_params_init_with_opt_desc(struct uclogic_params *params, return rc; } -/** - * uclogic_params_init_with_pen_unused() - initialize tablet interface - * parameters preserving original reports and generic HID processing, but - * disabling pen usage. - * - * @params: Parameters to initialize (to be cleaned with - * uclogic_params_cleanup()). Not modified in case of - * error. Cannot be NULL. - */ -static void uclogic_params_init_with_pen_unused(struct uclogic_params *params) -{ - memset(params, 0, sizeof(*params)); - params->pen_unused = true; -} - /** * uclogic_params_huion_init() - initialize a Huion tablet interface and discover * its parameters. @@ -734,8 +718,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params, /* If it's not a pen interface */ if (bInterfaceNumber != 0) { - /* TODO: Consider marking the interface invalid */ - uclogic_params_init_with_pen_unused(&p); + uclogic_params_init_invalid(&p); goto output; } @@ -1033,8 +1016,7 @@ int uclogic_params_init(struct uclogic_params *params, uclogic_params_init_invalid(&p); } } else { - /* TODO: Consider marking the interface invalid */ - uclogic_params_init_with_pen_unused(&p); + uclogic_params_init_invalid(&p); } break; case VID_PID(USB_VENDOR_ID_UGEE, @@ -1056,8 +1038,7 @@ int uclogic_params_init(struct uclogic_params *params, if (rc != 0) goto cleanup; } else { - /* TODO: Consider marking the interface invalid */ - uclogic_params_init_with_pen_unused(&p); + uclogic_params_init_invalid(&p); } break; case VID_PID(USB_VENDOR_ID_TRUST, diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h index e8381bb77bd0..48b974943bb9 100644 --- a/drivers/hid/hid-uclogic-params.h +++ b/drivers/hid/hid-uclogic-params.h @@ -138,14 +138,9 @@ struct uclogic_params { * Only valid, if "desc_ptr" is not NULL. */ unsigned int desc_size; - /* - * True, if pen usage in report descriptor is invalid, when present. - * Only valid, if "invalid" is false. - */ - bool pen_unused; /* * Pen parameters and optional report descriptor part. - * Only valid if "pen_unused" is valid and false. + * Only valid, if "invalid" is false. */ struct uclogic_params_pen pen; /* @@ -171,7 +166,6 @@ extern int uclogic_params_init(struct uclogic_params *params, ".invalid = %s\n" \ ".desc_ptr = %p\n" \ ".desc_size = %u\n" \ - ".pen_unused = %s\n" \ ".pen.desc_ptr = %p\n" \ ".pen.desc_size = %u\n" \ ".pen.id = %u\n" \ @@ -190,7 +184,6 @@ extern int uclogic_params_init(struct uclogic_params *params, ((_params)->invalid ? "true" : "false"), \ (_params)->desc_ptr, \ (_params)->desc_size, \ - ((_params)->pen_unused ? "true" : "false"), \ (_params)->pen.desc_ptr, \ (_params)->pen.desc_size, \ (_params)->pen.id, \ From patchwork Sat Feb 19 10:01: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: 544544 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 0C1A7C433F5 for ; Sat, 19 Feb 2022 10:02:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241910AbiBSKCc (ORCPT ); Sat, 19 Feb 2022 05:02:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231863AbiBSKCb (ORCPT ); Sat, 19 Feb 2022 05:02:31 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF3DAE7B; Sat, 19 Feb 2022 02:02:12 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id i14so18441455wrc.10; Sat, 19 Feb 2022 02:02:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eZnDakesUb8DL99t2x67PNyfBeVgWB/usemeFj0ye8k=; b=O6ilGTc+ZVUwhMubYEC3t4Mlcvr71BhR3Pfngdst2gchWRaWxZF8w5WebfjqzNeSqX rI/G/XiocXFzhnLeXM2XiBrteFyrzXj6N3ZJedvkvegLYmyGc+oXmlAO9NTipe+Tspbt zZWy1I1lM7MOBvyrgkRBTS6G2oc2V/Y2vN9E9y02qg8GDolqob92dMHLGN8srRg+LQV/ o/UOC+nJ4xld89XCnT6YV60tgbh6RjaqhsnSYFM4XzZOVm3PH6etnyld5KKwriDJcXew 97gHtDHRG10zuqHwikkvOlpEqPVLUTjB3DFJQOJEzqPQ4g+7Z77NXcFW5LJt4krJ2J7I u+zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eZnDakesUb8DL99t2x67PNyfBeVgWB/usemeFj0ye8k=; b=wo9hn/bIJFFZycP/P90jfhLGXXwBYLNxIgpCb5APaZPUoHT5oFmACv7b5Xd5j2RQVz drOCGdSLieZc7A6OmaNfCokYRbzdzqjZijMWjnD9gHR3Pl6NE6fKo3Py9ChxKZt2IKmI 8Q8y132pUHrFtBW+/BiHaDIvNMtzskONTGYv1JcZ8A1MywF/yyULMlONOwLR6h+syDhm tyeIJcfuoTDW4zU2f4QAqR5D/2o2yg0/WlpwIbVNv94rvdlpjlfryPiy+BcBOQzYiEgD MAkHJhPv4ZCfpjWjQfisQvrziT03mW4koyoQaYkZyATai2pGCxZHGABom94DQ5XZtc6F clHQ== X-Gm-Message-State: AOAM531SPN9r+Xa8hx1SCVwF591BT3AZupvuxZHop4DDaB6IvQ19h4jw fegJK1e17vG67teJ61zBLsUkFhWhjR4= X-Google-Smtp-Source: ABdhPJzY0Vs/TI+8/NF5WjoQbajJJzXLpm9rXVSRzWKPjS3shj8dN+//RwbWz/ypuLvz5IP9UzIFsQ== X-Received: by 2002:a5d:522a:0:b0:1e3:36c0:6e76 with SMTP id i10-20020a5d522a000000b001e336c06e76mr9188987wra.11.1645264931090; Sat, 19 Feb 2022 02:02:11 -0800 (PST) Received: from localhost.localdomain ([94.73.33.246]) by smtp.gmail.com with ESMTPSA id az13sm24417244wrb.39.2022.02.19.02.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 02:02:10 -0800 (PST) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Sm9z?= =?utf-8?b?w6kgRXhww7NzaXRv?= Subject: [PATCH for-5.18/uclogic 2/9] HID: uclogic: Replace pen_frame_flag with subreport_list Date: Sat, 19 Feb 2022 11:01:50 +0100 Message-Id: <20220219100157.41920-3-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220219100157.41920-1-jose.exposito89@gmail.com> References: <20220219100157.41920-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Nikolai Kondrashov Replace a single pen_frame_flag in struct uclogic_params with subreport_list in struct uclogic_params_pen to prepare for handling more subreports in Huion HS610. Signed-off-by: Nikolai Kondrashov Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-core.c | 40 ++++++++++++++------- drivers/hid/hid-uclogic-params.c | 12 ++++--- drivers/hid/hid-uclogic-params.h | 62 +++++++++++++++++++------------- 3 files changed, 73 insertions(+), 41 deletions(-) diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c index 26849f1f5459..7092f86517a5 100644 --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -350,26 +350,40 @@ static int uclogic_raw_event(struct hid_device *hdev, unsigned int report_id = report->id; struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev); struct uclogic_params *params = &drvdata->params; + struct uclogic_params_pen_subreport *subreport; + struct uclogic_params_pen_subreport *subreport_list_end; /* Do not handle anything but input reports */ if (report->type != HID_INPUT_REPORT) return 0; - /* Tweak pen reports, if necessary */ - if ((report_id == params->pen.id) && (size >= 2)) { - /* If it's the "virtual" frame controls report */ - if (params->frame.id != 0 && - data[1] & params->pen_frame_flag) { - /* Change to virtual frame controls report ID */ - report_id = data[0] = params->frame.id; - } else { - return uclogic_raw_event_pen(drvdata, data, size); + while (true) { + /* Tweak pen reports, if necessary */ + if ((report_id == params->pen.id) && (size >= 2)) { + subreport_list_end = + params->pen.subreport_list + + ARRAY_SIZE(params->pen.subreport_list); + /* Try to match a subreport */ + for (subreport = params->pen.subreport_list; + subreport < subreport_list_end && + (data[1] & subreport->mask) != subreport->mask; + subreport++); + /* If a subreport matched */ + if (subreport < subreport_list_end) { + /* Change to subreport ID, and restart */ + report_id = data[0] = subreport->id; + continue; + } else { + return uclogic_raw_event_pen(drvdata, data, size); + } } - } - /* Tweak frame control reports, if necessary */ - if (report_id == params->frame.id) - return uclogic_raw_event_frame(drvdata, data, size); + /* Tweak frame control reports, if necessary */ + if (report_id == params->frame.id) + return uclogic_raw_event_frame(drvdata, data, size); + + break; + } return 0; } diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 71496735cbf0..138dd8b0a360 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -762,8 +762,10 @@ static int uclogic_params_huion_init(struct uclogic_params *params, rc); goto cleanup; } - /* Set bitmask marking frame reports in pen reports */ - p.pen_frame_flag = 0x20; + /* Link frame button subreports from pen reports */ + p.pen.subreport_list[0].mask = 0x20; + p.pen.subreport_list[0].id = + UCLOGIC_RDESC_BUTTONPAD_V2_ID; goto output; } hid_dbg(hdev, "pen v2 parameters not found\n"); @@ -788,8 +790,10 @@ static int uclogic_params_huion_init(struct uclogic_params *params, hid_dbg(hdev, "buttonpad v1 parameters%s found\n", (found ? "" : " not")); if (found) { - /* Set bitmask marking frame reports */ - p.pen_frame_flag = 0x20; + /* Link frame button subreports from pen reports */ + p.pen.subreport_list[0].mask = 0x20; + p.pen.subreport_list[0].id = + UCLOGIC_RDESC_BUTTONPAD_V1_ID; } goto output; } diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h index 48b974943bb9..82db8ab36fec 100644 --- a/drivers/hid/hid-uclogic-params.h +++ b/drivers/hid/hid-uclogic-params.h @@ -33,6 +33,24 @@ enum uclogic_params_pen_inrange { extern const char *uclogic_params_pen_inrange_to_str( enum uclogic_params_pen_inrange inrange); + +/* + * Pen report's subreport data. + */ +struct uclogic_params_pen_subreport { + /* + * The subreport's bitmask matching the second byte of the pen report. + * If zero, the subreport is considered invalid, and won't match. + */ + __u8 mask; + + /* + * The ID to be assigned to the report, if the "mask" matches. + * Only valid if "mask" is not zero. + */ + __u8 id; +}; + /* * Tablet interface's pen input parameters. * @@ -54,6 +72,8 @@ struct uclogic_params_pen { unsigned int desc_size; /* Report ID, if reports should be tweaked, zero if not */ unsigned int id; + /* The list of subreports */ + struct uclogic_params_pen_subreport subreport_list[1]; /* Type of in-range reporting, only valid if "id" is not zero */ enum uclogic_params_pen_inrange inrange; /* @@ -148,13 +168,6 @@ struct uclogic_params { * Only valid, if "invalid" is false. */ struct uclogic_params_frame frame; - /* - * Bitmask matching frame controls "sub-report" flag in the second - * byte of the pen report, or zero if it's not expected. - * Only valid if both "pen" and "frame" are valid, and "frame.id" is - * not zero. - */ - __u8 pen_frame_flag; }; /* Initialize a tablet interface and discover its parameters */ @@ -163,21 +176,21 @@ extern int uclogic_params_init(struct uclogic_params *params, /* Tablet interface parameters *printf format string */ #define UCLOGIC_PARAMS_FMT_STR \ - ".invalid = %s\n" \ - ".desc_ptr = %p\n" \ - ".desc_size = %u\n" \ - ".pen.desc_ptr = %p\n" \ - ".pen.desc_size = %u\n" \ - ".pen.id = %u\n" \ - ".pen.inrange = %s\n" \ - ".pen.fragmented_hires = %s\n" \ - ".pen.tilt_y_flipped = %s\n" \ - ".frame.desc_ptr = %p\n" \ - ".frame.desc_size = %u\n" \ - ".frame.id = %u\n" \ - ".frame.re_lsb = %u\n" \ - ".frame.dev_id_byte = %u\n" \ - ".pen_frame_flag = 0x%02x\n" + ".invalid = %s\n" \ + ".desc_ptr = %p\n" \ + ".desc_size = %u\n" \ + ".pen.desc_ptr = %p\n" \ + ".pen.desc_size = %u\n" \ + ".pen.id = %u\n" \ + ".pen.subreport_list[0] = {0x%02hhx, %hhu}\n" \ + ".pen.inrange = %s\n" \ + ".pen.fragmented_hires = %s\n" \ + ".pen.tilt_y_flipped = %s\n" \ + ".frame.desc_ptr = %p\n" \ + ".frame.desc_size = %u\n" \ + ".frame.id = %u\n" \ + ".frame.re_lsb = %u\n" \ + ".frame.dev_id_byte = %u\n" /* Tablet interface parameters *printf format arguments */ #define UCLOGIC_PARAMS_FMT_ARGS(_params) \ @@ -187,6 +200,8 @@ extern int uclogic_params_init(struct uclogic_params *params, (_params)->pen.desc_ptr, \ (_params)->pen.desc_size, \ (_params)->pen.id, \ + (_params)->pen.subreport_list[0].mask, \ + (_params)->pen.subreport_list[0].id, \ uclogic_params_pen_inrange_to_str((_params)->pen.inrange), \ ((_params)->pen.fragmented_hires ? "true" : "false"), \ ((_params)->pen.tilt_y_flipped ? "true" : "false"), \ @@ -194,8 +209,7 @@ extern int uclogic_params_init(struct uclogic_params *params, (_params)->frame.desc_size, \ (_params)->frame.id, \ (_params)->frame.re_lsb, \ - (_params)->frame.dev_id_byte, \ - (_params)->pen_frame_flag + (_params)->frame.dev_id_byte /* Get a replacement report descriptor for a tablet's interface. */ extern int uclogic_params_get_desc(const struct uclogic_params *params, From patchwork Sat Feb 19 10:01: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: 544541 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 60866C4332F for ; Sat, 19 Feb 2022 10:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241903AbiBSKCn (ORCPT ); Sat, 19 Feb 2022 05:02:43 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241922AbiBSKCe (ORCPT ); Sat, 19 Feb 2022 05:02:34 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD42DA195; Sat, 19 Feb 2022 02:02:15 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id m27so6681111wrb.4; Sat, 19 Feb 2022 02:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m07NzeDNgXIpmmakHBOfuEWrfbejOEgooxQTFQQRZTQ=; b=l+8HbbX6aO557qAofeqV6p33HmS49v1TQL8MKgnIP9geIC359EMQnC407Xioi0RieF ln0PO9kx7RJi8+bRyvLqFQ//vTTa6q3oIdjaFSjql/JkGKaV+sIe+9TRBVAAIBpyulsD PJflX2uVIP57KGGVR6xT5a4+cgApuwzM14XdGkBfHY36qvZ3uv6/vb9Q+ucfKc+LL7qe tSxWs0kGmpm6S7cTtZWMK8hhWGYP/dEb0ySPH34PZtvNqUcIbua/nPN4M04WpsZZP1YV paMSiTmZ3rkhdB+xxADqcD5W2dpzuBHHfIpIhpjQcNYJX++54FYqpHYVmINRsA+xe8i/ xoCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m07NzeDNgXIpmmakHBOfuEWrfbejOEgooxQTFQQRZTQ=; b=izBXh03LEaoYIgt/DuvH4KvEEEvQD49YqNxJjJ8glU2Ir+vGnluHJRpK1sbpEe4Zrq CHu6tqOdULI4tHxe6uY8hJgFKlwD0oxWVf9J6UE8GyJvIWr0pas5VIRAKPBwuKWB6wvF lK1ik9RKf+56wH8lm1lF3KAjkHSNWjvneIEcu0LKs5/+qxAyBry5c/NfatBa8r+SGClY tZnrlvZ5IKUqXZJiNersufxlBrYviNoG83chuwsZI1Tr1QPynGaAj+H7ai9BjcVRiMYI 88YxaxGZ8KL3u8YQIsXoAJC8cjd2WrQc2Ag828NkudBT1KcvH79yyia4KkiLoJOuYWsr Jxsg== X-Gm-Message-State: AOAM533bl8LySDbehiCJ1lWIjQ6wFLKSWomWQVgIhmJHPjFNepA7H4Uf IJXQDFAr/y++JuPT/uz5WvI= X-Google-Smtp-Source: ABdhPJxW3KRQYeN0N509XlLSenXfkWvsxLyjoZegXSx+UFYWl+W/CMd9Hzd/UyrrFiPZxY2KcW5CuA== X-Received: by 2002:adf:fe02:0:b0:1e3:266:d1c with SMTP id n2-20020adffe02000000b001e302660d1cmr8761544wrr.582.1645264934427; Sat, 19 Feb 2022 02:02:14 -0800 (PST) Received: from localhost.localdomain ([94.73.33.246]) by smtp.gmail.com with ESMTPSA id az13sm24417244wrb.39.2022.02.19.02.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 02:02:14 -0800 (PST) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Sm9z?= =?utf-8?b?w6kgRXhww7NzaXRv?= Subject: [PATCH for-5.18/uclogic 6/9] HID: uclogic: Use "frame" instead of "buttonpad" Date: Sat, 19 Feb 2022 11:01:54 +0100 Message-Id: <20220219100157.41920-7-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220219100157.41920-1-jose.exposito89@gmail.com> References: <20220219100157.41920-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Nikolai Kondrashov Use the term "frame" instead of "buttonpad" for consistency, in UC-Logic driver. Signed-off-by: Nikolai Kondrashov Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-params.c | 46 +++++++++++++++----------------- drivers/hid/hid-uclogic-rdesc.c | 32 +++++++++++----------- drivers/hid/hid-uclogic-rdesc.h | 26 +++++++++--------- 3 files changed, 51 insertions(+), 53 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index a4a53ab1e72c..168749d9a112 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -431,8 +431,8 @@ static int uclogic_params_frame_init_with_desc( } /** - * uclogic_params_frame_init_v1_buttonpad() - initialize abstract buttonpad - * on a v1 tablet interface. + * uclogic_params_frame_init_v1() - initialize v1 tablet interface frame + * controls. * * @frame: Pointer to the frame parameters to initialize (to be cleaned * up with uclogic_params_frame_cleanup()). Not modified in case @@ -446,8 +446,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_v1_buttonpad( - struct uclogic_params_frame *frame, +static int uclogic_params_frame_init_v1(struct uclogic_params_frame *frame, bool *pfound, struct hid_device *hdev) { @@ -488,9 +487,9 @@ static int uclogic_params_frame_init_v1_buttonpad( hid_dbg(hdev, "generic buttons enabled\n"); rc = uclogic_params_frame_init_with_desc( frame, - uclogic_rdesc_buttonpad_v1_arr, - uclogic_rdesc_buttonpad_v1_size, - UCLOGIC_RDESC_BUTTONPAD_V1_ID); + uclogic_rdesc_frame_v1_arr, + uclogic_rdesc_frame_v1_size, + UCLOGIC_RDESC_FRAME_V1_ID); if (rc != 0) goto cleanup; found = true; @@ -750,22 +749,22 @@ static int uclogic_params_huion_init(struct uclogic_params *params, goto cleanup; } else if (found) { hid_dbg(hdev, "pen v2 parameters found\n"); - /* Create v2 buttonpad parameters */ + /* Create v2 frame parameters */ rc = uclogic_params_frame_init_with_desc( &p.frame, - uclogic_rdesc_buttonpad_v2_arr, - uclogic_rdesc_buttonpad_v2_size, - UCLOGIC_RDESC_BUTTONPAD_V2_ID); + uclogic_rdesc_frame_v2_arr, + uclogic_rdesc_frame_v2_size, + UCLOGIC_RDESC_FRAME_V2_ID); if (rc != 0) { hid_err(hdev, - "failed creating v2 buttonpad parameters: %d\n", + "failed creating v2 frame parameters: %d\n", rc); goto cleanup; } /* Link frame button subreports from pen reports */ p.pen.subreport_list[0].value = 0xe0; p.pen.subreport_list[0].id = - UCLOGIC_RDESC_BUTTONPAD_V2_ID; + UCLOGIC_RDESC_FRAME_V2_ID; goto output; } hid_dbg(hdev, "pen v2 parameters not found\n"); @@ -779,21 +778,20 @@ static int uclogic_params_huion_init(struct uclogic_params *params, goto cleanup; } else if (found) { hid_dbg(hdev, "pen v1 parameters found\n"); - /* Try to probe v1 buttonpad */ - rc = uclogic_params_frame_init_v1_buttonpad( - &p.frame, - &found, hdev); + /* Try to probe v1 frame */ + rc = uclogic_params_frame_init_v1(&p.frame, + &found, hdev); if (rc != 0) { - hid_err(hdev, "v1 buttonpad probing failed: %d\n", rc); + hid_err(hdev, "v1 frame probing failed: %d\n", rc); goto cleanup; } - hid_dbg(hdev, "buttonpad v1 parameters%s found\n", + hid_dbg(hdev, "frame v1 parameters%s found\n", (found ? "" : " not")); if (found) { /* Link frame button subreports from pen reports */ p.pen.subreport_list[0].value = 0xe0; p.pen.subreport_list[0].id = - UCLOGIC_RDESC_BUTTONPAD_V1_ID; + UCLOGIC_RDESC_FRAME_V1_ID; } goto output; } @@ -1067,7 +1065,7 @@ int uclogic_params_init(struct uclogic_params *params, UCLOGIC_RDESC_UGEE_G5_FRAME_ID); if (rc != 0) { hid_err(hdev, - "failed creating buttonpad parameters: %d\n", + "failed creating frame parameters: %d\n", rc); goto cleanup; } @@ -1096,12 +1094,12 @@ int uclogic_params_init(struct uclogic_params *params, } else if (found) { rc = uclogic_params_frame_init_with_desc( &p.frame, - uclogic_rdesc_ugee_ex07_buttonpad_arr, - uclogic_rdesc_ugee_ex07_buttonpad_size, + uclogic_rdesc_ugee_ex07_frame_arr, + uclogic_rdesc_ugee_ex07_frame_size, 0); if (rc != 0) { hid_err(hdev, - "failed creating buttonpad parameters: %d\n", + "failed creating frame parameters: %d\n", rc); goto cleanup; } diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index 66aa83f67ccc..e8dedede3395 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -652,12 +652,12 @@ const size_t uclogic_rdesc_pen_v2_template_size = sizeof(uclogic_rdesc_pen_v2_template_arr); /* - * Expand to the contents of a generic buttonpad report descriptor. + * Expand to the contents of a generic frame report descriptor. * * @_id: The report ID to use. * @_size: Size of the report to pad to, including report ID, bytes. */ -#define UCLOGIC_RDESC_BUTTONPAD_BYTES(_id, _size) \ +#define UCLOGIC_RDESC_FRAME_BYTES(_id, _size) \ 0x05, 0x01, /* Usage Page (Desktop), */ \ 0x09, 0x07, /* Usage (Keypad), */ \ 0xA1, 0x01, /* Collection (Application), */ \ @@ -698,22 +698,22 @@ const size_t uclogic_rdesc_pen_v2_template_size = 0xC0, /* End Collection, */ \ 0xC0 /* End Collection */ -/* Fixed report descriptor for (tweaked) v1 buttonpad reports */ -const __u8 uclogic_rdesc_buttonpad_v1_arr[] = { - UCLOGIC_RDESC_BUTTONPAD_BYTES(UCLOGIC_RDESC_BUTTONPAD_V1_ID, 8) +/* Fixed report descriptor for (tweaked) v1 frame reports */ +const __u8 uclogic_rdesc_frame_v1_arr[] = { + UCLOGIC_RDESC_FRAME_BYTES(UCLOGIC_RDESC_FRAME_V1_ID, 8) }; -const size_t uclogic_rdesc_buttonpad_v1_size = - sizeof(uclogic_rdesc_buttonpad_v1_arr); +const size_t uclogic_rdesc_frame_v1_size = + sizeof(uclogic_rdesc_frame_v1_arr); -/* Fixed report descriptor for (tweaked) v2 buttonpad reports */ -const __u8 uclogic_rdesc_buttonpad_v2_arr[] = { - UCLOGIC_RDESC_BUTTONPAD_BYTES(UCLOGIC_RDESC_BUTTONPAD_V2_ID, 12) +/* Fixed report descriptor for (tweaked) v2 frame reports */ +const __u8 uclogic_rdesc_frame_v2_arr[] = { + UCLOGIC_RDESC_FRAME_BYTES(UCLOGIC_RDESC_FRAME_V2_ID, 12) }; -const size_t uclogic_rdesc_buttonpad_v2_size = - sizeof(uclogic_rdesc_buttonpad_v2_arr); +const size_t uclogic_rdesc_frame_v2_size = + sizeof(uclogic_rdesc_frame_v2_arr); -/* Fixed report descriptor for Ugee EX07 buttonpad */ -const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[] = { +/* Fixed report descriptor for Ugee EX07 frame */ +const __u8 uclogic_rdesc_ugee_ex07_frame_arr[] = { 0x05, 0x01, /* Usage Page (Desktop), */ 0x09, 0x07, /* Usage (Keypad), */ 0xA1, 0x01, /* Collection (Application), */ @@ -736,8 +736,8 @@ const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[] = { 0xC0, /* End Collection, */ 0xC0 /* End Collection */ }; -const size_t uclogic_rdesc_ugee_ex07_buttonpad_size = - sizeof(uclogic_rdesc_ugee_ex07_buttonpad_arr); +const size_t uclogic_rdesc_ugee_ex07_frame_size = + sizeof(uclogic_rdesc_ugee_ex07_frame_arr); /* Fixed report descriptor for Ugee G5 frame controls */ const __u8 uclogic_rdesc_ugee_g5_frame_arr[] = { diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h index c5da51055af3..40c6f02c6bab 100644 --- a/drivers/hid/hid-uclogic-rdesc.h +++ b/drivers/hid/hid-uclogic-rdesc.h @@ -117,23 +117,23 @@ extern const size_t uclogic_rdesc_pen_v1_template_size; extern const __u8 uclogic_rdesc_pen_v2_template_arr[]; extern const size_t uclogic_rdesc_pen_v2_template_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; +/* Fixed report descriptor for (tweaked) v1 frame reports */ +extern const __u8 uclogic_rdesc_frame_v1_arr[]; +extern const size_t uclogic_rdesc_frame_v1_size; -/* Report ID for tweaked v1 buttonpad reports */ -#define UCLOGIC_RDESC_BUTTONPAD_V1_ID 0xf7 +/* Report ID for tweaked v1 frame reports */ +#define UCLOGIC_RDESC_FRAME_V1_ID 0xf7 -/* Fixed report descriptor for (tweaked) v2 buttonpad reports */ -extern const __u8 uclogic_rdesc_buttonpad_v2_arr[]; -extern const size_t uclogic_rdesc_buttonpad_v2_size; +/* Fixed report descriptor for (tweaked) v2 frame reports */ +extern const __u8 uclogic_rdesc_frame_v2_arr[]; +extern const size_t uclogic_rdesc_frame_v2_size; -/* Report ID for tweaked v2 buttonpad reports */ -#define UCLOGIC_RDESC_BUTTONPAD_V2_ID 0xf7 +/* Report ID for tweaked v2 frame reports */ +#define UCLOGIC_RDESC_FRAME_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; +/* 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; /* Fixed report descriptor for XP-Pen Deco 01 frame controls */ extern const __u8 uclogic_rdesc_xppen_deco01_frame_arr[]; From patchwork Sat Feb 19 10:01: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: 544543 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 E1714C4332F for ; Sat, 19 Feb 2022 10:02:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241920AbiBSKCk (ORCPT ); Sat, 19 Feb 2022 05:02:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241926AbiBSKCf (ORCPT ); Sat, 19 Feb 2022 05:02:35 -0500 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 C32E2AE7B; Sat, 19 Feb 2022 02:02:16 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id d3so2824991wrf.1; Sat, 19 Feb 2022 02:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wTpxhm6UflDP1An7oaHPIEtXwTE7w+WpkFnMNKaToYA=; b=h3MgdrmOL9aBtMCokAZW2klpoG18P7NOuITVNWdjBmFL2Txn94nSx7cFBJEL3To2s7 9Y44InbMb70uffbZw9SXI9ImU3zgCYyTLuxSwnEZmqZUD2lk7HKhGB94Xt37yCpiyM6z tysGzOTAXo2JjjrXn/ibmO5grpTPzSAD6u7AWHrkroOhgoMt1deKP4bLkZTq2mqQ8LkN tDd6YYM29g94epe2Sw9+8pN2G7CVCPOmgvmE+rUH/HeheA/+qNbwPCpkil1g4JkBjwlu qc07FwNrZ17Qd9MomJh6sQ9ND2Z89jTWzA9jjaEJYTKvxIEffmjWc2Sa3FzhrX8RGvad W3KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wTpxhm6UflDP1An7oaHPIEtXwTE7w+WpkFnMNKaToYA=; b=koRWE0wcdp8l3NdVEb7TEE0thzKJ948XpUnfnVUN33BZ8r7CzAiX1Ke72rxxjpN5Dp m1bZFfIJH7DFfZRWA7v1A8nZZUMVbBRx83hleSwgBOZoVl8AZ6HFj0xiGEqBaQh/B7L+ iPG7zitHoDaLQvt1u0wxjKmR/TXO3GbIDCAf9ICmoTLh+OJETwsp46eN8kM2s3tpqcSa +yLN99XDinkJTZ/6+gSvM4+a9tkv1hZXOoOvlTMmSq6mpOWeOEsD6YUDErgtQpSjVEac XwnCVgnPZKCzRUSTpafNlLy157g2WfGsgqlb+Bg/PdnxF3UEyuab/YO9f1PpuaA5qoOX 8h0w== X-Gm-Message-State: AOAM533YA2kSbvunGFcxDkwzpe3faud4Qd44wFkAqU+GDAroWVtpebcF u7n++6kNNFIzOWZaFIY6niREwli1rs4= X-Google-Smtp-Source: ABdhPJxg1ZmFBsu4u5jbkdmNiGM1w3JPAE9yVaUSJgUvIDjJd2oJTQeyfXQy/ZrEmlxdUEEhmFFosg== X-Received: by 2002:a5d:420b:0:b0:1e5:eb98:25f5 with SMTP id n11-20020a5d420b000000b001e5eb9825f5mr8807122wrq.102.1645264935262; Sat, 19 Feb 2022 02:02:15 -0800 (PST) Received: from localhost.localdomain ([94.73.33.246]) by smtp.gmail.com with ESMTPSA id az13sm24417244wrb.39.2022.02.19.02.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 02:02:15 -0800 (PST) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Sm9z?= =?utf-8?b?w6kgRXhww7NzaXRv?= Subject: [PATCH for-5.18/uclogic 7/9] HID: uclogic: Put version first in rdesc namespace Date: Sat, 19 Feb 2022 11:01:55 +0100 Message-Id: <20220219100157.41920-8-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220219100157.41920-1-jose.exposito89@gmail.com> References: <20220219100157.41920-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Nikolai Kondrashov Put general hardware version before everything else in uclogic_rdesc_ namespace. Signed-off-by: Nikolai Kondrashov Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-params.c | 32 ++++++++++++++++---------------- drivers/hid/hid-uclogic-rdesc.c | 28 ++++++++++++++-------------- drivers/hid/hid-uclogic-rdesc.h | 24 ++++++++++++------------ 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 168749d9a112..f667347ad0df 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -207,8 +207,8 @@ static int uclogic_params_pen_init_v1(struct uclogic_params_pen *pen, * Generate pen report descriptor */ desc_ptr = uclogic_rdesc_template_apply( - uclogic_rdesc_pen_v1_template_arr, - uclogic_rdesc_pen_v1_template_size, + uclogic_rdesc_v1_pen_template_arr, + uclogic_rdesc_v1_pen_template_size, desc_params, ARRAY_SIZE(desc_params)); if (desc_ptr == NULL) { rc = -ENOMEM; @@ -221,8 +221,8 @@ static int uclogic_params_pen_init_v1(struct uclogic_params_pen *pen, memset(pen, 0, sizeof(*pen)); pen->desc_ptr = desc_ptr; desc_ptr = NULL; - pen->desc_size = uclogic_rdesc_pen_v1_template_size; - pen->id = UCLOGIC_RDESC_PEN_V1_ID; + pen->desc_size = uclogic_rdesc_v1_pen_template_size; + pen->id = UCLOGIC_RDESC_V1_PEN_ID; pen->inrange = UCLOGIC_PARAMS_PEN_INRANGE_INVERTED; found = true; finish: @@ -351,8 +351,8 @@ static int uclogic_params_pen_init_v2(struct uclogic_params_pen *pen, * Generate pen report descriptor */ desc_ptr = uclogic_rdesc_template_apply( - uclogic_rdesc_pen_v2_template_arr, - uclogic_rdesc_pen_v2_template_size, + uclogic_rdesc_v2_pen_template_arr, + uclogic_rdesc_v2_pen_template_size, desc_params, ARRAY_SIZE(desc_params)); if (desc_ptr == NULL) { rc = -ENOMEM; @@ -365,8 +365,8 @@ static int uclogic_params_pen_init_v2(struct uclogic_params_pen *pen, memset(pen, 0, sizeof(*pen)); pen->desc_ptr = desc_ptr; desc_ptr = NULL; - pen->desc_size = uclogic_rdesc_pen_v2_template_size; - pen->id = UCLOGIC_RDESC_PEN_V2_ID; + pen->desc_size = uclogic_rdesc_v2_pen_template_size; + pen->id = UCLOGIC_RDESC_V2_PEN_ID; pen->inrange = UCLOGIC_PARAMS_PEN_INRANGE_NONE; pen->fragmented_hires = true; pen->tilt_y_flipped = true; @@ -487,9 +487,9 @@ static int uclogic_params_frame_init_v1(struct uclogic_params_frame *frame, hid_dbg(hdev, "generic buttons enabled\n"); rc = uclogic_params_frame_init_with_desc( frame, - uclogic_rdesc_frame_v1_arr, - uclogic_rdesc_frame_v1_size, - UCLOGIC_RDESC_FRAME_V1_ID); + uclogic_rdesc_v1_frame_arr, + uclogic_rdesc_v1_frame_size, + UCLOGIC_RDESC_V1_FRAME_ID); if (rc != 0) goto cleanup; found = true; @@ -752,9 +752,9 @@ static int uclogic_params_huion_init(struct uclogic_params *params, /* Create v2 frame parameters */ rc = uclogic_params_frame_init_with_desc( &p.frame, - uclogic_rdesc_frame_v2_arr, - uclogic_rdesc_frame_v2_size, - UCLOGIC_RDESC_FRAME_V2_ID); + uclogic_rdesc_v2_frame_arr, + uclogic_rdesc_v2_frame_size, + UCLOGIC_RDESC_V2_FRAME_ID); if (rc != 0) { hid_err(hdev, "failed creating v2 frame parameters: %d\n", @@ -764,7 +764,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params, /* Link frame button subreports from pen reports */ p.pen.subreport_list[0].value = 0xe0; p.pen.subreport_list[0].id = - UCLOGIC_RDESC_FRAME_V2_ID; + UCLOGIC_RDESC_V2_FRAME_ID; goto output; } hid_dbg(hdev, "pen v2 parameters not found\n"); @@ -791,7 +791,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params, /* Link frame button subreports from pen reports */ p.pen.subreport_list[0].value = 0xe0; p.pen.subreport_list[0].id = - UCLOGIC_RDESC_FRAME_V1_ID; + UCLOGIC_RDESC_V1_FRAME_ID; } goto output; } diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index e8dedede3395..04644d93bd11 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -532,7 +532,7 @@ const size_t uclogic_rdesc_twha60_fixed1_size = sizeof(uclogic_rdesc_twha60_fixed1_arr); /* Fixed report descriptor template for (tweaked) v1 pen reports */ -const __u8 uclogic_rdesc_pen_v1_template_arr[] = { +const __u8 uclogic_rdesc_v1_pen_template_arr[] = { 0x05, 0x0D, /* Usage Page (Digitizer), */ 0x09, 0x02, /* Usage (Pen), */ 0xA1, 0x01, /* Collection (Application), */ @@ -582,11 +582,11 @@ const __u8 uclogic_rdesc_pen_v1_template_arr[] = { 0xC0 /* End Collection */ }; -const size_t uclogic_rdesc_pen_v1_template_size = - sizeof(uclogic_rdesc_pen_v1_template_arr); +const size_t uclogic_rdesc_v1_pen_template_size = + sizeof(uclogic_rdesc_v1_pen_template_arr); /* Fixed report descriptor template for (tweaked) v2 pen reports */ -const __u8 uclogic_rdesc_pen_v2_template_arr[] = { +const __u8 uclogic_rdesc_v2_pen_template_arr[] = { 0x05, 0x0D, /* Usage Page (Digitizer), */ 0x09, 0x02, /* Usage (Pen), */ 0xA1, 0x01, /* Collection (Application), */ @@ -648,8 +648,8 @@ const __u8 uclogic_rdesc_pen_v2_template_arr[] = { 0xC0 /* End Collection */ }; -const size_t uclogic_rdesc_pen_v2_template_size = - sizeof(uclogic_rdesc_pen_v2_template_arr); +const size_t uclogic_rdesc_v2_pen_template_size = + sizeof(uclogic_rdesc_v2_pen_template_arr); /* * Expand to the contents of a generic frame report descriptor. @@ -699,18 +699,18 @@ const size_t uclogic_rdesc_pen_v2_template_size = 0xC0 /* End Collection */ /* Fixed report descriptor for (tweaked) v1 frame reports */ -const __u8 uclogic_rdesc_frame_v1_arr[] = { - UCLOGIC_RDESC_FRAME_BYTES(UCLOGIC_RDESC_FRAME_V1_ID, 8) +const __u8 uclogic_rdesc_v1_frame_arr[] = { + UCLOGIC_RDESC_FRAME_BYTES(UCLOGIC_RDESC_V1_FRAME_ID, 8) }; -const size_t uclogic_rdesc_frame_v1_size = - sizeof(uclogic_rdesc_frame_v1_arr); +const size_t uclogic_rdesc_v1_frame_size = + sizeof(uclogic_rdesc_v1_frame_arr); /* Fixed report descriptor for (tweaked) v2 frame reports */ -const __u8 uclogic_rdesc_frame_v2_arr[] = { - UCLOGIC_RDESC_FRAME_BYTES(UCLOGIC_RDESC_FRAME_V2_ID, 12) +const __u8 uclogic_rdesc_v2_frame_arr[] = { + UCLOGIC_RDESC_FRAME_BYTES(UCLOGIC_RDESC_V2_FRAME_ID, 12) }; -const size_t uclogic_rdesc_frame_v2_size = - sizeof(uclogic_rdesc_frame_v2_arr); +const size_t uclogic_rdesc_v2_frame_size = + sizeof(uclogic_rdesc_v2_frame_arr); /* Fixed report descriptor for Ugee EX07 frame */ const __u8 uclogic_rdesc_ugee_ex07_frame_arr[] = { diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h index 40c6f02c6bab..d1ab1f346f22 100644 --- a/drivers/hid/hid-uclogic-rdesc.h +++ b/drivers/hid/hid-uclogic-rdesc.h @@ -104,32 +104,32 @@ enum uclogic_rdesc_pen_ph_id { UCLOGIC_RDESC_PH_HEAD, UCLOGIC_RDESC_PEN_PH_ID_##_ID /* Report ID for v1 pen reports */ -#define UCLOGIC_RDESC_PEN_V1_ID 0x07 +#define UCLOGIC_RDESC_V1_PEN_ID 0x07 /* 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; +extern const __u8 uclogic_rdesc_v1_pen_template_arr[]; +extern const size_t uclogic_rdesc_v1_pen_template_size; /* Report ID for v2 pen reports */ -#define UCLOGIC_RDESC_PEN_V2_ID 0x08 +#define UCLOGIC_RDESC_V2_PEN_ID 0x08 /* Fixed report descriptor template for (tweaked) v2 pen reports */ -extern const __u8 uclogic_rdesc_pen_v2_template_arr[]; -extern const size_t uclogic_rdesc_pen_v2_template_size; +extern const __u8 uclogic_rdesc_v2_pen_template_arr[]; +extern const size_t uclogic_rdesc_v2_pen_template_size; /* Fixed report descriptor for (tweaked) v1 frame reports */ -extern const __u8 uclogic_rdesc_frame_v1_arr[]; -extern const size_t uclogic_rdesc_frame_v1_size; +extern const __u8 uclogic_rdesc_v1_frame_arr[]; +extern const size_t uclogic_rdesc_v1_frame_size; /* Report ID for tweaked v1 frame reports */ -#define UCLOGIC_RDESC_FRAME_V1_ID 0xf7 +#define UCLOGIC_RDESC_V1_FRAME_ID 0xf7 /* Fixed report descriptor for (tweaked) v2 frame reports */ -extern const __u8 uclogic_rdesc_frame_v2_arr[]; -extern const size_t uclogic_rdesc_frame_v2_size; +extern const __u8 uclogic_rdesc_v2_frame_arr[]; +extern const size_t uclogic_rdesc_v2_frame_size; /* Report ID for tweaked v2 frame reports */ -#define UCLOGIC_RDESC_FRAME_V2_ID 0xf7 +#define UCLOGIC_RDESC_V2_FRAME_ID 0xf7 /* Fixed report descriptor for Ugee EX07 frame */ extern const __u8 uclogic_rdesc_ugee_ex07_frame_arr[]; From patchwork Sat Feb 19 10:01:57 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: 544542 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 70862C433EF for ; Sat, 19 Feb 2022 10:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241943AbiBSKCl (ORCPT ); Sat, 19 Feb 2022 05:02:41 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241923AbiBSKCh (ORCPT ); Sat, 19 Feb 2022 05:02:37 -0500 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 90C291AD95; Sat, 19 Feb 2022 02:02:18 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id d3so2825093wrf.1; Sat, 19 Feb 2022 02:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wACpoUOdIfkulcSBEmf1xUmhCY+xDLX/Udau/68Q6oU=; b=ZIJ1xsVh9YvCQZtEiuDvTmldCSMdPckqDK0QrkRFKepecqiHHC0jkkW0oVh2CsSoLC Wp32biet5V94cHFCdIz1NcsZEv8JA16uoe8oa43+2YdXGhqTvZs89vkkzurCR1iIxc+x fUGrOOz8QGM/Xtul5bf8Sa05HZiP1iKM0xhpIV0Aj59tviPZ6bNLnTYFq7ImQm7+TPv+ 84+ECrHhF9jfiK2ip4uJh0V3qTQ+N/6XvBcUieMhMegF+LVI5cbRJlPs2IgS9vNLLrOZ fDhQzfbA72zz6CypicYtLBGo2MuOwy2nBhDujD5zPQFKIuNuGoUDAgFbifcFYpwhPmo6 9Mww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wACpoUOdIfkulcSBEmf1xUmhCY+xDLX/Udau/68Q6oU=; b=uML5MsSrXcM9T0kIFZjDEPXf5q9OhQrPYju3Oj/SYYl1PJdiQGLg6S6+VJgFCxj5hT vH3V0yC+gyRQcQjMfPOfpGF9nrRBk17jvolhsTYEq7CfJXMVit+7/zKabMDWo6A8W0rW lvpZBUhQeDMd0DhJKbT6SRQVjB+auIhLLGeoW5WAkkXnO7EV+rj9L4sPWIXJgwJQmnPi mhmhSGyJZohJsDiH5H4g/L7Adx5sMGT5KN+ai3vFXRPXk63jd+MEsTud/gj8loKFizBR 5JOaQW2kpDKP0vafW+e1QfEnXMAbjxywuPJlqLI8ufa8EZqIHtv/kF+0voKGLqG80T/Z eZ3A== X-Gm-Message-State: AOAM531WQmJaeH6IjpF0TfAOSqj7Akub0zbuuPl7cqI3/jSB0UVAZYLw acqlgxJKIqupJ9OSSS10pGw= X-Google-Smtp-Source: ABdhPJwF8NJTGs6NqCCOKggD6X0NRBw2fEZBBlwo6X7nZQwCsSg+djE+QSzk8pkZKQX9xGZzGDl3Kw== X-Received: by 2002:a5d:4242:0:b0:1e3:3130:5088 with SMTP id s2-20020a5d4242000000b001e331305088mr8629607wrr.540.1645264937052; Sat, 19 Feb 2022 02:02:17 -0800 (PST) Received: from localhost.localdomain ([94.73.33.246]) by smtp.gmail.com with ESMTPSA id az13sm24417244wrb.39.2022.02.19.02.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 02:02:16 -0800 (PST) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Sm9z?= =?utf-8?b?w6kgRXhww7NzaXRv?= Subject: [PATCH for-5.18/uclogic 9/9] HID: uclogic: Support multiple frame input devices Date: Sat, 19 Feb 2022 11:01:57 +0100 Message-Id: <20220219100157.41920-10-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220219100157.41920-1-jose.exposito89@gmail.com> References: <20220219100157.41920-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Nikolai Kondrashov Add support for multiple frame input devices and their parameters to the UC-Logic driver. This prepares for creating a separate input device for Huion HS610 virtual touch ring reports. Signed-off-by: Nikolai Kondrashov Signed-off-by: José Expósito --- drivers/hid/hid-uclogic-core.c | 19 ++++-- drivers/hid/hid-uclogic-params.c | 100 +++++++++++++++---------------- drivers/hid/hid-uclogic-params.h | 26 ++++---- 3 files changed, 74 insertions(+), 71 deletions(-) diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c index a02edeb30a35..05147f2d7564 100644 --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -296,17 +296,18 @@ static int uclogic_raw_event_pen(struct uclogic_drvdata *drvdata, * uclogic_raw_event_frame - handle raw frame events (frame HID reports). * * @drvdata: Driver data. + * @frame: The parameters of the frame controls to handle. * @data: Report data buffer, can be modified. * @size: Report data size, bytes. * * Returns: * Negative value on error (stops event delivery), zero for success. */ -static int uclogic_raw_event_frame(struct uclogic_drvdata *drvdata, - u8 *data, int size) +static int uclogic_raw_event_frame( + struct uclogic_drvdata *drvdata, + const struct uclogic_params_frame *frame, + u8 *data, int size) { - struct uclogic_params_frame *frame = &drvdata->params.frame; - WARN_ON(drvdata == NULL); WARN_ON(data == NULL && size != 0); @@ -352,6 +353,7 @@ static int uclogic_raw_event(struct hid_device *hdev, struct uclogic_params *params = &drvdata->params; struct uclogic_params_pen_subreport *subreport; struct uclogic_params_pen_subreport *subreport_list_end; + size_t i; /* Do not handle anything but input reports */ if (report->type != HID_INPUT_REPORT) @@ -382,8 +384,13 @@ static int uclogic_raw_event(struct hid_device *hdev, } /* Tweak frame control reports, if necessary */ - if (report_id == params->frame.id) - return uclogic_raw_event_frame(drvdata, data, size); + for (i = 0; i < ARRAY_SIZE(params->frame_list); i++) { + if (report_id == params->frame_list[i].id) { + return uclogic_raw_event_frame( + drvdata, ¶ms->frame_list[i], + data, size); + } + } break; } diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index f667347ad0df..5f50ceb875d6 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -512,9 +512,12 @@ static int uclogic_params_frame_init_v1(struct uclogic_params_frame *frame, void uclogic_params_cleanup(struct uclogic_params *params) { if (!params->invalid) { + size_t i; kfree(params->desc_ptr); uclogic_params_pen_cleanup(¶ms->pen); - uclogic_params_frame_cleanup(¶ms->frame); + for (i = 0; i < ARRAY_SIZE(params->frame_list); i++) + uclogic_params_frame_cleanup(¶ms->frame_list[i]); + memset(params, 0, sizeof(*params)); } } @@ -542,60 +545,53 @@ int uclogic_params_get_desc(const struct uclogic_params *params, __u8 **pdesc, unsigned int *psize) { - bool common_present; - bool pen_present; - bool frame_present; - unsigned int size; + int rc = -ENOMEM; + bool present = false; + unsigned int size = 0; __u8 *desc = NULL; + size_t i; /* Check arguments */ if (params == NULL || pdesc == NULL || psize == NULL) return -EINVAL; - size = 0; - - common_present = (params->desc_ptr != NULL); - pen_present = (params->pen.desc_ptr != NULL); - frame_present = (params->frame.desc_ptr != NULL); - - if (common_present) - size += params->desc_size; - if (pen_present) - size += params->pen.desc_size; - if (frame_present) - size += params->frame.desc_size; - - if (common_present || pen_present || frame_present) { - __u8 *p; - - desc = kmalloc(size, GFP_KERNEL); - if (desc == NULL) - return -ENOMEM; - p = desc; - - if (common_present) { - memcpy(p, params->desc_ptr, - params->desc_size); - p += params->desc_size; - } - if (pen_present) { - memcpy(p, params->pen.desc_ptr, - params->pen.desc_size); - p += params->pen.desc_size; - } - if (frame_present) { - memcpy(p, params->frame.desc_ptr, - params->frame.desc_size); - p += params->frame.desc_size; - } + /* Concatenate descriptors */ +#define ADD_DESC(_desc_ptr, _desc_size) \ + do { \ + unsigned int new_size; \ + __u8 *new_desc; \ + if ((_desc_ptr) == NULL) { \ + break; \ + } \ + new_size = size + (_desc_size); \ + new_desc = krealloc(desc, new_size, GFP_KERNEL); \ + if (new_desc == NULL) { \ + goto cleanup; \ + } \ + memcpy(new_desc + size, (_desc_ptr), (_desc_size)); \ + desc = new_desc; \ + size = new_size; \ + present = true; \ + } while (0) + + ADD_DESC(params->desc_ptr, params->desc_size); + ADD_DESC(params->pen.desc_ptr, params->pen.desc_size); + for (i = 0; i < ARRAY_SIZE(params->frame_list); i++) { + ADD_DESC(params->frame_list[i].desc_ptr, + params->frame_list[i].desc_size); + } - WARN_ON(p != desc + size); +#undef ADD_DESC + if (present) { + *pdesc = desc; *psize = size; + desc = NULL; } - - *pdesc = desc; - return 0; + rc = 0; +cleanup: + kfree(desc); + return rc; } /** @@ -751,7 +747,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params, hid_dbg(hdev, "pen v2 parameters found\n"); /* Create v2 frame parameters */ rc = uclogic_params_frame_init_with_desc( - &p.frame, + &p.frame_list[0], uclogic_rdesc_v2_frame_arr, uclogic_rdesc_v2_frame_size, UCLOGIC_RDESC_V2_FRAME_ID); @@ -779,7 +775,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params, } else if (found) { hid_dbg(hdev, "pen v1 parameters found\n"); /* Try to probe v1 frame */ - rc = uclogic_params_frame_init_v1(&p.frame, + rc = uclogic_params_frame_init_v1(&p.frame_list[0], &found, hdev); if (rc != 0) { hid_err(hdev, "v1 frame probing failed: %d\n", rc); @@ -1033,7 +1029,7 @@ int uclogic_params_init(struct uclogic_params *params, } /* Initialize frame parameters */ rc = uclogic_params_frame_init_with_desc( - &p.frame, + &p.frame_list[0], uclogic_rdesc_xppen_deco01_frame_arr, uclogic_rdesc_xppen_deco01_frame_size, 0); @@ -1059,7 +1055,7 @@ int uclogic_params_init(struct uclogic_params *params, goto cleanup; } else if (found) { rc = uclogic_params_frame_init_with_desc( - &p.frame, + &p.frame_list[0], uclogic_rdesc_ugee_g5_frame_arr, uclogic_rdesc_ugee_g5_frame_size, UCLOGIC_RDESC_UGEE_G5_FRAME_ID); @@ -1069,9 +1065,9 @@ int uclogic_params_init(struct uclogic_params *params, rc); goto cleanup; } - p.frame.re_lsb = + p.frame_list[0].re_lsb = UCLOGIC_RDESC_UGEE_G5_FRAME_RE_LSB; - p.frame.dev_id_byte = + p.frame_list[0].dev_id_byte = UCLOGIC_RDESC_UGEE_G5_FRAME_DEV_ID_BYTE; } else { hid_warn(hdev, "pen parameters not found"); @@ -1093,7 +1089,7 @@ int uclogic_params_init(struct uclogic_params *params, goto cleanup; } else if (found) { rc = uclogic_params_frame_init_with_desc( - &p.frame, + &p.frame_list[0], uclogic_rdesc_ugee_ex07_frame_arr, uclogic_rdesc_ugee_ex07_frame_size, 0); diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h index c18569591b75..86f616dfbb53 100644 --- a/drivers/hid/hid-uclogic-params.h +++ b/drivers/hid/hid-uclogic-params.h @@ -165,10 +165,10 @@ struct uclogic_params { */ struct uclogic_params_pen pen; /* - * Frame control parameters and optional report descriptor part. - * Only valid, if "invalid" is false. + * The list of frame control parameters and optional report descriptor + * parts. Only valid, if "invalid" is false. */ - struct uclogic_params_frame frame; + struct uclogic_params_frame frame_list[1]; }; /* Initialize a tablet interface and discover its parameters */ @@ -187,11 +187,11 @@ extern int uclogic_params_init(struct uclogic_params *params, ".pen.inrange = %s\n" \ ".pen.fragmented_hires = %s\n" \ ".pen.tilt_y_flipped = %s\n" \ - ".frame.desc_ptr = %p\n" \ - ".frame.desc_size = %u\n" \ - ".frame.id = %u\n" \ - ".frame.re_lsb = %u\n" \ - ".frame.dev_id_byte = %u\n" + ".frame_list[0].desc_ptr = %p\n" \ + ".frame_list[0].desc_size = %u\n" \ + ".frame_list[0].id = %u\n" \ + ".frame_list[0].re_lsb = %u\n" \ + ".frame_list[0].dev_id_byte = %u\n" /* Tablet interface parameters *printf format arguments */ #define UCLOGIC_PARAMS_FMT_ARGS(_params) \ @@ -206,11 +206,11 @@ extern int uclogic_params_init(struct uclogic_params *params, uclogic_params_pen_inrange_to_str((_params)->pen.inrange), \ ((_params)->pen.fragmented_hires ? "true" : "false"), \ ((_params)->pen.tilt_y_flipped ? "true" : "false"), \ - (_params)->frame.desc_ptr, \ - (_params)->frame.desc_size, \ - (_params)->frame.id, \ - (_params)->frame.re_lsb, \ - (_params)->frame.dev_id_byte + (_params)->frame_list[0].desc_ptr, \ + (_params)->frame_list[0].desc_size, \ + (_params)->frame_list[0].id, \ + (_params)->frame_list[0].re_lsb, \ + (_params)->frame_list[0].dev_id_byte /* Get a replacement report descriptor for a tablet's interface. */ extern int uclogic_params_get_desc(const struct uclogic_params *params,