usb_gadget_disconnect(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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. πŸ“

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