STRUCT TYPEC_ALTMODE(9)
β¨ 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 intbitfield, width1. it's giving yes/no energy.priorityβ the priority used by the automatic alternate mode selection process.u8, so keep it smol πmode_selectionβ aboolthat 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:
typec_altmode_ops(9)struct typec_cable_ops(9)typec_altmode_get_cable_svdm_version(9)typec_altmode_get_orientation(9)typec_altmode_get_svdm_version(9)typec_altmode_get_data_role(9)struct typec_altmode_driver(9)typec_altmode_register_driver(9)typec_altmode_unregister_driver(9)typec_mode_selection_start(9)typec_altmode_state_update(9)typec_mode_selection_delete(9)
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
- 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