1USB_GADGET_GET_STRIN(9) Kernel Mode Gadget API USB_GADGET_GET_STRIN(9)
2
3
4
6 usb_gadget_get_string - fill out a string descriptor
7
9 int usb_gadget_get_string(struct usb_gadget_strings * table, int id,
10 u8 * buf);
11
13 table
14 of c strings encoded using UTF-8
15
16 id
17 string id, from low byte of wValue in get string descriptor
18
19 buf
20 at least 256 bytes, must be 16-bit aligned
21
23 Finds the UTF-8 string matching the ID, and converts it into a string
24 descriptor in utf16-le. Returns length of descriptor (always even) or
25 negative errno
26
27 If your driver needs stings in multiple languages, you'll probably
28 “switch (wIndex) { ... }” in your ep0 string descriptor logic, using
29 this routine after choosing which set of UTF-8 strings to use. Note
30 that US-ASCII is a strict subset of UTF-8; any string bytes with the
31 eighth bit set will be multibyte UTF-8 characters, not ISO-8859/1
32 characters (which are also widely used in C strings).
33
35 David Brownell <dbrownell@users.sourceforge.net>
36 Author.
37
39Kernel Hackers Manual 3.10 June 2019 USB_GADGET_GET_STRIN(9)