diff options
| author | Ririn Ume <ume@ririn.moe> | 2026-09-10 11:09:00 +0000 |
|---|---|---|
| committer | Benjamin Tissoires <bentiss@kernel.org> | 2026-09-14 18:02:17 +0200 |
| commit | 73712e5e815f5a9ce8a9052d6cf9233fd39c46a4 (patch) | |
| tree | 078223eba4111224eaa76818537c253ebb333e9b | |
| parent | 986c24e0fe44f844b44d365b71ce831947f50298 (diff) | |
| download | linux-next-73712e5e815f5a9ce8a9052d6cf9233fd39c46a4.tar.gz linux-next-73712e5e815f5a9ce8a9052d6cf9233fd39c46a4.zip | |
HID: bpf: Accept 123-byte pen descriptor in Huion Frego M quirk
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 <ume@ririn.moe>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
| -rw-r--r-- | drivers/hid/bpf/progs/Huion__Inspiroy-Frego-M.bpf.c | 11 |
1 files 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; |
