STRUCT USB_HIDG_REPORT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ struct usb_hidg_report(9) πŸŽ€

ok so this is a page from the Kernel API Manual, and today's main character is struct usb_hidg_report β€” literally the response to GET_REPORT. bestie, it's giving "small struct, big responsibilities" and i promise it's not scary πŸ’…


✨ NAME ✨

struct usb_hidg_report β€” the response to GET_REPORT, no cap 🫢


🌸 SYNOPSIS 🌸

ok here's the whole vibe, copy it exactly, do NOT freestyle:

struct usb_hidg_report {
    __u8 report_id;
    __u8 userspace_req;
    __u16 length;
    __u8 data[MAX_REPORT_LENGTH];
    __u8 padding[4];
 };

that's the entire struct, every field accounted for, we love a full roster πŸ‘‘


πŸ’– Members πŸ’–

  • report_id β€” the report ID that this is a response for. like, which request is this replying to, iykyk 🎯
  • userspace_req β€” ok this one's a little two-modes situation, pay attention:
    • !0 β†’ this report is used for any pending GET_REPORT request, but it waits on userspace to issue a new report on future requests πŸ•
    • 0 β†’ this report is to be used for any future GET_REPORT requests πŸ’«
  • length β€” the length of the report response. the actual size, fr fr πŸ“
  • data β€” the report response itself. the payload. the moment. the content πŸ“
  • padding β€” padding for 32/64 bit compatibility. yes it's just sitting there, no it's not useless, it's doing important structural work, respect it πŸ™ˆ

🌈 Description 🌈

this is the structure used by the GADGET_HID_WRITE_GET_REPORT ioctl on /dev/hidg*. that's it. that's the whole job. iconic honestly πŸ‘‘

lowkey reminder: this is a uapi header situation, so the layout is a contract β€” the padding[4] is there for 32/64 bit compatibility and you do not get to "clean it up" bestie πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

  • Kernel file ./include/uapi/linux/usb/g_hid.h β€” go read it, it's right there 🧚

ok that's the whole page, you ate that πŸ’… and for the credits (because everyone deserves their flowers): this came from ./include/uapi/linux/usb, dated October 2026 🌸 mwah, bye bestie! πŸŽ€βœ¨

πŸ“¦ where this page comes from