public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Tissoires <bentiss@kernel.org>
To: Jiri Kosina <jikos@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	 muhammed Rishal <muhammedrishal7777777@gmail.com>
Subject: Re: [PATCH 8/8] bpf: Add fix for Trust Philips SPK6327 (145f:024b) modifier keys
Date: Fri, 3 Apr 2026 18:17:43 +0200	[thread overview]
Message-ID: <ac_nblOZD_DwTYKb@beelink> (raw)
In-Reply-To: <20260403-wip-sync-udev-hid-bpf-2026-04-v1-8-978cedb9a074@kernel.org>

Of course, you hit send and you realize the commit message is missing
the 'HID:' marker. Sorry Jiri.

Also, this commit should probably be tagged with:
From: muhammed Rishal <muhammedrishal7777777@gmail.com>

Sorry, again.

Muhammed, FYI, there is nothing to be done on your side (just in case
you wonder why you receive this email). It's the normal process to merge
testing HID-BPF programs into stable.

Cheers,
Benjamin

On Apr 03 2026, Benjamin Tissoires wrote:
> The Trust Philips SPK6327 keyboard (USB ID 145f:024b) has a broken HID
> descriptor on interface 1. Byte 101 is 0x00 (Input Array) but should be
> 0x02 (Input Variable), causing LCtrl, LAlt, Super, RAlt, RCtrl and
> RShift to all report as LShift on Linux.
> 
> This BPF fix patches byte 101 at runtime fixing all affected modifier
> keys.
> 
> Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/234
> Signed-off-by: muhammed Rishal <muhammedrishal7777777@gmail.com>
> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> ---
>  drivers/hid/bpf/progs/Trust__Philips-SPK6327.bpf.c | 49 ++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
> 
> diff --git a/drivers/hid/bpf/progs/Trust__Philips-SPK6327.bpf.c b/drivers/hid/bpf/progs/Trust__Philips-SPK6327.bpf.c
> new file mode 100644
> index 000000000000..bc7ff27eac9f
> --- /dev/null
> +++ b/drivers/hid/bpf/progs/Trust__Philips-SPK6327.bpf.c
> @@ -0,0 +1,49 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/* Fix for Trust Philips SPK6327 (145f:024b)
> + * Modifier keys report as Array (0x00) instead of Variable (0x02)
> + * causing LCtrl, LAlt, Super etc. to all act as LShift
> + */
> +#include "vmlinux.h"
> +#include "hid_bpf.h"
> +#include "hid_bpf_helpers.h"
> +#include <bpf/bpf_tracing.h>
> +
> +#define VID_TRUST 0x145F
> +#define PID_SPK6327 0x024B
> +
> +HID_BPF_CONFIG(
> +	HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, VID_TRUST, PID_SPK6327)
> +);
> +
> +SEC(HID_BPF_RDESC_FIXUP)
> +int BPF_PROG(hid_fix_rdesc, struct hid_bpf_ctx *hctx)
> +{
> +	__u8 *data = hid_bpf_get_data(hctx, 0, 4096);
> +
> +	if (!data)
> +		return 0;
> +
> +	/* Fix modifier keys: Input Array (0x00) -> Input Variable (0x02) */
> +	if (data[101] == 0x00)
> +		data[101] = 0x02;
> +
> +	return 0;
> +}
> +
> +HID_BPF_OPS(trust_spk6327) = {
> +	.hid_rdesc_fixup = (void *)hid_fix_rdesc,
> +};
> +
> +SEC("syscall")
> +int probe(struct hid_bpf_probe_args *ctx)
> +{
> +	/* Only apply to interface 1 (169 bytes) not interface 0 (62 bytes) */
> +	if (ctx->rdesc_size == 169)
> +		ctx->retval = 0;
> +	else
> +		ctx->retval = -EINVAL;
> +
> +	return 0;
> +}
> +
> +char _license[] SEC("license") = "GPL";
> 
> -- 
> 2.53.0
> 
> 

      reply	other threads:[~2026-04-03 16:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 16:12 [PATCH 0/8] HID: bpf: sync up programs with udev-hid-bpf Benjamin Tissoires
2026-04-03 16:12 ` [PATCH 1/8] HID: bpf: fix some signed vs unsigned compiler warnings Benjamin Tissoires
2026-04-03 16:12 ` [PATCH 2/8] HID: bpf: hid_bpf_helpers: provide a cleanup functions Benjamin Tissoires
2026-04-03 16:12 ` [PATCH 3/8] HID: bpf: add helper macros for LE/BE conversion Benjamin Tissoires
2026-04-03 16:12 ` [PATCH 4/8] HID: bpf: handle injected report descriptor in HID-BPF Benjamin Tissoires
2026-04-03 16:12 ` [PATCH 5/8] hid: bpf: hid_bpf_helpers: add helper for having read/write udev properties Benjamin Tissoires
2026-04-03 16:12 ` [PATCH 6/8] HID: bpf: add a BPF to get the touchpad type Benjamin Tissoires
2026-04-03 16:12 ` [PATCH 7/8] HID: bpf: Add support for the Huion KeyDial K20 over bluetooth Benjamin Tissoires
2026-04-03 16:12 ` [PATCH 8/8] bpf: Add fix for Trust Philips SPK6327 (145f:024b) modifier keys Benjamin Tissoires
2026-04-03 16:17   ` Benjamin Tissoires [this message]

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=ac_nblOZD_DwTYKb@beelink \
    --to=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muhammedrishal7777777@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