Current File : //usr/share/man/man9f/usb_lookup_ep_data.9f
'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc., All Rights Reserved
.TH usb_lookup_ep_data 9F "5 Jan 2004" "SunOS 5.11" "Kernel Functions for Drivers"
.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
.mk
.na
\fB\fIdip\fR\fR
.ad
.RS 13n
.rt  
Pointer to the device's \fBdev_info\fR structure.
.RE

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

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

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

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

.sp
.ne 2
.mk
.na
\fB\fItype\fR\fR
.ad
.RS 13n
.rt  
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
.mk
.na
\fB\fIdirection\fR\fR
.ad
.RS 13n
.rt  
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
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
ArchitecturePCI-based systems
_
Interface StabilityCommitted
_
Availabilitysystem/io/usb
.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)