usb_function_deactivate(9)
π usb_function_deactivate β a Kernel API Manual moment
okay so bestie, this one lives in the Kernel API Manual (section 9, the fancy kernel-functions section) and it's called usb_function_deactivate. say it with me. iconic name, honestly.
β¨ NAME β¨
usb_function_deactivate β literally just prevent function and gadget enumeration. that's the whole job. no cap.
π¦ SYNOPSIS π¦
int usb_function_deactivate (struct usb_function *function );
yes, it returns an int, and yes it takes exactly one struct usb_function *. she's simple, she's clean, she's booked and busy.
π ARGUMENTS π
functionβ the function that isn't yet ready to respond π like, she's not ready, she needs a minute, do NOT let the host talk to her yet.
πΈ DESCRIPTION πΈ
so here's the vibe: this bad girl blocks the gadget driver's response to host enumeration by preventing the data line pullup from being activated. the way that works?? she just... doesn't pull the line up, so the host lowkey doesn't even know a device is there. ghosting, but in hardware π
normally you call this during bind processing, to change from the initial "ready to respond" state. or you call it whenever a required resource becomes available β either one, she's flexible like that π«Ά
for example (and this is the good part): drivers that serve as a passthrough to a userspace daemon can block enumeration unless that daemon β think OBEX, MTP, or a print server β is actually ready to handle host requests. it's giving "don't answer the door until the roommate's dressed" energy β¨
β οΈ heads up bestie: not all systems support software control of their USB peripheral data pullups. so like... don't assume. do a vibe check on your platform first. π₯
she returns zero on success, else negative errno. classic. standard. we love a consistent queen π
π SEE ALSO π
the whole squad, in kernel file ./drivers/usb/gadget/composite.c:
struct usb_os_string(9)function_descriptors(9)next_desc(9)config_ep_by_speed_and_alt(9)config_ep_by_speed(9)usb_add_function(9)usb_function_activate(9)usb_interface_id(9)usb_func_wakeup(9)bos_desc(9)usb_add_config(9)usb_string_id(9)usb_string_ids_tab(9)usb_gstrings_attach(9)usb_string_ids_n(9)usb_composite_probe(9)usb_composite_unregister(9)usb_composite_setup_continue(9)
like, the whole composite.c friend group fr fr π§π
and that's the page!! mwah π brought to you by the folks at ./drivers/usb/gadget, dated October 2026 β consider this your cute little sign-off, love u, go deactivate something 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