STRUCT TYPEC_OPERATIONS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

struct typec_operations β€” USB Type-C Port Operations (yes bestie, it's the Kernel API Manual, we're in the big leagues now πŸ‘‘)


✨ SYNOPSIS ✨

Okay so here's the whole squad, laid out exactly as the kernel gods wrote it:

struct typec_operations {
    int (*try_role)(struct typec_port *port, int role);
    int (*dr_set)(struct typec_port *port, enum typec_data_role role);
    int (*pr_set)(struct typec_port *port, enum typec_role role);
    int (*vconn_set)(struct typec_port *port, enum typec_role role);
    int (*port_type_set)(struct typec_port *port, enum typec_port_type
type);
    struct usb_power_delivery **(*pd_get)(struct typec_port *port);
    int (*pd_set)(struct typec_port *port, struct usb_power_delivery
*pd);
    int (*default_usb_mode_set)(struct typec_port *port, enum usb_mode
mode);
    int (*enter_usb_mode)(struct typec_port *port, enum usb_mode mode);
 };

🫢 Members 🫢

Let me introduce you to every single one of these function pointers, no skips, no cap:

  • try_role β€” sets the data role preference for a DRP port. It's giving "what do you wanna be when you grow up" energy πŸ’…
  • dr_set β€” Set Data Role. Literally just tells the port which data role it's on.
  • pr_set β€” Set Power Role. Same vibe, but for power. ⚑
  • vconn_set β€” Source VCONN. Yeah, it's the VCONN sourcing hook.
  • port_type_set β€” Set port type. Slay, define yourself. πŸ¦‹
  • pd_get β€” Get available USB Power Delivery Capabilities. It returns a struct usb_power_delivery **, iconic pointer-to-pointer behaviour fr fr.
  • pd_set β€” Set USB Power Delivery Capabilities. Takes a struct usb_power_delivery *pd and just... sets it. Obsessed with the simplicity. πŸŽ€
  • default_usb_mode_set β€” USB Mode to be used by default with Enter_USB Message. The main character default vibe. 🌟
  • enter_usb_mode β€” Change the active USB Mode. Not the default, the active one β€” important distinction bestie. πŸ”₯

🌈 SEE ALSO 🌈

  • Kernel file ./include/linux/usb/typec.h
  • struct typec_connector(9)

And that's the page, bestie! πŸ’œ Source lives at ./include/linux/usb, dated October 2026, and the whole thing is titled struct typec_operations(9). Go forth and Type-C responsibly 🧚✨

πŸ“¦ where this page comes from