summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/usb_pipe_get_state.9f
blob: db72d0a142fcae0d1cffc01c2950d7fab7af190b (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
'\" 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_PIPE_GET_STATE 9F "Sep 16, 2016"
.SH NAME
usb_pipe_get_state \- Return USB pipe state
.SH SYNOPSIS
.nf
#include <sys/usb/usba.h>



\fBint\fR \fBusb_pipe_get_state\fR(\fBusb_pipe_handle_t\fR \fIpipe_handle\fR,
     \fBusb_pipe_state_t *\fR\fIpipe_state\fR, \fBusb_flags_t\fR \fIusb_flags\fR);
.fi

.SH INTERFACE LEVEL
illumos DDI specific (illumos DDI)
.SH PARAMETERS
.ne 2
.na
\fB\fIpipe_handle\fR\fR
.ad
.RS 15n
Handle of the pipe to retrieve the state.
.RE

.sp
.ne 2
.na
\fB\fIpipe_state\fR\fR
.ad
.RS 15n
Pointer to where pipe state is returned.
.RE

.sp
.ne 2
.na
\fB\fIusb_flags\fR\fR
.ad
.RS 15n
No flags are recognized. Reserved for future expansion.
.RE

.SH DESCRIPTION
The \fBusb_pipe_get_state()\fR function retrieves the state of the pipe
referred to by \fIpipe_handle\fR into the location pointed to by
\fIpipe_state\fR.
.sp
.LP
Possible pipe states are:
.sp
.ne 2
.na
\fBUSB_PIPE_STATE_CLOSED\fR
.ad
.RS 26n
Pipe is closed.
.RE

.sp
.ne 2
.na
\fBUSB_PIPE_STATE_ACTIVE\fR
.ad
.RS 26n
Pipe is active and can send/receive data. Polling is active for isochronous and
interrupt pipes.
.RE

.sp
.ne 2
.na
\fBUSB_PIPE_STATE_IDLE\fR
.ad
.RS 26n
Polling is stopped for isochronous and interrupt-IN pipes.
.RE

.sp
.ne 2
.na
\fBUSB_PIPE_STATE_ERROR\fR
.ad
.RS 26n
An error occurred. Client must call \fBusb_pipe_reset()\fR. Note that this
status is not seen by a client driver if USB_ATTRS_AUTOCLEARING is set in the
request attributes.
.RE

.sp
.ne 2
.na
\fBUSB_PIPE_STATE_CLOSING\fR
.ad
.RS 26n
Pipe is being closed. Requests are being drained from the pipe and other
cleanup is in progress.
.RE

.SH RETURN VALUES
.ne 2
.na
\fBUSB_SUCCESS\fR
.ad
.RS 20n
Pipe state returned in second argument.
.RE

.sp
.ne 2
.na
\fBUSB_INVALID_ARGS\fR
.ad
.RS 20n
Pipe_state argument is \fBNULL\fR.
.RE

.sp
.ne 2
.na
\fBUSB_INVALID_PIPE\fR
.ad
.RS 20n
Pipe_handle argument is \fBNULL\fR.
.RE

.SH CONTEXT
May be called from user, kernel or interrupt context.
.SH EXAMPLES
.in +2
.nf
    usb_pipe_handle_t pipe;
    usb_pipe_state_t state;

    /* Recover if the pipe is in an error state. */
    if ((usb_pipe_get_state(pipe, &state, 0) == USB_SUCCESS) &&
        (state == USB_PIPE_STATE_ERROR)) {
            cmn_err (CE_WARN, "%s%d: USB Pipe error.",
                ddi_driver_name(dip), ddi_get_instance(dip));
            do_recovery();
    }

.fi
.in -2

.SH ATTRIBUTES
See \fBattributes\fR(7) 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
.BR attributes (7),
.BR usb_clr_feature (9F),
.BR usb_get_cfg (9F),
.BR usb_get_status (9F),
.BR usb_pipe_close (9F),
.BR usb_pipe_ctrl_xfer (9F),
.BR usb_pipe_reset (9F),
.BR usb_pipe_xopen (9F)