drivers/hid/bpf/progs/Generic__touchpad.bpf.c
Source file repositories/reference/linux-study-clean/drivers/hid/bpf/progs/Generic__touchpad.bpf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/bpf/progs/Generic__touchpad.bpf.c- Extension
.c- Size
- 1901 bytes
- Lines
- 91
- 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.hhid_usages.hbpf/bpf_tracing.h
Detected Declarations
function probefunction hid_bpf_for_each_feature_reportfunction hid_bpf_for_each_field
Annotated Snippet
hid_bpf_for_each_field(feature, field) {
if (field->usage_page == HidUsagePage_Digitizers &&
field->usage_id == HidUsage_Dig_PadType) {
pad_type = field;
pad_type_feature = feature;
break;
}
}
if (pad_type)
break;
}
if (!pad_type || !pad_type_feature) {
ctx->retval = -EINVAL;
return 0;
}
hid_ctx = hid_bpf_allocate_context(ctx->hid);
if (!hid_ctx)
return -1; /* EPERM check */
hw_req_buf[0] = pad_type_feature->report_id;
ret = hid_bpf_hw_request(hid_ctx, hw_req_buf, sizeof(hw_req_buf),
HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
hid_bpf_release_context(hid_ctx);
if (ret < 0) {
ctx->retval = ret;
return 0;
}
ctx->retval = 0;
switch (EXTRACT_BITS(hw_req_buf, pad_type)) {
case 0:
pad_type_str = "Clickpad";
break;
case 1:
pad_type_str = "Pressurepad";
break;
case 2:
pad_type_str = "Discrete";
break;
default:
pad_type_str = "Unknown";
}
UDEV_PROP_SPRINTF(HID_DIGITIZER_PAD_TYPE, "%s", pad_type_str);
return 0;
}
char _license[] SEC("license") = "GPL";
Annotation
- Immediate include surface: `vmlinux.h`, `hid_bpf.h`, `hid_bpf_helpers.h`, `hid_report_helpers.h`, `hid_usages.h`, `bpf/bpf_tracing.h`.
- Detected declarations: `function probe`, `function hid_bpf_for_each_feature_report`, `function hid_bpf_for_each_field`.
- 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.