tb_switch_next_cap(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… tb_switch_next_cap β€” the kernel API manual, but make it cute

okay so bestie, welcome to tb_switch_next_cap from the Kernel API Manual. this one is a tiny little function that walks a linked list of capabilities on a Thunderbolt switch, and honestly? she's short but she delivers. let's get into it ✨


✨ NAME ✨

tb_switch_next_cap β€” return the next capability in the linked list πŸ¦‹


🌸 SYNOPSIS 🌸

int tb_switch_next_cap (struct tb_switch *sw , unsigned int offset );

that's it. that's the whole signature. two arguments, one int coming back at you. no cap. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • sw β€” the switch we're finding the capability for. this is your main character right here πŸ‘‘
  • offset β€” the previous capability offset, and listen: pass 0 for the start. like, literally 0. that's your "beginning of the list" vibe 🌈

🧚 DESCRIPTION 🧚

so what she does is find the dword offset of the next capability in the port config space capability list. yep β€” the next one in the chain, the linked-list energy is real πŸ”₯

and here's the cute part: when you pass 0 in the offset parameter, the first entry will be returned, if it exists. so 0 is basically the "take me to the top of the list" button 🫢


⭐ RETURN ⭐

  • Double word offset of the first or next capability β€” on success πŸ’–
  • 0 β€” if no next capability is found. she looked, bestie, and there was nothing there 😭
  • Negative errno β€” another error occurred. not the vibe, but she's telling you anyway πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

all her besties, all in the same friend group, all worth a read πŸ“šβœ¨


okay that's the whole page, no gatekeeping πŸ’œ this icon lives in ./drivers/thunderbolt, she's dated October 2026, and the header/footer energy is pure Kernel API Manual + tb_switch_next_cap(9). go forth and walk that capability list, periodt πŸ’…πŸŽ€

πŸ“¦ where this page comes from