usb_gadget_vbus_connect(9)
π 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
8mAor possibly more, especially afterSET_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: πΈ
- 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_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)
π 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
- 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