cros_ec_usb_get_role(9)
π cros_ec_usb_get_role(9) β from the Kernel API Manual, bestie
okay so picture this: you're poking at the ChromeOS EC (that's the embedded controller, the little guy running the show on Chromebooks) and you want the tea on whatever USB-C PD device might be plugged into a port. This function? It gets you that tea. It's cros_ec_usb_get_role, and it's giving "tell me everything about the port" energy. β¨
β¨ SYNOPSIS β¨
int cros_ec_usb_get_role (struct cros_ec_extcon_info *info , bool
*polarity );
π ARGUMENTS π
infoβ a pointer tostruct cros_ec_extcon_info. That's your extcon info struct, your whole context, your main character. π«Άpolarityβ a pointer to cable polarity, and heads up bestie, this one is a return value β the function writes the polarity back out through it. π
π₯ RETURN π₯
- On success you get the role info back. slay. π
- If there's no cable connected, it's
-ENOTCONNβ literally nothing plugged in, sad little port, no vibe. π - Anything else
<0? That's a failure, ngl. Something went wrong.
π¦ SEE ALSO π¦
- Kernel file
./drivers/extcon/extcon-usbc-cros-ec.cβ go read the source, iykyk π cros_ec_pd_command(9)cros_ec_usb_get_power_type(9)cros_ec_usb_get_pd_mux_state(9)cros_ec_pd_get_num_ports(9)
and that's the whole page, periodt. π§ this lil gem lives in ./drivers/extcon and it's dated October 2026 β no cap, that's the version and the date, so jot it down bestie. πΈπ
π¦ 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