hid_bpf_hw_request(9)
π
hid_bpf_hw_request (9) β the kernel API manual, bestie edition π
Okay so like, welcome to the hid_bpf_hw_request(9) page, which is literally your cheat code for talking to a HID device from BPF. Yes. Actual hardware. From a sandboxed program. Iconic behavior, no cap.
β¨ NAME β¨
hid_bpf_hw_request β communicate with a HID device π¦
Like, you're sliding into your keyboard's DMs. Respectfully. Through the kernel. π
πΈ SYNOPSIS πΈ
__bpf_kfunc int hid_bpf_hw_request (struct hid_bpf_ctx *ctx , __u8 *buf
, size_t buf__sz , enum hid_report_type rtype , enum hid_class_request
reqtype );
Copy it exactly like that, don't get cute with the spacing, the compiler is not in a forgiving mood today. π
π ARGUMENTS π
ctxβ the HID-BPF context you already got fromhid_bpf_allocate_contextearlier. You can't just show up with no context, that's giving party-crasher energy. πbufβ aPTR_TO_MEMbuffer. It's your little memory bag, the verifier is watching it, be normal about it.buf__szβ the size of the data to transfer. It's the__sztwin ofbuf, they're a matching set, don't separate them. π«Άrtypeβ the type of the report, and it's one ofHID_INPUT_REPORT,HID_FEATURE_REPORT, orHID_OUTPUT_REPORT. Pick your fighter. βreqtypeβ the type of the request:HID_REQ_GET_REPORT,HID_REQ_SET_REPORT,...β the...is doing a lot of heavy lifting there but that's literally what the page says, iykyk. π
π₯ DESCRIPTION π₯
It returns 0 on success. Literally that's the whole description. And if it doesn't work out? A negative error code. So like, lowkey just vibe-check the return value before you assume anything slayed. π
Fr fr, 0 = we ate. Negative = we did not eat, go look at the error code and figure out why.
π SEE ALSO π
Kernel file ./drivers/hid/bpf/hid_bpf_dispatch.c β that's the source, main character document. π
And the whole friend group of related calls:
hid_bpf_get_data(9)hid_bpf_allocate_context(9)hid_bpf_release_context(9)hid_bpf_hw_output_report(9)hid_bpf_try_input_report(9)hid_bpf_input_report(9)
Go read all of them, they're a package deal, don't leave anyone on read. π§π
<div align="center">
That's the whole page, bestie β written out of ./drivers/hid/bpf and dated October 2026, and yeah, it's still filed under hid_bpf_hw_request(9) because we do not rename things in this house. Goodbye, go poke a HID device. π
β¨
</div>
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms