'\" t .\" Title: usb_gadget_get_string .\" Author: .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Kernel Mode Gadget API .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "USB_GADGET_GET_STRIN" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Kernel Mode Gadget API" .\" ----------------------------------------------------------------- .\" * 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_gadget_get_string \- fill out a string descriptor .SH "SYNOPSIS" .HP \w'int\ usb_gadget_get_string('u .BI "int usb_gadget_get_string(struct\ usb_gadget_strings\ *\ " "table" ", int\ " "id" ", u8\ *\ " "buf" ");" .SH "ARGUMENTS" .PP \fItable\fR .RS 4 of c strings encoded using UTF\-8 .RE .PP \fIid\fR .RS 4 string id, from low byte of wValue in get string descriptor .RE .PP \fIbuf\fR .RS 4 at least 256 bytes, must be 16\-bit aligned .RE .SH "DESCRIPTION" .PP Finds the UTF\-8 string matching the ID, and converts it into a string descriptor in utf16\-le\&. Returns length of descriptor (always even) or negative errno .PP If your driver needs stings in multiple languages, you\*(Aqll probably \(lqswitch (wIndex) { \&.\&.\&. }\(rq in your ep0 string descriptor logic, using this routine after choosing which set of UTF\-8 strings to use\&. Note that US\-ASCII is a strict subset of UTF\-8; any string bytes with the eighth bit set will be multibyte UTF\-8 characters, not ISO\-8859/1 characters (which are also widely used in C strings)\&. .SH "AUTHOR" .PP \fBDavid Brownell\fR <\&dbrownell@users.sourceforge.net\&> .RS 4 Author. .RE .SH "COPYRIGHT" .br