typec_plug_set_num_altmodes(9)
π typec_plug_set_num_altmodes(9) β the Kernel API Manual glow-up π
okay so bestie, welcome to the typec_plug_set_num_altmodes page from the Kernel API Manual β¨ grab a boba, because we're about to tell the kernel how many alternate modes a plug has, and honestly? it's giving "small function, big responsibility" π
β¨ NAME β¨
typec_plug_set_num_altmodes β literally just sets the number of available plug altmodes π¦
πΈ SYNOPSIS πΈ
int typec_plug_set_num_altmodes (struct typec_plug *plug , int
num_altmodes );
bestie it returns an int, it takes a struct typec_plug * and an int, and it's exactly as iconic as it looks π
π«Ά ARGUMENTS π«Ά
plugβ the plug we're updating. the main character plug, if you will πnum_altmodesβ the number of altmodes we want to specify as available. yes, we choose the number. we hold the power π₯
π DESCRIPTION π
so this routine is what you use to report the number of alternate modes supported by the plug. lowkey important detail though: this value is *not* enforced in alternate mode registration routines. like, it's a report, not a bouncer at the club π read that asterisk-star emphasis again, because the original is doing the most to make sure you noticed.
plug.num_altmodes is set to -1 on plug registration, denoting that a valid value has not been set for it yet. so if you see a -1 sitting there, that's the "no thoughts, head empty, value not set yet" state π
Returns 0 on success or negative error number on failure. classic. slay when it's 0, sad girl hours when it's negative π
no cap: the -1 at plug registration is a denoting situation, meaning "not set yet" β it's not a real altmode count. don't be out here counting it as one π
π¦ SEE ALSO π¦
the whole friend group showed up for this one, so here's everybody β same names, same (9), no substitutions π
typec_altmode_update_active(9)typec_altmode2port(9)typec_altmode_set_ops(9)typec_unregister_altmode(9)typec_partner_set_usb_mode(9)typec_partner_set_identity(9)typec_partner_set_pd_revision(9)typec_partner_set_usb_power_delivery(9)typec_partner_set_num_altmodes(9)typec_partner_register_altmode(9)typec_partner_set_svdm_version(9)typec_partner_usb_power_delivery_register(9)typec_register_partner(9)typec_unregister_partner(9)typec_plug_register_altmode(9)typec_register_plug(9)typec_unregister_plug(9)typec_cable_get(9)typec_cable_put(9)typec_cable_is_active(9)typec_cable_altmode_unsupported(9)typec_cable_set_identity(9)typec_register_cable(9)typec_unregister_cable(9)typec_port_set_usb_mode(9)typec_port_set_usb_power_delivery(9)typec_set_data_role(9)typec_get_data_role(9)typec_set_pwr_role(9)typec_set_vconn_role(9)typec_set_pwr_opmode(9)typec_find_pwr_opmode(9)typec_find_orientation(9)typec_find_port_power_role(9)typec_find_power_role(9)typec_find_port_data_role(9)typec_set_orientation(9)typec_get_orientation(9)typec_set_mode(9)typec_get_negotiated_svdm_version(9)typec_get_cable_svdm_version(9)typec_cable_set_svdm_version(9)typec_get_drvdata(9)typec_port_register_altmode(9)typec_port_register_cable_ops(9)typec_register_port(9)typec_unregister_port(9)
also hanging out in the Kernel file ./drivers/usb/typec/class.c π§
π sign-off π
that's the whole page, bestie, and you ate it up π this little gem lives in ./drivers/usb/typec, dated October 2026, and it's giving "kernel docs but make it cute" πβ¨π go forth and set those altmode numbers, periodt π¦
π¦ 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