From: "José Expósito" <jose.exposito89@gmail.com>
To: jikos@kernel.org
Cc: benjamin.tissoires@redhat.com, spbnick@gmail.com,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
"José Expósito" <jose.exposito89@gmail.com>
Subject: [PATCH for-5.18/uclogic 1/9] HID: uclogic: Remove pen usage masking
Date: Sat, 19 Feb 2022 11:01:49 +0100 [thread overview]
Message-ID: <20220219100157.41920-2-jose.exposito89@gmail.com> (raw)
In-Reply-To: <20220219100157.41920-1-jose.exposito89@gmail.com>
From: Nikolai Kondrashov <spbnick@gmail.com>
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 <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
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, \
--
2.25.1
next prev parent reply other threads:[~2022-02-19 10:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-19 10:01 [PATCH for-5.18/uclogic 0/9] DIGImend patches, part II José Expósito
2022-02-19 10:01 ` José Expósito [this message]
2022-02-19 10:01 ` [PATCH for-5.18/uclogic 2/9] HID: uclogic: Replace pen_frame_flag with subreport_list José Expósito
2022-02-19 10:01 ` [PATCH for-5.18/uclogic 3/9] HID: uclogic: Switch to matching subreport bytes José Expósito
2022-02-19 10:01 ` [PATCH for-5.18/uclogic 4/9] HID: uclogic: Specify total report size to buttonpad macro José Expósito
2022-02-19 10:01 ` [PATCH for-5.18/uclogic 5/9] HID: uclogic: Use different constants for frame report IDs José Expósito
2022-02-19 10:01 ` [PATCH for-5.18/uclogic 6/9] HID: uclogic: Use "frame" instead of "buttonpad" José Expósito
2022-02-19 10:01 ` [PATCH for-5.18/uclogic 7/9] HID: uclogic: Put version first in rdesc namespace José Expósito
2022-02-19 10:01 ` [PATCH for-5.18/uclogic 8/9] HID: uclogic: Define report IDs before their descriptors José Expósito
2022-02-19 10:01 ` [PATCH for-5.18/uclogic 9/9] HID: uclogic: Support multiple frame input devices José Expósito
2022-03-01 14:29 ` [PATCH for-5.18/uclogic 0/9] DIGImend patches, part II Jiri Kosina
2022-03-01 14:32 ` Nikolai Kondrashov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220219100157.41920-2-jose.exposito89@gmail.com \
--to=jose.exposito89@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=spbnick@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).