usb_gadget_vbus_draw(9)
π usb_gadget_vbus_draw(9) β the Kernel API Manual page you didn't know you needed π
okay so bestie, welcome to the usb_gadget_vbus_draw(9) page from the Kernel API Manual β¨ this one's short and sweet and honestly it's giving "small but mighty" energy, so let's get into it π«Ά
πΈ NAME πΈ
usb_gadget_vbus_draw β constrain controller's VBUS power usage β‘
π SYNOPSIS π
int usb_gadget_vbus_draw (struct usb_gadget *gadget , unsigned mA );
π¦ ARGUMENTS π¦
gadgetβ the device whose VBUS usage is being described, iykyk π this is the gadget in question, no capmAβ how much current to draw, in milliAmperes π and listen, this one has a lil rule: this should be twice the value listed in the configuration descriptorbMaxPowerfield. twice!! fr fr, don't forget the 2x π
β¨ DESCRIPTION β¨
so this call is used by gadget drivers during SET_CONFIGURATION calls, and it's basically reporting how much power the device may consume π₯ for example, this could affect how quickly batteries are recharged β like literally, it can change your charging vibe π
Returns zero on success, else negative errno π (that's the whole return story, bestie β zero means slay, negative means something went sideways)
π SEE ALSO π
okay this list is LONG but we don't skip, periodt. first up, the kernel file itself: ./drivers/usb/gadget/udc/core.c π§ and then all the friends:
struct 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_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)
that's the whole page bestie, no filler, all facts π go forth and constrain that VBUS power usage responsibly π
and a lil sign-off π this one comes from the source ./drivers/usb/gadget/udc, dated October 2026 β iconic, we love a dated queen πβ¨
π¦ 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