1USB_STRING(9) USB Core APIs USB_STRING(9)
2
3
4
6 usb_string - returns UTF-8 version of a string descriptor
7
9 int usb_string(struct usb_device * dev, int index, char * buf,
10 size_t size);
11
13 dev
14 the device whose string descriptor is being retrieved
15
16 index
17 the number of the descriptor
18
19 buf
20 where to put the string
21
22 size
23 how big is “buf”?
24
26 !in_interrupt ()
27
29 This converts the UTF-16LE encoded strings returned by devices, from
30 usb_get_string_descriptor, to null-terminated UTF-8 encoded ones that
31 are more usable in most kernel contexts. Note that this function
32 chooses strings in the first language supported by the device.
33
34 This call is synchronous, and may not be used in an interrupt context.
35
36 Returns length of the string (>= 0) or usb_control_msg status (< 0).
37
39Kernel Hackers Manual 2.6. June 2019 USB_STRING(9)