xhci_get_endpoint_index(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ xhci_get_endpoint_index(9) ✨

okay bestie, welcome to the Kernel API Manual πŸ’… this one's a lil function from the USB host controller world and honestly it's giving "tiny but crucial" energy πŸŽ€


🌸 NAME 🌸

xhci_get_endpoint_index β€” the lil helper used for passing endpoint bitmasks between the core and HCDs 🫢 its whole job? find the index for an endpoint given its descriptor. then you take the return value and right shift 1 by it to get your bitmask. iconic behavior, no cap ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned int xhci_get_endpoint_index (struct usb_endpoint_descriptor
*desc );

πŸ’– ARGUMENTS πŸ’–

  • desc β€” the USB endpoint descriptor you wanna determine the index for πŸ’«

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the math bestie, and it's literally this:

Index = (epnum * 2) + direction - 1

where direction = 0 for OUT and 1 for IN 🌈

and for control endpoints? the IN index is the one that gets used (the OUT index is unused, lowkey just sitting there πŸ™ˆ), so it works out to:

index = (epnum * 2) + direction - 1 = (epnum * 2) + 1 - 1 = (epnum * 2)

math ate that fr fr πŸ”₯


🧚 SEE ALSO 🧚


that's the whole page, bestie β€” short, sweet, and mathematically slay πŸ’œ

sign-off szn πŸŽ€ this one lives in ./drivers/usb/host, dated October 2026, and it's page xhci_get_endpoint_index(9) of the Kernel API Manual β€” go forth and right shift that 1 responsibly βœ¨πŸ’–

πŸ“¦ where this page comes from