1usb_lookup_ep_data(9F) Kernel Functions for Drivers usb_lookup_ep_data(9F)
2
3
4
6 usb_lookup_ep_data - Lookup endpoint information
7
9 #include <sys/usb/usba.h>
10
11
12
13 usb_ep_data_t *usb_lookup_ep_data(dev_info_t *dip,
14 usb_client_dev_data_t *dev_datap, uint_t interface,
15 uint_t alternate, uint_t skip, uint_t type, uint_t direction);
16
17
19 Solaris DDI specific (Solaris DDI)
20
22 dip Pointer to the device's dev_info structure.
23
24
25 dev_datap Pointer to a usb_client_dev_data_t structure containing
26 tree.
27
28
29 interface Number of interface in which endpoint resides.
30
31
32 alternate Number of interface alternate setting in which endpoint
33 resides.
34
35
36 skip Number of endpoints which match the requested type and
37 direction to skip before finding one to retrieve.
38
39
40 type Type of endpoint. This is one of: USB_EP_ATTR_CONTROL,
41 USB_EP_ATTR_ISOCH, USB_EP_ATTR_BULK, or USB_EP_ATTR_INTR.
42 Please see usb_pipe_open(9F) for more information.
43
44
45 direction Direction of endpoint, either USB_EP_DIR_OUT or
46 USB_EP_DIR_IN. This argument is ignored for bi-directional
47 control endpoints.
48
49
51 The usb_lookup_ep_data() function returns endpoint information from the
52 tree embedded in client data returned from usb_get_dev_data. It oper‐
53 ates on the current configuration (pointed to by the dev_curr_cfg field
54 of the usb_client_dev_data_t argument). It skips the first <skip> num‐
55 ber of endpoints it finds which match the specifications of the other
56 arguments, and then retrieves information on the next matching endpoint
57 it finds. Note that it does not make a copy of the data, but points to
58 the tree itself.
59
61 On success: the tree node corresponding to the desired endpoint.
62
63
64 On failure: returns NULL. Fails if dip or dev_datap are NULL, if the
65 desired endpoint does not exist in the tree, or no tree is present in
66 dev_datap.
67
69 May be called from user, kernel or interrupt context.
70
72 Retrieve the polling interval for the second interrupt endpoint at
73 interface 0, alt 3:
74
75 uint8_t interval = 0;
76 usb_ep_data_t *ep_node = usb_lookup_ep_data(
77 dip, dev_datap, 0, 3, 1, USB_EP_ATTR_INTR, USB_EP_DIR_IN);
78 if (ep_node != NULL) {
79 interval = ep_node->ep_descr.bInterval;
80 }
81
82
83
84 Retrieve the maximum packet size for the first control pipe at inter‐
85 face 0, alt 4:
86
87 uint16_t maxPacketSize = 0;
88 usb_ep_data_t *ep_node = usb_lookup_ep_data(
89 dip, dev_datap, 0, 4, 0, USB_EP_ATTR_CONTROL, 0);
90 if (ep_node != NULL) {
91 maxPacketSize = ep_node->ep_descr.wMaxPacketSize;
92 }
93
94
96 See attributes(5) for descriptions of the following attributes:
97
98
99
100
101 ┌─────────────────────────────┬─────────────────────────────┐
102 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
103 ├─────────────────────────────┼─────────────────────────────┤
104 │Architecture │PCI-based systems │
105 ├─────────────────────────────┼─────────────────────────────┤
106 │Interface stability │Committed │
107 ├─────────────────────────────┼─────────────────────────────┤
108 │Availability │SUNWusb │
109 └─────────────────────────────┴─────────────────────────────┘
110
112 attributes(5), usb_get_dev_data(9F), usb_pipe_open(9F),
113 usb_cfg_descr(9S), usb_if_descr(9S), usb_ep_descr(9S)
114
115
116
117SunOS 5.11 5 Jan 2004 usb_lookup_ep_data(9F)