Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / usb_lookup_ep_data.9f
blob18f2317b9807342e3f8069938c6568f2d3260a30
1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc., All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH USB_LOOKUP_EP_DATA 9F "Sep 16, 2016"
7 .SH NAME
8 usb_lookup_ep_data \- Lookup endpoint information
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/usb/usba.h>
16 \fBusb_ep_data_t *\fR\fBusb_lookup_ep_data\fR(\fBdev_info_t *\fR\fIdip\fR,
17      \fBusb_client_dev_data_t *\fR\fIdev_datap\fR, \fBuint_t\fR \fIinterface\fR,
18      \fBuint_t\fR \fIalternate\fR, \fBuint_t\fR \fIskip\fR, \fBuint_t\fR \fItype\fR, \fBuint_t\fR \fIdirection\fR);
19 .fi
21 .SH INTERFACE LEVEL
22 .LP
23 Solaris DDI specific (Solaris DDI)
24 .SH PARAMETERS
25 .ne 2
26 .na
27 \fB\fIdip\fR\fR
28 .ad
29 .RS 13n
30 Pointer to the device's \fBdev_info\fR structure.
31 .RE
33 .sp
34 .ne 2
35 .na
36 \fB\fIdev_datap\fR\fR
37 .ad
38 .RS 13n
39 Pointer to a \fBusb_client_dev_data_t\fR structure containing tree.
40 .RE
42 .sp
43 .ne 2
44 .na
45 \fB\fIinterface\fR\fR
46 .ad
47 .RS 13n
48 Number of interface in which endpoint resides.
49 .RE
51 .sp
52 .ne 2
53 .na
54 \fB\fIalternate\fR\fR
55 .ad
56 .RS 13n
57 Number of interface alternate setting in which endpoint resides.
58 .RE
60 .sp
61 .ne 2
62 .na
63 \fB\fIskip\fR\fR
64 .ad
65 .RS 13n
66 Number of endpoints which match the requested type and direction to skip before
67 finding one to retrieve.
68 .RE
70 .sp
71 .ne 2
72 .na
73 \fB\fItype\fR\fR
74 .ad
75 .RS 13n
76 Type of endpoint. This is one of: USB_EP_ATTR_CONTROL, USB_EP_ATTR_ISOCH,
77 USB_EP_ATTR_BULK, or USB_EP_ATTR_INTR. Please see \fBusb_pipe_xopen\fR(9F) for
78 more information.
79 .RE
81 .sp
82 .ne 2
83 .na
84 \fB\fIdirection\fR\fR
85 .ad
86 .RS 13n
87 Direction of endpoint, either USB_EP_DIR_OUT or USB_EP_DIR_IN. This argument is
88 ignored for bi-directional control endpoints.
89 .RE
91 .SH DESCRIPTION
92 .LP
93 The \fBusb_lookup_ep_data()\fR function returns endpoint information from the
94 tree embedded in client data returned from \fBusb_get_dev_data\fR. It operates
95 on the current configuration (pointed to by the dev_curr_cfg field of the
96 \fBusb_client_dev_data_t\fR argument). It skips the first <skip> number of
97 endpoints it finds which match the specifications of the other arguments, and
98 then retrieves information on the next matching endpoint it finds. Note that it
99 does not make a copy of the data, but points to the tree itself.
100 .SH RETURN VALUES
102 On success: the tree node corresponding to the desired endpoint.
105 On failure: returns NULL. Fails if \fIdip\fR or \fIdev_datap\fR are NULL, if
106 the desired endpoint does not exist in the tree, or no tree is present in
107 dev_datap.
108 .SH CONTEXT
110 May be called from user, kernel or interrupt context.
111 .SH EXAMPLES
113 Retrieve the polling interval for the second interrupt endpoint at interface 0,
114 alt 3:
116 .in +2
118     uint8_t interval = 0;
119     usb_ep_data_t *ep_node = usb_lookup_ep_data(
120         dip, dev_datap, 0, 3, 1, USB_EP_ATTR_INTR, USB_EP_DIR_IN);
121     if (ep_node != NULL) {
122             interval = ep_node->ep_descr.bInterval;
123     }
125 .in -2
129 Retrieve the maximum packet size for the first control pipe at interface 0, alt
132 .in +2
134     uint16_t maxPacketSize = 0;
135     usb_ep_data_t *ep_node = usb_lookup_ep_data(
136         dip, dev_datap, 0, 4, 0, USB_EP_ATTR_CONTROL, 0);
137     if (ep_node != NULL) {
138             maxPacketSize = ep_node->ep_descr.wMaxPacketSize;
139     }
141 .in -2
143 .SH ATTRIBUTES
145 See \fBattributes\fR(5) for descriptions of the following attributes:
150 box;
151 c | c
152 l | l .
153 ATTRIBUTE TYPE  ATTRIBUTE VALUE
155 Architecture    PCI-based systems
157 Interface stability     Committed
160 .SH SEE ALSO
162 \fBattributes\fR(5), \fBusb_get_dev_data\fR(9F), \fBusb_pipe_open\fR(9F),
163 \fBusb_cfg_descr\fR(9S), \fBusb_if_descr\fR(9S), \fBusb_ep_descr\fR(9S)