2 .\" Copyright (c) 2004, Sun Microsystems, Inc.,
3 .\" All Rights Reserved
4 .\" 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.
5 .\" 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.
6 .\" 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]
7 .TH USB_GET_STRING_DESCR 9F "Jan 5, 2004"
9 usb_get_string_descr \- Get string descriptor from device
13 #include <sys/usb/usba.h>
17 \fBint\fR \fBusb_get_string_descr\fR(\fBdev_info_t *\fR\fIdip\fR,
18 \fBuint16_t\fR \fIlangid\fR, \fBuint8_t\fR \fIindex\fR,
19 \fBchar *\fR\fIbuf\fR, \fBsize_t\fR \fIbuflen\fR);
25 Solaris DDI specific (Solaris DDI)
33 Pointer to the device's \fBdev_info\fR structure.
42 Language ID. Currently only USB_LANG_ID (English ascii) is valid.
51 String index indicating descriptor to retrieve.
60 Address into which the string descriptor is placed.
75 The \fBusb_get_string_descr()\fR function retrieves a parsed string descriptor
76 from a device. \fIdip\fR specifies the device, while \fIindex\fR indicates
77 which descriptor to return.
80 String descriptors provide information about other descriptors, or information
81 that is encoded in other descriptors, in readable form. Many descriptor types
82 have one or more index fields which identify string descriptors. (See
83 Sections \fI9.5\fR and \fI9.6\fR of the \fIUSB 2.0\fR specification.) For
84 example, a configuration descriptor's seventh byte contains the string
85 descriptor index describing a specific configuration.
88 Retrieved descriptors that do not fit into \fIbuflen\fR bytes are truncated.
89 All returned descriptors are null-terminated.
97 String descriptor is returned in \fIbuf\fR.
103 \fBUSB_INVALID_ARGS\fR
106 \fIdip\fR or \fIbuf\fR are \fBNULL\fR, or \fIindex\fR or \fIbuflen\fR is
116 Descriptor cannot be retrieved.
122 May be called from user or kernel context.
127 /* Get the first string descriptor. */
131 if (usb_get_string_descr(
132 dip, USB_LANG_ID, 0, buf, SIZE) == USB_SUCCESS) {
133 cmn_err (CE_NOTE, "%s%d: %s",
134 ddi_driver_name(dip), ddi_get_instance(dip), buf);
142 See \fBattributes\fR(5) for descriptions of the following attributes:
150 ATTRIBUTE TYPE ATTRIBUTE VALUE
152 Architecture PCI-based systems
154 Interface stability Committed
160 \fBattributes\fR(5), \fBusb_get_dev_data\fR(9F), \fBusb_string_descr\fR(9S)