summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/usb_get_status.9f
blob: 0d5d18231d6b6815e88e3fb8822d908a0db13023 (plain)
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
'\" 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_status 9F "5 Jan 2004" "SunOS 5.11" "Kernel Functions for Drivers"
.SH NAME
usb_get_status \- Get status of a USB device/endpoint/interface
.SH SYNOPSIS
.LP
.nf
#include <sys/usb/usba.h>



\fBint\fR \fBusb_get_status\fR(\fBdev_info_t *\fR\fIdip\fR, \fBusb_pipe_handle_t\fR \fIpipe_handle\fR,
     \fBuint_t\fR \fIrequest_type\fR, \fBuint_t\fR \fIwhich\fR, \fBuint16_t *\fR\fIstatus\fR, 
     \fBusb_flags_t\fR \fIflags\fR);
.fi

.SH INTERFACE LEVEL
.sp
.LP
Solaris DDI specific (Solaris DDI)
.SH PARAMETERS
.sp
.ne 2
.mk
.na
\fB\fIdip\fR\fR
.ad
.RS 16n
.rt  
Pointer to device's dev_info structure.
.RE

.sp
.ne 2
.mk
.na
\fB\fIpipe_handle\fR\fR
.ad
.RS 16n
.rt  
Default control pipe handle on which request is made.
.RE

.sp
.ne 2
.mk
.na
\fB\fIrequest_type\fR\fR
.ad
.RS 16n
.rt  
bmRequestType. Either:
.sp
USB_DEV_REQ_RCPT_DEV \(em Get device status.
.sp
USB_DEV_REQ_RCPT_IF \(em Get interface status.
.sp
USB_DEV_REQ_RCPT_EP \(em Get endpoint status.
.RE

.sp
.ne 2
.mk
.na
\fB\fIwhich\fR\fR
.ad
.RS 16n
.rt  
Device, interface or endpoint from which to get status.  Either  number of
interface or endpoint, or  0 if device status requested.
.RE

.sp
.ne 2
.mk
.na
\fB\fIstatus\fR\fR
.ad
.RS 16n
.rt  
Address into which the status is written.
.RE

.sp
.ne 2
.mk
.na
\fB\fIflags\fR\fR
.ad
.RS 16n
.rt  
None are recognized.
.RE

.SH DESCRIPTION
.sp
.LP
The \fBusb_get_status()\fR function returns the status of a device, interface
or endpoint.  All status requests use the default control pipe. Length of data
returned is USB_GET_STATUS_LEN bytes.  Always block and wait for resources if
not available, regardless of the flags argument.
.sp
.LP
When the \fIrequest_type\fR recipient is USB_DEV_REQ_RCPT_DEV, device status is
requested. Status returned includes bits for USB_DEV_SLF_PWRD_STATUS (device is
currently  self-powered) and USB_DEV_RWAKEUP_STATUS (device has remote  wakeup
enabled). A set bit indicates the corresponding status.
.sp
.LP
When the \fIrequest_type\fR is USB_DEV_REQ_RCPT_EP, endpoint status is
requested. Status returned includes bits for USB_EP_HALT_STATUS (endpoint is
halted). A set bit indicates the corresponding status.
.sp
.LP
When the \fIrequest_type\fR is USB_DEV_REQ_RCPT_IF, interface status is
requested and USB_IF_STATUS (zero) is returned.
.SH RETURN VALUES
.sp
.ne 2
.mk
.na
\fBUSB_SUCCESS\fR
.ad
.RS 20n
.rt  
Status returned successfully in the status argument.
.RE

.sp
.ne 2
.mk
.na
\fBUSB_INVALID_ARGS\fR
.ad
.RS 20n
.rt  
Status pointer and/or dip argument is NULL.
.RE

.sp
.ne 2
.mk
.na
\fBUSB_INVALID_PIPE\fR
.ad
.RS 20n
.rt  
Pipe handle is NULL.
.RE

.sp
.ne 2
.mk
.na
\fBUSB_FAILURE\fR
.ad
.RS 20n
.rt  
Status not returned successfully.
.RE

.SH CONTEXT
.sp
.LP
May be called from user or kernel context.
.SH EXAMPLES
.sp
.in +2
.nf
  uint16_t status;

  if (usb_get_status(
      dip, pipe_handle, USB_DEV_REQ_RCPT_DEV, 0 &status, 0) ==
      USB_SUCCESS) {
          if (status & USB_DEV_SLF_PWRD_STATUS) {
                  cmn_err (CE_WARN,
                      "%s%d: USB device is running on its own power.",
                      ddi_driver_name(dip), ddi_get_instance(dip));
          }
  }
.fi
.in -2

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
ArchitecturePCI-based systems
_
Interface stabilityCommitted
.TE

.SH SEE ALSO
.sp
.LP
\fBattributes\fR(5), \fBusb_clr_feature\fR(9F), \fBusb_get_alt_if\fR(9F),
\fBusb_pipe_get_state\fR(9F), \fBusb_get_cfg\fR(9F),