summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_device.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-02-24 03:40:48 +0000
committerthompsa <thompsa@FreeBSD.org>2009-02-24 03:40:48 +0000
commit111921b05dd005836d9139fff6225cf38ae27b4f (patch)
tree2212ac65d27f78efda3d537ead58b121cf99deed /sys/dev/usb/usb_device.c
parentb169f302953adfc91c63bfb87e499600d6eaa180 (diff)
downloadFreeBSD-src-111921b05dd005836d9139fff6225cf38ae27b4f.zip
FreeBSD-src-111921b05dd005836d9139fff6225cf38ae27b4f.tar.gz
MFp4 //depot/projects/usb@157909
Changes to make implementing USB NDIS easier. Submitted by: Hans Petter Selasky
Diffstat (limited to 'sys/dev/usb/usb_device.c')
-rw-r--r--sys/dev/usb/usb_device.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index 439ad2b..61f63db 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -323,6 +323,40 @@ usb2_free_pipe_data(struct usb2_device *udev,
}
/*------------------------------------------------------------------------*
+ * usb2_pipe_foreach
+ *
+ * This function will iterate all the USB endpoints except the control
+ * endpoint. This function is NULL safe.
+ *
+ * Return values:
+ * NULL: End of USB pipes
+ * Else: Pointer to next USB pipe
+ *------------------------------------------------------------------------*/
+struct usb2_pipe *
+usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe)
+{
+ struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX;
+
+ /* be NULL safe */
+ if (udev == NULL)
+ return (NULL);
+
+ /* get next pipe */
+ if (pipe == NULL)
+ pipe = udev->pipes;
+ else
+ pipe++;
+
+ /* find next allocated pipe */
+ while (pipe != pipe_end) {
+ if (pipe->edesc != NULL)
+ return (pipe);
+ pipe++;
+ }
+ return (NULL);
+}
+
+/*------------------------------------------------------------------------*
* usb2_fill_iface_data
*
* This function will fill in interface data and allocate USB pipes
@@ -1430,7 +1464,7 @@ usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
* 0. If this value is different from "USB_MAX_IPACKET" a new
* USB control request will be setup!
*/
- err = usb2_req_get_desc(udev, &Giant, &udev->ddesc,
+ err = usb2_req_get_desc(udev, &Giant, NULL, &udev->ddesc,
USB_MAX_IPACKET, USB_MAX_IPACKET, 0, UDESC_DEVICE, 0, 0);
if (err) {
DPRINTFN(0, "getting device descriptor "
OpenPOWER on IntegriCloud