usb_ep_set_halt(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ usb_ep_set_halt πŸ’…

okay so bestie, welcome to the Kernel API Manual β€” this one's a kernel function page and it's literally about hitting the stall button on a USB endpoint. sit down, hydrate, let's go ✨


🌸 NAME 🌸

usb_ep_set_halt β€” sets the endpoint halt feature. that's it, that's the whole vibe. it stalls an endpoint. periodt 🫢


✨ SYNOPSIS ✨

int usb_ep_set_halt (struct usb_ep *ep );

one function, one struct pointer, one int coming back at you. iconic minimalism ngl πŸ’œ


πŸ¦‹ ARGUMENTS πŸ¦‹

  • ep β€” the non-isochronous endpoint being stalled. read that again: non-isochronous. iso endpoints are not invited to this party πŸ™ˆ

πŸ’– DESCRIPTION πŸ’–

Use this to stall an endpoint, maybe as a way of reporting an error. lowkey it's the "girl, no" of USB transfers 😭

Except for control endpoints, the endpoint stays halted β€” meaning it will not stream any data β€” until the host clears this feature. so it's not a little pause, it's a full-on "we're closed" sign. drivers may need to empty the endpoint's request queue first, to make sure no inappropriate transfers happen. yes, literally clean out the queue first, no cap 🧹

πŸ’€ heads up: a CLEAR_FEATURE on an endpoint will be invisible to the gadget driver, but a SET_INTERFACE will not be. that asymmetry is real and it Will get you.

To reset endpoints for the current altsetting, see usb_ep_clear_halt. When you're switching altsettings, it's simplest to use usb_ep_enable or usb_ep_disable for the endpoints. like, just use the right tool bestie πŸŽ€

This routine may be called in interrupt context. yes, interrupt context. she's flexible like that ✨

Returns zero, or a negative error code. On success, this call sets underlying hardware state that blocks data transfers β€” so the hardware itself is doing the blocking, not just vibes πŸ”₯

Attempts to halt IN endpoints will fail (returning -EAGAIN) if any transfer requests are still queued, or if the controller hardware (usually a FIFO) still holds bytes that the host hasn't collected. so: drain your queue, and make sure the FIFO isn't still sitting on data the host ghosted πŸ‘» -EAGAIN is the "try again" of it all, and honestly? relatable.


🌈 SEE ALSO 🌈

the whole friend group, fr fr:

like, the entire UDC extended universe. iykyk 🧚


πŸ“ and that's the page!! this lil beauty ships from the source ./drivers/usb/gadget/udc, dated October 2026 β€” go forth and stall responsibly, bestie. mwah πŸ’‹πŸ‘‘
πŸ“¦ where this page comes from