STRUCT USB_EP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so bestie, gather round β€” struct usb_ep is literally the device side representation of a USB endpoint. that's it, that's the vibe. ✨


🌸 SYNOPSIS 🌸

struct usb_ep {
    void *driver_data;
    const char              *name;
    const struct usb_ep_ops *ops;
    const struct usb_endpoint_descriptor    *desc;
    const struct usb_ss_ep_comp_descriptor  *comp_desc;
    struct list_head        ep_list;
    struct usb_ep_caps      caps;
    bool claimed;
    bool enabled;
    unsigned mult:2;
    unsigned maxburst:5;
    u8 address;
    u16 maxpacket;
    u16 maxpacket_limit;
    u16 max_streams;
 };

like, look at her. she's giving struct. she's giving bitfields. we stan πŸŽ€


πŸ¦‹ Members πŸ¦‹

okay now we go member by member, no skipping, every single one gets its moment bestie πŸ’…

  • driver_data β€” this one's just for the gadget driver to use. free real estate, basically. it's yours, do whatever 🫢
  • name β€” the identifier for the endpoint, something like "ep-a" or "ep9in-bulk". her government name, iykyk ✨
  • ops β€” function pointers used to access all the hardware-specific operations. the actual muscle behind the vibes πŸ’ͺ
  • desc β€” the endpoint descriptor. lowkey important: this pointer is set before the endpoint is enabled, and it stays valid right up until the endpoint gets disabled. don't be weird about it πŸ™ˆ
  • comp_desc β€” in case of SuperSpeed support (yes queen, SS), this is the endpoint companion descriptor used to configure the endpoint. the plus-one, the entourage 🌈
  • ep_list β€” the gadget's ep_list holds all of its endpoints. the whole group chat πŸ‘‘
  • caps β€” the structure describing the types and directions supported by the endpoint. her capability list, her resume πŸŽ€
  • claimed β€” True if this endpoint is claimed by a function. taken. spoken for πŸ’
  • enabled β€” the current endpoint enabled/disabled state. on or off, no in-between ⭐
  • mult β€” multiplier, the 'mult' value for SS Isoc EPs. two whole bits of it πŸ”₯
  • maxburst β€” the maximum number of bursts supported by this EP (for usb3). five bits, living large ✨
  • address β€” used to identify the endpoint when finding the descriptor that matches the connection speed. her little name tag at the function 🏷️
  • maxpacket β€” the maximum packet size used on this endpoint. the initial value can sometimes be reduced (hardware allowing), according to the endpoint descriptor used to configure the endpoint. so like, flexible but not that flexible πŸ’…
  • maxpacket_limit β€” the maximum packet size value which can actually be handled by this endpoint. it's set once by the UDC driver when the endpoint is initialized, and should not be changed. do not confuse her with maxpacket, they are different people, they are not the same, periodt πŸ’€
  • max_streams β€” the maximum number of streams supported by this EP (0 - 16, actual number is 2^n). yes, exponential, math girlies rise 🧚

πŸ“ Description πŸ“

okay so here's the whole picture:

the bus controller driver lists all the general purpose endpoints in gadget->ep_list. that's the roster πŸ“‹

but the control endpoint, gadget->ep0, is not in that list β€” nope, she's special. she's only accessed in response to a driver setup callback. main character energy, honestly. she doesn't queue with the rest of them πŸ‘‘βœ¨


πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, linked in the kernel file ./include/linux/usb/gadget.h:


ngl bestie, if you read all of that and your brain is still intact, you absolutely ate πŸ’…βœ¨

okay bye, this was sourced from ./include/linux/usb with the date October 2026 β€” and yes the whole page is literally called struct usb_ep(9), she's in the kernel API manual, she's booked, she's busy, she's iconic πŸ¦‹πŸ’–πŸŽ€

πŸ“¦ where this page comes from