'\" te .\" Copyright (c) 2004, Sun Microsystems, Inc., .\" All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH USB_GET_STRING_DESCR 9F "Jan 5, 2004" .SH NAME usb_get_string_descr \- Get string descriptor from device .SH SYNOPSIS .LP .nf #include \fBint\fR \fBusb_get_string_descr\fR(\fBdev_info_t *\fR\fIdip\fR, \fBuint16_t\fR \fIlangid\fR, \fBuint8_t\fR \fIindex\fR, \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIbuflen\fR); .fi .SH INTERFACE LEVEL .sp .LP Solaris DDI specific (Solaris DDI) .SH PARAMETERS .sp .ne 2 .na \fB\fIdip\fR\fR .ad .RS 10n Pointer to the device's \fBdev_info\fR structure. .RE .sp .ne 2 .na \fB\fIlangid\fR\fR .ad .RS 10n Language ID. Currently only USB_LANG_ID (English ascii) is valid. .RE .sp .ne 2 .na \fB\fIindex\fR\fR .ad .RS 10n String index indicating descriptor to retrieve. .RE .sp .ne 2 .na \fB\fIbuf\fR\fR .ad .RS 10n Address into which the string descriptor is placed. .RE .sp .ne 2 .na \fB\fIbuflen\fR\fR .ad .RS 10n Size of buf in bytes. .RE .SH DESCRIPTION .sp .LP The \fBusb_get_string_descr()\fR function retrieves a parsed string descriptor from a device. \fIdip\fR specifies the device, while \fIindex\fR indicates which descriptor to return. .sp .LP String descriptors provide information about other descriptors, or information that is encoded in other descriptors, in readable form. Many descriptor types have one or more index fields which identify string descriptors. (See Sections \fI9.5\fR and \fI9.6\fR of the \fIUSB 2.0\fR specification.) For example, a configuration descriptor's seventh byte contains the string descriptor index describing a specific configuration. .sp .LP Retrieved descriptors that do not fit into \fIbuflen\fR bytes are truncated. All returned descriptors are null-terminated. .SH RETURN VALUES .sp .ne 2 .na \fBUSB_SUCCESS\fR .ad .RS 20n String descriptor is returned in \fIbuf\fR. .RE .sp .ne 2 .na \fBUSB_INVALID_ARGS\fR .ad .RS 20n \fIdip\fR or \fIbuf\fR are \fBNULL\fR, or \fIindex\fR or \fIbuflen\fR is \fB0\fR. .RE .sp .ne 2 .na \fBUSB_FAILURE\fR .ad .RS 20n Descriptor cannot be retrieved. .RE .SH CONTEXT .sp .LP May be called from user or kernel context. .SH EXAMPLES .sp .in +2 .nf /* Get the first string descriptor. */ char buf[SIZE]; if (usb_get_string_descr( dip, USB_LANG_ID, 0, buf, SIZE) == USB_SUCCESS) { cmn_err (CE_NOTE, "%s%d: %s", ddi_driver_name(dip), ddi_get_instance(dip), buf); } .fi .in -2 .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Architecture PCI-based systems _ Interface stability Committed .TE .SH SEE ALSO .sp .LP \fBattributes\fR(5), \fBusb_get_dev_data\fR(9F), \fBusb_string_descr\fR(9S)