'\" t .\" Title: usb_string .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: USB Core APIs .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "USB_STRING" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "USB Core APIs" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" usb_string \- returns UTF\-8 version of a string descriptor .SH "SYNOPSIS" .HP \w'int\ usb_string('u .BI "int usb_string(struct\ usb_device\ *\ " "dev" ", int\ " "index" ", char\ *\ " "buf" ", size_t\ " "size" ");" .SH "ARGUMENTS" .PP \fIdev\fR .RS 4 the device whose string descriptor is being retrieved .RE .PP \fIindex\fR .RS 4 the number of the descriptor .RE .PP \fIbuf\fR .RS 4 where to put the string .RE .PP \fIsize\fR .RS 4 how big is \(lqbuf\(rq? .RE .SH "CONTEXT" .PP !in_interrupt () .SH "DESCRIPTION" .PP This converts the UTF\-16LE encoded strings returned by devices, from \fBusb_get_string_descriptor\fR, to null\-terminated UTF\-8 encoded ones that are more usable in most kernel contexts\&. Note that this function chooses strings in the first language supported by the device\&. .PP This call is synchronous, and may not be used in an interrupt context\&. .SH "RETURN" .PP length of the string (>= 0) or usb_control_msg status (< 0)\&. .SH "COPYRIGHT" .br