usb_function_deactivate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:

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