Skip to content

Commit 43db191

Browse files
author
Benjamin Tissoires
committed
HID: bpf: Suppress bogus F13 trigger on Sirius keyboard full fan shortcut
The TUXEDO Sirius 16 Gen1 and the TUXEDO Sirius 16 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 <[email protected]> Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/166 Acked-by: Jiri Kosina <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 56be863 commit 43db191

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/* Copyright (c) 2025 TUXEDO Computers GmbH
3+
*/
4+
5+
#include "vmlinux.h"
6+
#include "hid_bpf.h"
7+
#include "hid_bpf_helpers.h"
8+
#include <bpf/bpf_tracing.h>
9+
10+
HID_BPF_CONFIG(
11+
HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 0x048D, 0x8910)
12+
);
13+
14+
SEC(HID_BPF_DEVICE_EVENT)
15+
int BPF_PROG(ignore_key_fix_event, struct hid_bpf_ctx *hid_ctx)
16+
{
17+
const int expected_length = 37;
18+
const int expected_report_id = 1;
19+
__u8 *data;
20+
int i;
21+
22+
if (hid_ctx->size < expected_length)
23+
return 0;
24+
25+
data = hid_bpf_get_data(hid_ctx, 0, expected_length);
26+
if (!data || data[0] != expected_report_id)
27+
return 0;
28+
29+
// Zero out F13 (HID usage ID: 0x68) key press.
30+
// The first 6 parallel key presses (excluding modifier keys) are
31+
// encoded in an array containing usage IDs.
32+
for (i = 3; i < 9; ++i)
33+
if (data[i] == 0x68)
34+
data[i] = 0x00;
35+
// Additional parallel key presses starting with the 7th (excluding
36+
// modifier keys) are encoded as a bit flag with the offset being
37+
// the usage ID.
38+
data[22] &= 0xfe;
39+
40+
return 0;
41+
}
42+
43+
HID_BPF_OPS(ignore_button) = {
44+
.hid_device_event = (void *)ignore_key_fix_event,
45+
};
46+
47+
char _license[] SEC("license") = "GPL";

0 commit comments

Comments
 (0)