Path: blob/master/drivers/hid/bpf/progs/TUXEDO__Sirius-16-Gen1-and-Gen2.bpf.c
26285 views
// SPDX-License-Identifier: GPL-2.0-or-later1/* Copyright (c) 2025 TUXEDO Computers GmbH2*/34#include "vmlinux.h"5#include "hid_bpf.h"6#include "hid_bpf_helpers.h"7#include <bpf/bpf_tracing.h>89HID_BPF_CONFIG(10HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 0x048D, 0x8910)11);1213SEC(HID_BPF_DEVICE_EVENT)14int BPF_PROG(ignore_key_fix_event, struct hid_bpf_ctx *hid_ctx)15{16const int expected_length = 37;17const int expected_report_id = 1;18__u8 *data;19int i;2021if (hid_ctx->size < expected_length)22return 0;2324data = hid_bpf_get_data(hid_ctx, 0, expected_length);25if (!data || data[0] != expected_report_id)26return 0;2728// Zero out F13 (HID usage ID: 0x68) key press.29// The first 6 parallel key presses (excluding modifier keys) are30// encoded in an array containing usage IDs.31for (i = 3; i < 9; ++i)32if (data[i] == 0x68)33data[i] = 0x00;34// Additional parallel key presses starting with the 7th (excluding35// modifier keys) are encoded as a bit flag with the offset being36// the usage ID.37data[22] &= 0xfe;3839return 0;40}4142HID_BPF_OPS(ignore_button) = {43.hid_device_event = (void *)ignore_key_fix_event,44};4546char _license[] SEC("license") = "GPL";474849