USB host library, support isochronous,bulk,interrupt and control.

Dependents:   BaseUsbHost_example BaseJpegDecode_example SimpleJpegDecode_example

Import programBaseUsbHost_example

BaseUsbHost example program

Revision:
5:8a2d056e9b38
Parent:
4:d931d24c2f81
--- a/BaseUsbHostCtlEp.cpp	Fri Jan 25 14:51:33 2013 +0000
+++ b/BaseUsbHostCtlEp.cpp	Mon Feb 11 12:00:47 2013 +0000
@@ -1,4 +1,4 @@
-// BaseUsbHostCtlEp.cpp 2013/1/25
+// BaseUsbHostCtlEp.cpp 2013/2/11
 #include "mbed.h"
 #include "rtos.h"
 #include "BaseUsbHost.h"
@@ -87,6 +87,25 @@
     return rc;
 }
 
+string ControlEp::GetStringDescriptor(int index)
+{
+    string s = "";
+    uint8_t buf[128];
+    int r = GetDescriptor(USB_DESCRIPTOR_TYPE_STRING, index, buf, sizeof(buf));
+    if (r != USB_OK) {
+        return s;
+    }
+    DBG_HEX(buf, sizeof(buf));
+    StandardStringDescriptor* desc = reinterpret_cast<StandardStringDescriptor*>(buf);
+    if (desc->bLength <= 2 || desc->bDescriptorType != 3) {
+        return s;
+    }
+    for(int i = 0; i < desc->bLength-2; i += 2) {
+        s += desc->bString[i];
+    }
+    return s;
+}
+
 int ControlEp::open(int addr)
 {
     TEST_ASSERT(addr >= 1 && addr <= 127);
@@ -149,7 +168,6 @@
         return USB_ERROR;
     }
     r = wait_queue_HCTD(status_td, 100); // wait status stage
-    TEST_ASSERT(r == USB_OK);
     return r;
 }
 
@@ -185,7 +203,6 @@
     LPC_USB->HcControl |= OR_CONTROL_CLE;
     
     int r = wait_queue_HCTD(status_td, 200); // wait status stage
-    TEST_ASSERT(r == USB_OK);
     return r;
 }