usb_gadget_vbus_connect(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– usb_gadget_vbus_connect(9) πŸ’–

okay so first things first, bestie β€” this is a page from the Kernel API Manual, and the star of the show is usb_gadget_vbus_connect. it's a kernel function, it's giving "tiny little notification, huge consequences," and we're gonna get into it. πŸ¦‹


✨ NAME ✨

usb_gadget_vbus_connect β€” notify the controller that VBUS is powered πŸ’…

like, that's the whole job. you're the messenger. you tell the controller "hey girl, power's here." 😭


✨ SYNOPSIS ✨

int usb_gadget_vbus_connect (struct usb_gadget *gadget );

that's it. one arg. one return. iconic behavior, honestly. πŸ‘‘


✨ ARGUMENTS ✨

  • gadget β€” the device that now has VBUS power. yes, that one. the one currently living its best life with actual electricity. ⚑🫢

✨ CONTEXT ✨

can sleep 😴

no cap, that's the entire context section. it can sleep. so don't be out here calling it from an atomic context unless you want a bad time, iykyk. πŸ’€


✨ DESCRIPTION ✨

so here's the situation. this call is used by a driver for an external transceiver (or GPIO) that detects a VBUS power session starting. like, the vibe check came back positive: power is on. 🌈

the common responses? obsessed with this list actually:

  • resuming the controller πŸ”₯
  • activating the D+ (or D-) pullup so the host can detect that a USB device is attached β€” literally letting the host know you exist, main character energy fr fr ✨
  • starting to draw power β€” that's 8mA or possibly more, especially after SET_CONFIGURATION. the "especially after" is doing so much work there, ngl 🫢

and the return? zero on success, else negative errno. classic. love that for us. πŸ’–


✨ SEE ALSO ✨

okay this part is long and honestly it ate. here's the whole friend group, no one left behind: 🌸


πŸ’€ reminder that this whole thing can sleep, so keep it out of atomic contexts. that's not a vibe, that's a rule.

and that's the page!! πŸŽ€ this one lives in ./drivers/usb/gadget/udc, dated October 2026, and it's part of the Kernel API Manual β€” so when you see usb_gadget_vbus_connect(9) floating around, you'll know exactly what's up. bye bestie, go notify a controller πŸ’œπŸ¦‹

πŸ“¦ where this page comes from