STRUCT USB_EP(9)
π 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'sep_listholds 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βTrueif 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 withmaxpacket, 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:
struct usb_request(9)struct usb_ep_caps(9)free_usb_request(9)struct usb_gadget(9)usb_ep_align(9)usb_ep_align_maybe(9)gadget_is_altset_supported(9)gadget_is_stall_supported(9)gadget_is_zlp_supported(9)gadget_avoids_skb_reserve(9)gadget_is_dualspeed(9)gadget_is_superspeed(9)gadget_is_superspeed_plus(9)gadget_is_otg(9)struct usb_gadget_driver(9)usb_gadget_register_driver_owner(9)usb_gadget_unregister_driver(9)struct usb_string(9)struct usb_gadget_strings(9)usb_free_descriptors(9)
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
- 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