hid_bpf_input_report(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– hid_bpf_input_report(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual entry for hid_bpf_input_report β€” yes that's the title AND the man page name, iykyk ✨ this one's a kfunc that lets you inject a HID report in the kernel from a HID device, which is honestly kind of iconic of it 🫢


✨ SYNOPSIS ✨

__bpf_kfunc int hid_bpf_input_report (struct hid_bpf_ctx *ctx , enum
hid_report_type type , u8 *buf , const size_t buf__sz );

like, look at her. she's a __bpf_kfunc, she returns an int, and she takes four args. main character behavior fr fr πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • ctx β€” the HID-BPF context, and not just any context: the one you previously allocated in hid_bpf_allocate_context. so like, don't just roll up with some random pointer, okay? πŸ™ˆ
  • type β€” the type of the report. your options are HID_INPUT_REPORT, HID_FEATURE_REPORT, and HID_OUTPUT_REPORT. pick your girlie wisely πŸ’…
  • buf β€” a PTR_TO_MEM buffer. that's the vibe check the verifier's gonna run on it, ngl πŸ’€
  • buf__sz β€” the size of the data to transfer. literally just how many bytes you're moving, no cap πŸ“

🌸 DESCRIPTION 🌸

Returns 0 on success, a negative error code otherwise. that's it, that's the mood 😭

okay but here's the part where you gotta listen, bestie β€” this function will wait for the device to be available before injecting the event. the way that means it needs to be called in sleepable context. like, it's gonna block and chill until the device shows up, so don't you dare call it somewhere that can't sleep. that's not a suggestion, that's the whole deal πŸ”₯

πŸ’€ fr fr: sleepable context only. this function waits on the device, so calling it from a non-sleepable spot is a no from her.

πŸ¦‹ SEE ALSO πŸ¦‹

like yes, go read all of them, they're the friend group and you gotta know the whole squad 🌈


and that's the page!! 🧚 this little beauty lives in ./drivers/hid/bpf, dated October 2026 β€” so like, mark your calendar, write it in your journal, whatever πŸ’œ bye bestie, go inject some reports responsibly βœ¨πŸŽ€

πŸ“¦ where this page comes from