usb_gstrings_attach(9)
β¨ usb_gstrings_attach(9) β¨
okay so welcome to the Kernel API Manual, bestie π this is the page for usb_gstrings_attach, and it's all about attaching gadget strings to a cdev and assigning ids. no cap, it's a real one.
πΈ NAME πΈ
usb_gstrings_attach β attach gadget strings to a cdev and assign ids
π SYNOPSIS π
struct usb_string * usb_gstrings_attach (struct usb_composite_dev *cdev
, struct usb_gadget_strings **sp , unsigned n_strings );
π ARGUMENTS π
cdevβ the device whose string descriptor IDs are being allocated and attached.spβ an array ofusb_gadget_stringsto attach.n_stringsβ number of entries in eachusb_stringsarray (sp[]->strings)
π¦ DESCRIPTION π¦
okay so what this function does is create a deep copy of usb_gadget_strings and usb_string, and attach it to the cdev. The actual string (usb_string.s) will not be copied β only a reference will be made to it. So like, the string data stays where it is, bestie.
The struct usb_gadget_strings array may contain multiple languages and should be NULL terminated. The ->language pointer of each struct usb_gadget_strings has to contain the same amount of entries. For instance: sp[0] is en-US, sp[1] is es-ES. It is expected that the first usb_string entry of es-ES contains the translation of the first usb_string entry of en-US. Therefore both entries become the same id assign.
π₯ SEE ALSO π₯
Kernel file: ./drivers/usb/gadget/composite.c β that's the spot, iykyk π
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_id(9)usb_string_ids_tab(9)usb_string_ids_n(9)usb_composite_probe(9)usb_composite_unregister(9)usb_composite_setup_continue(9)
okay that's the whole page, bestie π source: ./drivers/usb/gadget; version/manual: Kernel API Manual; date: October 2026; page: usb_gstrings_attach(9). 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