typec_register_cable(9)
π typec_register_cable β Kernel API Manual β¨
okay bestie, so we're deep in the USB Type-C kernel code today and this one is literally the "hey kernel, meet this cable" function. it's in the Kernel API Manual, so grab a lil snack and let's go π
πΈ NAME πΈ
typec_register_cable β Register a USB Type-C Cable π
so like. it registers a cable. a USB Type-C one. that's the vibe π
β¨ SYNOPSIS β¨
struct typec_cable * typec_register_cable (struct typec_port *port ,
struct typec_cable_desc *desc );
that's the signature, copy it exactly, no cap. it hands you back a struct typec_cable * π«Ά
π¦ ARGUMENTS π¦
portβ the USB Type-C Port the cable is connected to π like, which port is this cable plugged into, babesdescβ the Description of the cable π all the deets about the cable go in here
π DESCRIPTION π
Registers a device for the USB Type-C Cable described in desc. π«
The cable will be parent for the optional cable plug devises. (yes, that's "devises" β that's what the original says, we do not touch it, we respect the source code's spelling journey π)
Returns handle to the cable on success or ERR_PTR on failure. π so check that pointer, bestie, ERR_PTR is not your friend.
lowkey important: if it fails you getERR_PTR, notNULL. do not go dereferencing that. that's giving main character energy in the worst way π
π SEE ALSO π
Kernel file ./drivers/usb/typec/class.c β the whole squad lives here π§
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_set_num_altmodes(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_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)
and that's the whole page, no skips, every single reference accounted for π
sign-off szn: this gem lives under ./drivers/usb/typec in the kernel tree, dated October 2026 β that's the source/version and date, mentioned cutely as requested, mwah π slay, go register some cables, 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