'\" 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_LOOKUP_EP_DATA 9F "Jan 5, 2004"
.SH NAME
usb_lookup_ep_data \- Lookup endpoint information
.SH SYNOPSIS
.LP
.nf
#include <sys/usb/usba.h>



\fBusb_ep_data_t *\fR\fBusb_lookup_ep_data\fR(\fBdev_info_t *\fR\fIdip\fR,
     \fBusb_client_dev_data_t *\fR\fIdev_datap\fR, \fBuint_t\fR \fIinterface\fR,
     \fBuint_t\fR \fIalternate\fR, \fBuint_t\fR \fIskip\fR, \fBuint_t\fR \fItype\fR, \fBuint_t\fR \fIdirection\fR);
.fi

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

.sp
.ne 2
.na
\fB\fIdev_datap\fR\fR
.ad
.RS 13n
Pointer to a \fBusb_client_dev_data_t\fR structure containing tree.
.RE

.sp
.ne 2
.na
\fB\fIinterface\fR\fR
.ad
.RS 13n
Number of interface in which endpoint resides.
.RE

.sp
.ne 2
.na
\fB\fIalternate\fR\fR
.ad
.RS 13n
Number of interface alternate setting in which endpoint resides.
.RE

.sp
.ne 2
.na
\fB\fIskip\fR\fR
.ad
.RS 13n
Number of endpoints which match the requested type and direction to skip before
finding one to retrieve.
.RE

.sp
.ne 2
.na
\fB\fItype\fR\fR
.ad
.RS 13n
Type of endpoint. This is one of: USB_EP_ATTR_CONTROL, USB_EP_ATTR_ISOCH,
USB_EP_ATTR_BULK, or USB_EP_ATTR_INTR. Please see \fBusb_pipe_open\fR(9F) for
more information.
.RE

.sp
.ne 2
.na
\fB\fIdirection\fR\fR
.ad
.RS 13n
Direction of endpoint, either USB_EP_DIR_OUT or USB_EP_DIR_IN. This argument is
ignored for bi-directional control endpoints.
.RE

.SH DESCRIPTION
.sp
.LP
The \fBusb_lookup_ep_data()\fR function returns endpoint information from the
tree embedded in client data returned from \fBusb_get_dev_data\fR. It operates
on the current configuration (pointed to by the dev_curr_cfg field of the
\fBusb_client_dev_data_t\fR argument). It skips the first <skip> number of
endpoints it finds which match the specifications of the other arguments, and
then retrieves information on the next matching endpoint it finds. Note that it
does not make a copy of the data, but points to the tree itself.
.SH RETURN VALUES
.sp
.LP
On success: the tree node corresponding to the desired endpoint.
.sp
.LP
On failure: returns NULL. Fails if \fIdip\fR or \fIdev_datap\fR are NULL, if
the desired endpoint does not exist in the tree, or no tree is present in
dev_datap.
.SH CONTEXT
.sp
.LP
May be called from user, kernel or interrupt context.
.SH EXAMPLES
.sp
.LP
Retrieve the polling interval for the second interrupt endpoint at interface 0,
alt 3:
.sp
.in +2
.nf
    uint8_t interval = 0;
    usb_ep_data_t *ep_node = usb_lookup_ep_data(
        dip, dev_datap, 0, 3, 1, USB_EP_ATTR_INTR, USB_EP_DIR_IN);
    if (ep_node != NULL) {
            interval = ep_node->ep_descr.bInterval;
    }
.fi
.in -2

.sp
.LP
Retrieve the maximum packet size for the first control pipe at interface 0, alt
4:
.sp
.in +2
.nf
    uint16_t maxPacketSize = 0;
    usb_ep_data_t *ep_node = usb_lookup_ep_data(
        dip, dev_datap, 0, 4, 0, USB_EP_ATTR_CONTROL, 0);
    if (ep_node != NULL) {
            maxPacketSize = ep_node->ep_descr.wMaxPacketSize;
    }
.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_pipe_open\fR(9F),
\fBusb_cfg_descr\fR(9S), \fBusb_if_descr\fR(9S), \fBusb_ep_descr\fR(9S)