drivers/hid/bpf/progs/Huion__Dial-2.bpf.c
Source file repositories/reference/linux-study-clean/drivers/hid/bpf/progs/Huion__Dial-2.bpf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/bpf/progs/Huion__Dial-2.bpf.c- Extension
.c- Size
- 23562 bytes
- Lines
- 637
- Domain
- Driver Families
- Bucket
- drivers/hid
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmlinux.hhid_bpf.hhid_bpf_helpers.hhid_report_helpers.hbpf/bpf_tracing.h
Detected Declarations
struct pad_reportfunction BPF_PROGfunction propertyfunction BPF_PROGfunction probe
Annotated Snippet
struct pad_report {
__u8 report_id;
__u8 btn_stylus;
__u8 x;
__u8 y;
__u8 buttons;
__u8 dial_1;
__u8 dial_2;
} __attribute__((packed)) *pad_report;
__u8 dial_1 = 0, dial_2 = 0;
/* Dial report */
if (data[1] == 0xf1) {
__u8 d = 0;
if (data[5] == 2)
d = 0xff;
else
d = data[5];
if (data[3] == 1)
dial_1 = d;
else
dial_2 = d;
} else {
/* data[4] are the buttons, mapped correctly */
last_button_state = data[4];
dial_1 = 0; // dial
dial_2 = 0;
}
pad_report = (struct pad_report *)data;
pad_report->report_id = PAD_REPORT_ID;
pad_report->btn_stylus = 0;
pad_report->x = 0;
pad_report->y = 0;
pad_report->buttons = last_button_state;
pad_report->dial_1 = dial_1;
pad_report->dial_2 = dial_2;
return sizeof(struct pad_report);
}
/* Pen reports need nothing done */
}
return 0;
}
HID_BPF_OPS(inspiroy_dial2) = {
.hid_device_event = (void *)dial_2_fix_events,
.hid_rdesc_fixup = (void *)dial_2_fix_rdesc,
};
SEC("syscall")
int probe(struct hid_bpf_probe_args *ctx)
{
switch (ctx->rdesc_size) {
case PAD_REPORT_DESCRIPTOR_LENGTH:
case PEN_REPORT_DESCRIPTOR_LENGTH:
case VENDOR_REPORT_DESCRIPTOR_LENGTH:
ctx->retval = 0;
break;
default:
ctx->retval = -EINVAL;
}
return 0;
}
char _license[] SEC("license") = "GPL";
Annotation
- Immediate include surface: `vmlinux.h`, `hid_bpf.h`, `hid_bpf_helpers.h`, `hid_report_helpers.h`, `bpf/bpf_tracing.h`.
- Detected declarations: `struct pad_report`, `function BPF_PROG`, `function property`, `function BPF_PROG`, `function probe`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.