Add HID-BPF tutorial and implementation for virtual mouse input modification

- Introduced a comprehensive tutorial in README.md explaining how to fix broken HID devices using eBPF without kernel patches.
- Implemented a userspace program (hid-input-modifier.c) that creates a virtual HID mouse using the uhid interface and sends synthetic mouse events.
- Developed a BPF program (hid-input-modifier.bpf.c) that intercepts HID events and modifies mouse movement data, effectively doubling the X and Y movement.
- Created necessary header files (hid_bpf.h, hid_bpf_defs.h, hid_bpf_helpers.h) to define structures and helper functions for the BPF program.
- Added functionality to find and manage the virtual HID device, ensuring seamless integration with the BPF program.
This commit is contained in:
yunwei37
2025-10-05 22:40:58 -07:00
parent 5319e02c7c
commit 277ecbaf9d
35 changed files with 1101 additions and 5 deletions

View File

@@ -1,2 +1,2 @@
level=Depth
type=tracing
type=Tracing

View File

@@ -2,6 +2,8 @@
Have you ever wondered how much energy your applications are consuming? As energy efficiency becomes increasingly critical in both data centers and edge devices, understanding power consumption at the process level is essential for optimization. In this tutorial, we'll build an eBPF-based energy monitoring tool that provides real-time insights into process-level power consumption with minimal overhead.
> The complete source code: <https://github.com/eunomia-bpf/bpf-developer-tutorial/tree/main/src/48-energy>
## Introduction to Energy Monitoring and Power Analysis
Energy monitoring in computing systems has traditionally been challenging due to the lack of fine-grained measurement capabilities. While hardware counters like Intel RAPL (Running Average Power Limit) can measure total system or CPU package power, they don't tell you which processes are consuming that power. This is where software-based energy attribution comes into play.