xhci_get_endpoint_index(9)
β¨ 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 π§
- Kernel file
./drivers/usb/host/xhci.c xhci_setup_device(9)
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
- 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