1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
'\" 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 <sys/usb/usba.h>
\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)
|