USB Host WAN Dongle library

Fork of USBHostWANDongle_bleedingedge by Donatien Garnier

Revision:
2:a8b2d0cd9bbd
Parent:
0:ae46a0638b2c
Child:
9:c9e9817c398c
--- a/USBHost/USBDeviceConnected.cpp	Fri May 25 09:31:41 2012 +0000
+++ b/USBHost/USBDeviceConnected.cpp	Tue Jun 26 13:43:54 2012 +0000
@@ -95,13 +95,20 @@
 
 
 
-Endpoint * USBDeviceConnected::getEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) {
+Endpoint * USBDeviceConnected::getEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint8_t index) {
     if (intf_nb >= MAX_INTF) {
         return NULL;
     }
     for (int i = 0; i < MAX_ENDPOINT_PER_INTERFACE; i++) {
         if ((intf[intf_nb].ep[i]->getType() == type) && (intf[intf_nb].ep[i]->getDir() == dir)) {
-            return intf[intf_nb].ep[i];
+            if(index)
+            {
+              index--;
+            }
+            else
+            {
+              return intf[intf_nb].ep[i];
+            }
         }
     }
     return NULL;