usb_ep_set_halt(9)
π 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: aCLEAR_FEATUREon an endpoint will be invisible to the gadget driver, but aSET_INTERFACEwill 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:
- Kernel file
./drivers/usb/gadget/udc/core.cstructusb_udc(9) usb_ep_set_maxpacket_limit(9)usb_ep_enable(9)usb_ep_disable(9)usb_ep_alloc_request(9)usb_ep_free_request(9)usb_ep_queue(9)usb_ep_dequeue(9)usb_ep_clear_halt(9)usb_ep_set_wedge(9)usb_ep_fifo_status(9)usb_ep_fifo_flush(9)usb_gadget_frame_number(9)usb_gadget_wakeup(9)usb_gadget_set_remote_wakeup(9)usb_gadget_set_selfpowered(9)usb_gadget_clear_selfpowered(9)usb_gadget_vbus_connect(9)usb_gadget_vbus_draw(9)usb_gadget_vbus_disconnect(9)usb_gadget_connect(9)usb_gadget_disconnect(9)usb_gadget_deactivate(9)usb_gadget_activate(9)usb_gadget_giveback_request(9)gadget_find_ep_by_name(9)usb_gadget_check_config(9)usb_udc_vbus_handler(9)usb_gadget_udc_reset(9)usb_gadget_udc_start_locked(9)usb_gadget_udc_stop_locked(9)usb_gadget_udc_set_speed(9)usb_gadget_enable_async_callbacks(9)usb_gadget_disable_async_callbacks(9)usb_udc_release(9)usb_initialize_gadget(9)usb_add_gadget(9)usb_add_gadget_udc_release(9)usb_get_gadget_udc_name(9)usb_add_gadget_udc(9)usb_del_gadget(9)usb_del_gadget_udc(9)
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
- 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