mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ruzal <daminovruzal7@gmail.com>
To: Benjamin Tissoires <bentiss@kernel.org>
Cc: jikos@kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] HID: multitouch: add support for Goodix GXTP7863 touchpad
Date: Wed, 23 Sep 2026 18:05:08 +0300	[thread overview]
Message-ID: <1edaa3cf-f3bb-4408-8777-3ff44a4a2209@gmail.com> (raw)
In-Reply-To: <arPT9zIoypn5V3PT@beelink>

On 9/23/26 4:31 PM, Benjamin Tissoires wrote:
> If you could work on it yourself that would be great
> 
> FWIW, I tried playing with the new HID_REPORT_DESCRIPTOR but if this
> allows to read the current report descriptor, this doesn't allow to
> amend it, making things a little bit too complex to implement properly.
> So it would be simple enough to use the same old bits checking and
> changing so you get the BPF quickly out.
> 
> Cheers,
> Benjamin


Hi Benjamin,

I implemented the BPF fix and verified it by toggling with `udev-hid-bpf remove`
and `add`: without the BPF program the UNKNOWN keyboard node appears
immediately, and with the BPF loaded it completely disappears.

I wanted to open a Merge Request on GitLab, but my new account
(@mounkastel) hit the anti-spam project limit barrier ("Limit reached:
You cannot create projects in your personal namespace"). I have filed a user
verification issue on freedesktop/freedesktop.

In the meantime, here is the git patch below so you can review or apply it
directly to udev-hid-bpf.

Cheers,
Ruzal

From d585a7cdb2f75dd0d22dda9d7701147d4290d191 Mon Sep 17 00:00:00 2001
From: Ruzal Daminov <daminovruzal7@gmail.com>
Date: Wed, 23 Sep 2026 17:42:10 +0300
Subject: [PATCH] HID: bpf: Add Goodix GXTP7863 touchpad telemetry fix

The Goodix GXTP7863 touchpad found on Honor MagicBook laptops emits a
periodic 1-Hz telemetry heartbeat report on vendor page 0xFF01.

Because page 0xFF01 is historically mapped to HP vendor hotkeys in
hid-input, changing telemetry payload bytes are misinterpreted as
brightness keypresses, resulting in an endless KEY_BRIGHTNESSUP loop.

Remap the vendor telemetry page to an ignored vendor page to prevent
hid-input from creating a bogus keyboard node, while keeping the raw
reports available through hidraw for firmware updates.

Tested on Honor MagicBook X14 Plus (FMI-76, AMD Ryzen 8845HS).

Signed-off-by: Ruzal Daminov <daminovruzal7@gmail.com>
---
 src/bpf/testing/0010-Goodix__GXTP7863.bpf.c | 66 +++++++++++++++++++++
 src/bpf/testing/meson.build                 |  1 +
 2 files changed, 67 insertions(+)
 create mode 100644 src/bpf/testing/0010-Goodix__GXTP7863.bpf.c

diff --git a/src/bpf/testing/0010-Goodix__GXTP7863.bpf.c b/src/bpf/testing/0010-Goodix__GXTP7863.bpf.c
new file mode 100644
index 0000000..84372c7
--- /dev/null
+++ b/src/bpf/testing/0010-Goodix__GXTP7863.bpf.c
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (c) 2026 Ruzal Daminov */
+
+/*
+ * Goodix GXTP7863 Touchpad Telemetry Fix
+ *
+ * Problem: The touchpad sends periodic 1-Hz heartbeat reports on Report ID 8
+ * with Vendor Usage Page 0xFF01. hid-input treats Usage Page 0xFF01 as
+ * HID_UP_HPVENDOR2, misinterpreting changing telemetry bytes as phantom
+ * KEY_BRIGHTNESSUP events.
+ *
+ * Fix: Remap the vendor telemetry collection to an ignored vendor usage page.
+ * This prevents hid-input from creating a bogus keyboard input node while
+ * keeping raw reports accessible via hidraw for firmware updates.
+ */
+
+#include "vmlinux.h"
+#include "hid_bpf.h"
+#include "hid_bpf_helpers.h"
+#include <bpf/bpf_tracing.h>
+
+#define I2C_VENDOR_ID_GOODIX		0x27c6
+#define I2C_DEVICE_ID_GOODIX_01E0	0x01e0
+
+HID_BPF_CONFIG(
+	HID_DEVICE(BUS_I2C, HID_GROUP_ANY, I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_01E0)
+);
+
+SEC(HID_BPF_RDESC_FIXUP)
+int BPF_PROG(hid_fix_rdesc_goodix_touchpad, struct hid_bpf_ctx *hctx)
+{
+	__u8 *data = hid_bpf_get_data(hctx, 0, 4096);
+
+	if (!data)
+		return 0;
+
+	if (hctx->size == 705) {
+		/*
+		 * Report 8: Change Usage Page from 0xFF01 (HID_UP_HPVENDOR2)
+		 * to 0xFF09 (HID_UP_LOGIVENDOR2) at index 625.
+		 */
+		if (data[625] == 0x06 && data[626] == 0x01 && data[627] == 0xff &&
+		    data[632] == 0x85 && data[633] == 0x08) {
+			data[626] = 0x09;
+		}
+	}
+
+	return 0;
+}
+
+HID_BPF_OPS(goodix_touchpad_ops) = {
+	.hid_rdesc_fixup = (void *)hid_fix_rdesc_goodix_touchpad,
+};
+
+SEC("syscall")
+int probe(struct hid_bpf_probe_args *ctx)
+{
+	if (ctx->rdesc_size != 705) {
+		ctx->retval = -EINVAL;
+		return 0;
+	}
+	ctx->retval = 0;
+	return 0;
+}
+
+char _license[] SEC("license") = "GPL";
diff --git a/src/bpf/testing/meson.build b/src/bpf/testing/meson.build
index 73158c9..97435ad 100644
--- a/src/bpf/testing/meson.build
+++ b/src/bpf/testing/meson.build
@@ -11,6 +11,7 @@ tracing_sources = [
     '0010-Iiyama__ProLite-TE9804MIS.bpf.c',
     '0010-XPPen__DecoSE.bpf.c',
     '0010-Corsair__K70-CORE.bpf.c',
+    '0010-Goodix__GXTP7863.bpf.c',
 ]
 
 # 'sources' are BPF programs only compatible with
-- 
2.55.0

      reply	other threads:[~2026-09-23 15:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 17:12 [PATCH 1/2] " Ruzal Daminov
2026-08-19  9:15 ` [PATCH v2] " Ruzal Daminov
2026-08-19  9:39 ` [PATCH v3] " Ruzal Daminov
2026-08-19 12:33 ` [PATCH v4] " Ruzal Daminov
2026-09-17  7:30   ` Benjamin Tissoires
2026-09-17 12:51     ` Ruzal
2026-09-18 16:18       ` Benjamin Tissoires
2026-09-18 18:01         ` Ruzal
2026-09-19  9:23           ` Ruzal
2026-09-22 13:24             ` Benjamin Tissoires
2026-09-22 16:39               ` Ruzal
2026-09-23 13:31                 ` Benjamin Tissoires
2026-09-23 15:05                   ` Ruzal [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=1edaa3cf-f3bb-4408-8777-3ff44a4a2209@gmail.com \
    --to=daminovruzal7@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®