[PATCH] HID: bpf: Accept 123-byte pen descriptor in Huion Frego M quirk

Subsystems: hid core layer, the rest

COOLING7d

2 messages, 2 authors, 7d ago · open the first message on its own page

[PATCH] HID: bpf: Accept 123-byte pen descriptor in Huion Frego M quirk

From: Ririn Ume <hidden>
Date: 2026-09-10 11:10:07

The L610 pen descriptor is also seen 2 bytes shorter (123 bytes) than
the 125 bytes the quirk expects, so probe() rejects the device and the
fixup is never applied; the second side button stays reported as
Secondary Tip Switch.

The anchor bytes checked (offsets 0-3, 16-17) are the same in both
variants, so accept either length. The fixup still rewrites the usage
only after every anchor matches, leaving other layouts untouched.

Fixes: 857e71cb0a53 ("HID: bpf: Add Huion Inspiroy Frego M button quirk")
Signed-off-by: Ririn Ume <redacted>
---
 drivers/hid/bpf/progs/Huion__Inspiroy-Frego-M.bpf.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/bpf/progs/Huion__Inspiroy-Frego-M.bpf.c b/drivers/hid/bpf/progs/Huion__Inspiroy-Frego-M.bpf.c
index e6ba2295dc77..d081b7c0b771 100644
--- a/drivers/hid/bpf/progs/Huion__Inspiroy-Frego-M.bpf.c
+++ b/drivers/hid/bpf/progs/Huion__Inspiroy-Frego-M.bpf.c
@@ -15,6 +15,12 @@
 #define PID_L610			0x2012
 
 #define PEN_RDESC_SIZE			125
+/*
+ * The L610 pen descriptor is also seen 2 bytes shorter (123 bytes); the
+ * anchor bytes checked below (offsets 0-3, 16-17) are the same in both
+ * variants, so accept either length.
+ */
+#define PEN_RDESC_SIZE_SHORT		123
 #define SECONDARY_SWITCH_OFFSET		17
 
 HID_BPF_CONFIG(
@@ -44,7 +50,7 @@ int BPF_PROG(fix_secondary_barrel_rdesc, struct hid_bpf_ctx *hctx)
 	if (!data)
 		return 0; /* EPERM check */
 
-	if (hctx->size != PEN_RDESC_SIZE)
+	if (hctx->size != PEN_RDESC_SIZE && hctx->size != PEN_RDESC_SIZE_SHORT)
 		return 0;
 
 	if (data[0] != 0x05 || data[1] != 0x0d || /* Usage Page (Digitizers) */
@@ -65,7 +71,8 @@ HID_BPF_OPS(fix_secondary_barrel) = {
 SEC("syscall")
 int probe(struct hid_bpf_probe_args *ctx)
 {
-	ctx->retval = ctx->rdesc_size != PEN_RDESC_SIZE;
+	ctx->retval = ctx->rdesc_size != PEN_RDESC_SIZE &&
+		      ctx->rdesc_size != PEN_RDESC_SIZE_SHORT;
 	if (ctx->retval) {
 		ctx->retval = -EINVAL;
 		return 0;
-- 
2.55.0

Re: [PATCH] HID: bpf: Accept 123-byte pen descriptor in Huion Frego M quirk

From: Benjamin Tissoires <bentiss@kernel.org>
Date: 2026-09-14 16:05:13

On Thu, 10 Sep 2026 11:09:00 +0000, Ririn Ume wrote:
The L610 pen descriptor is also seen 2 bytes shorter (123 bytes) than
the 125 bytes the quirk expects, so probe() rejects the device and the
fixup is never applied; the second side button stays reported as
Secondary Tip Switch.

The anchor bytes checked (offsets 0-3, 16-17) are the same in both
variants, so accept either length. The fixup still rewrites the usage
only after every anchor matches, leaving other layouts untouched.

[...]
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git (for-7.4/bpf), thanks!

[1/1] HID: bpf: Accept 123-byte pen descriptor in Huion Frego M quirk
      https://git.kernel.org/hid/hid/c/73712e5e815f

Cheers,
-- 
Benjamin Tissoires [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help