usb_role_switch_get_role(9)
π usb_role_switch_get_role(9)
okay bestie, welcome to the Kernel API Manual, and buckle up because we're talking about usb_role_switch_get_role β literally the "hey, what role is this thing playing rn?" function. π
β¨ NAME β¨
usb_role_switch_get_role β bestie, it gets the USB role for a switch. that's the whole vibe. π
πΈ SYNOPSIS πΈ
enum usb_role usb_role_switch_get_role (struct usb_role_switch *sw );
π¦ ARGUMENTS π¦
swβ the USB role switch in question. the main character of this whole operation. π
π DESCRIPTION π
so here's the tea, and it lowkey depends on the role-switch-driver. this function is giving you one of two things:
- a cached value of the last role that was set π«Ά
- or it actually reads back the actual value from the hardware π₯
which one you get? that's the driver's call, not ours. no cap. β¨
π§ SEE ALSO π§
- Kernel file
./drivers/usb/roles/class.c usb_role_switch_set_role(9)usb_role_switch_get(9)fwnode_usb_role_switch_get(9)usb_role_switch_put(9)usb_role_switch_find_by_fwnode(9)usb_role_switch_register(9)usb_role_switch_unregister(9)usb_role_switch_set_drvdata(9)usb_role_switch_get_drvdata(9)
like, go read them, they're all iconic in their own way. π
and that's the whole page, bestie! this one lives in ./drivers/usb/roles, dropped way back in October 2026, and it's part of the Kernel API Manual β so go forth and role-switch responsibly. πβπ
π¦ 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