STRUCT TYPEC_ALTMODE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

struct typec_altmode β€” the USB Type-C alternate mode device, bestie πŸ’…

So real quick, this page is from the Kernel API Manual (yes, the kernel has lore too, iykyk) and it's all about the struct that represents an alt mode device on USB Type-C. Obsessed honestly.


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so here's the whole shape of it, no cap, copy this exactly:

struct typec_altmode {
    struct device                   dev;
    u16 svid;
    int mode;
    u32 vdo;
    unsigned int                    active:1;
    u8 priority;
    bool mode_selection;
    char *desc;
    const struct typec_altmode_ops  *ops;
    const struct typec_cable_ops    *cable_ops;
 };

πŸŽ€ Members πŸŽ€

every single field, let's go, one by one, no skipping 🫢

  • dev β€” the driver model's whole view of this device. like, this is how the driver sees it, periodt.
  • svid β€” the Standard or Vendor ID (SVID) of the alternate mode. yes, it's literally called SVID, slay.
  • mode β€” the index of the Mode. just the index bestie, that's it.
  • vdo β€” the VDO that the Discover Modes USB PD command returns. that's where it comes from, don't @ me.
  • active β€” tells you whether the mode has been entered or not. unsigned int bitfield, width 1. it's giving yes/no energy.
  • priority β€” the priority used by the automatic alternate mode selection process. u8, so keep it smol πŸ’œ
  • mode_selection β€” a bool that says whether entry to this alternate mode is managed by the automatic alternate mode selection process, or by the specific driver. two paths, one flag, iconic.
  • desc β€” an optional human readable description of the mode. optional!! so don't stress if it's not there πŸ™ˆ
  • ops β€” the operations vector from the driver. const struct typec_altmode_ops *.
  • cable_ops β€” the cable operations vector from the driver. const struct typec_cable_ops *. (note the period in the original, keeping the vibe fr fr)

🌈 SEE ALSO 🌈

go read these next, bestie, they're all in Kernel file ./include/linux/usb/typec_altmode.h struct and honestly they ate:


lowkey a whole ecosystem of cross-references. hydrate, read the docs, and don't forget the header file lives at ./include/linux/usb 🧚

and that's the page!! this lil writeup is dated October 2026, sourced from ./include/linux/usb, and it's literally struct typec_altmode(9) β€” main character energy, no notes πŸ’–βœ¨

πŸ“¦ where this page comes from