usb_gadget_disconnect(9)
π usb_gadget_disconnect π
Okay so bestie, this is a kernel API manual page β usb_gadget_disconnect(9) β and it's literally about hanging up on the USB host. Ghosting, but make it firmware. π«Ά
β¨ NAME β¨
usb_gadget_disconnect β software-controlled disconnect from USB host
Yeah. You're the peripheral, you get to decide when the relationship ends. Iconic behavior, no cap. π
πΈ SYNOPSIS πΈ
int usb_gadget_disconnect (struct usb_gadget *gadget );
π ARGUMENTS π
gadgetβ the peripheral being disconnected. That's your device, your main character, the one getting unplugged (spiritually). β¨
π¦ DESCRIPTION π¦
So here's the vibe: this disables the D+ (or potentially D-) pullup, which the host may see as a disconnect (when a VBUS session is active). Basically you flip the little resistor switch and the host is like "waitβ¦ where'd they go π".
Lowkey important caveat bestie: not all systems support software pullup controls. So like, don't count on it everywhere. Check your hardware first, fr fr.
Following a successful disconnect, it invokes the ->disconnect callback for the current gadget driver so that UDC drivers don't need to. Very considerate. Very delegation. We love a clean separation of concerns. π
Returns zero on success, else negative errno. So 0 = slay β
, negative = something's giving error π.
π₯ SEE ALSO π₯
Okay so this list is LONG, but literally every single one matters, so we're not skipping a single crumb. π
- Kernel file
./drivers/usb/gadget/udc/core.cstruct usb_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_set_halt(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_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 I said. Every. Single. Crumb. π§
And that's the whole page, bestie β mwah π. This little number lives over in ./drivers/usb/gadget/udc, and the date on it is October 2026. Go forth and disconnect 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