usb_string_id(9)
π usb_string_id(9) β Kernel API Manual, bestie edition β¨
Okay so like, welcome to the glow-up of usb_string_id(9) β this is the page for the little function that hands out unused string IDs like they're VIP wristbands at the function π
π¦ NAME
usb_string_id β allocate an unused string ID π
β¨ SYNOPSIS
int usb_string_id (struct usb_composite_dev *cdev );
π§ ARGUMENTS
cdevβ the device whose string descriptor IDs are the ones getting allocated, bestie. That's literally whose string-ID closet we're rummaging through π«Ά
πΈ CONTEXT
single threaded during gadget setup π
Translation: this is not the place for chaos. One thread only while gadget setup is happening, so no racing your friends to the same ID, mmkay?
π DESCRIPTION
So usb_string_id gets called from bind callbacks to allocate string IDs β that's its whole main character moment β¨ Drivers for functions, configurations, or gadgets will then store that ID in the appropriate descriptors and string table. Very demure, very mindful.
And here's the rule that keeps the whole friend group from falling apart π«Ά: all string identifier should be allocated using this, usb_string_ids_tab or usb_string_ids_n routine, to ensure that for example different functions don't wrongly assign different meanings to the same identifier. Like no cap, if everybody just grabbed IDs however they wanted, two functions would end up with the same number meaning two completely different things and it would be a whole mess π Don't do that.
π SEE ALSO
- Kernel file
./drivers/usb/gadget/composite.c struct usb_os_string(9)function_descriptors(9)next_desc(9)config_ep_by_speed_and_alt(9)config_ep_by_speed(9)usb_add_function(9)usb_function_deactivate(9)usb_function_activate(9)usb_interface_id(9)usb_func_wakeup(9)bos_desc(9)usb_add_config(9)usb_string_ids_tab(9)usb_gstrings_attach(9)usb_string_ids_n(9)usb_composite_probe(9)usb_composite_unregister(9)usb_composite_setup_continue(9)
That's the whole page, bestie β you ate it up π
Sending you off with love from ./drivers/usb/gadget, dated October 2026, living inside the Kernel API Manual πβ Go allocate those IDs responsibly, ily π
π¦ 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