lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250109183723.190507-1-wse@tuxedocomputers.com>
Date: Thu,  9 Jan 2025 19:37:01 +0100
From: Werner Sembach <wse@...edocomputers.com>
To: Werner Sembach <wse@...edocomputers.com>,
	Jiri Kosina <jikos@...nel.org>,
	Benjamin Tissoires <bentiss@...nel.org>
Cc: linux-kernel@...r.kernel.org,
	linux-input@...r.kernel.org,
	bpf@...r.kernel.org
Subject: [PATCH] Suppress bogus F13 trigger on Sirius keyboard full fan shortcut

The TUXEDO Sirius 15 Gen1 and the TUXEDO Sirius 15 Gen2 Notebooks have an
additional "fan" key next to F12.

Pressing it alone sends a F14 key press which can be bound by user space.

Pressing it while holding the FN key triggers two things:
- The EC firmware locks the fan speed of the internal fans at 100%
- F13 key press is registered which by default is already bound in xkb and
  desktop environments (e.g. in KDE Plasma it launches system settings)

To avoid this unexpected double duty of the FN shortcut, this bpf program
suppresses the F13 key press.

Signed-off-by: Werner Sembach <wse@...edocomputers.com>
---
 MAINTAINERS                                   |  6 +++
 .../TUXEDO__Sirius-15-Gen1-and-Gen2.bpf.c     | 51 +++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 drivers/hid/bpf/progs/TUXEDO__Sirius-15-Gen1-and-Gen2.bpf.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 30cbc3d44cd53..cdd86aaa4d979 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -23924,6 +23924,12 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git turbostat
 F:	tools/power/x86/turbostat/
 F:	tools/testing/selftests/turbostat/
 
+TUXEDO SIRIUS 15 GEN1 AND GEN2 BPF KEYBOARD FIX
+M:	Werner Sembach <wse@...edocomputers.com>
+L:	linux-input@...r.kernel.org
+S:	Supported
+F:	drivers/hid/bpf/progs/TUXEDO__Sirius-15-Gen1-and-Gen2.bpf.c
+
 TW5864 VIDEO4LINUX DRIVER
 M:	Bluecherry Maintainers <maintainers@...echerrydvr.com>
 M:	Andrey Utkin <andrey.utkin@...p.bluecherry.net>
diff --git a/drivers/hid/bpf/progs/TUXEDO__Sirius-15-Gen1-and-Gen2.bpf.c b/drivers/hid/bpf/progs/TUXEDO__Sirius-15-Gen1-and-Gen2.bpf.c
new file mode 100644
index 0000000000000..e77530bd60a59
--- /dev/null
+++ b/drivers/hid/bpf/progs/TUXEDO__Sirius-15-Gen1-and-Gen2.bpf.c
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (c) 2025 TUXEDO Computers GmbH
+ */
+
+#include "vmlinux.h"
+#include "hid_bpf.h"
+#include "hid_bpf_helpers.h"
+#include <bpf/bpf_tracing.h>
+
+HID_BPF_CONFIG(
+	HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 0x048D, 0x8910)
+);
+
+SEC(HID_BPF_DEVICE_EVENT)
+int BPF_PROG(ignore_key_fix_event, struct hid_bpf_ctx *hid_ctx)
+{
+	const int expected_length = 37;
+	const int expected_report_id = 1;
+	__u8 *data;
+	int i;
+
+	if (hid_ctx->size < expected_length)
+		return 0;
+
+	data = hid_bpf_get_data(hid_ctx, 0, expected_length);
+	if (!data || data[0] != expected_report_id)
+		return 0;
+
+
+	// Delete F13 (HID usage ID: 0x68) key press.
+
+	// The first 6 parallel key presses (excluding modifier keys) are
+	// encoded in an array containing usage IDs.
+	for (i = 3; i < 9; ++i)
+		if (data[i] == 0x68)
+			data[i] = 0x00;
+
+	// Additional parallel key presses starting with the 7th (excluding
+	// modifier keys) are encoded as a bit flag with the offset being
+	// the usage ID.
+	data[22] &= 0xfe;
+
+
+	return 0;
+}
+
+HID_BPF_OPS(ignore_button) = {
+	.hid_device_event = (void *)ignore_key_fix_event,
+};
+
+char _license[] SEC("license") = "GPL";
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ