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 3/9] HID: uclogic: Switch to matching subreport bytes
Date: Sat, 19 Feb 2022 11:01:51 +0100 [thread overview]
Message-ID: <20220219100157.41920-4-jose.exposito89@gmail.com> (raw)
In-Reply-To: <20220219100157.41920-1-jose.exposito89@gmail.com>
From: Nikolai Kondrashov <spbnick@gmail.com>
Switch from matching UC-Logic subreport with a mask to a full value to
support detecting Huion HS610 touch dial reports. Those would match the
button mask otherwise.
Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/hid/hid-uclogic-core.c | 9 ++++++---
drivers/hid/hid-uclogic-params.c | 4 ++--
drivers/hid/hid-uclogic-params.h | 13 +++++++------
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index 7092f86517a5..a02edeb30a35 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -365,9 +365,12 @@ static int uclogic_raw_event(struct hid_device *hdev,
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++);
+ subreport < subreport_list_end; subreport++) {
+ if (subreport->value != 0 &&
+ subreport->value == data[1]) {
+ break;
+ }
+ }
/* If a subreport matched */
if (subreport < subreport_list_end) {
/* Change to subreport ID, and restart */
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c
index 138dd8b0a360..a4a53ab1e72c 100644
--- a/drivers/hid/hid-uclogic-params.c
+++ b/drivers/hid/hid-uclogic-params.c
@@ -763,7 +763,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
goto cleanup;
}
/* Link frame button subreports from pen reports */
- p.pen.subreport_list[0].mask = 0x20;
+ p.pen.subreport_list[0].value = 0xe0;
p.pen.subreport_list[0].id =
UCLOGIC_RDESC_BUTTONPAD_V2_ID;
goto output;
@@ -791,7 +791,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
(found ? "" : " not"));
if (found) {
/* Link frame button subreports from pen reports */
- p.pen.subreport_list[0].mask = 0x20;
+ p.pen.subreport_list[0].value = 0xe0;
p.pen.subreport_list[0].id =
UCLOGIC_RDESC_BUTTONPAD_V1_ID;
}
diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h
index 82db8ab36fec..c18569591b75 100644
--- a/drivers/hid/hid-uclogic-params.h
+++ b/drivers/hid/hid-uclogic-params.h
@@ -39,14 +39,15 @@ extern const char *uclogic_params_pen_inrange_to_str(
*/
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.
+ * The value of the second byte of the pen report indicating this
+ * subreport. If zero, the subreport should be considered invalid and
+ * not matched.
*/
- __u8 mask;
+ __u8 value;
/*
- * The ID to be assigned to the report, if the "mask" matches.
- * Only valid if "mask" is not zero.
+ * The ID to be assigned to the report, if the second byte of the pen
+ * report is equal to "value". Only valid if "value" is not zero.
*/
__u8 id;
};
@@ -200,7 +201,7 @@ 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].value, \
(_params)->pen.subreport_list[0].id, \
uclogic_params_pen_inrange_to_str((_params)->pen.inrange), \
((_params)->pen.fragmented_hires ? "true" : "false"), \
--
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 ` [PATCH for-5.18/uclogic 1/9] HID: uclogic: Remove pen usage masking José Expósito
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 ` José Expósito [this message]
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-4-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).