USB Host Driver with Socket Modem support. Works with revision 323 of mbed-src but broken with any later version.

Dependencies:   FATFileSystem

Fork of F401RE-USBHost by Norimasa Okamoto

Revision:
26:53970cabf56d
Parent:
25:36cbb55f5627
--- a/USBHostSocketModem/USBHostSocketModem.cpp	Fri Jun 26 16:55:15 2015 +0000
+++ b/USBHostSocketModem/USBHostSocketModem.cpp	Fri Jun 26 19:30:55 2015 +0000
@@ -109,11 +109,12 @@
 
 /*virtual*/ bool USBHostSocketModem::parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) //Must return true if the interface should be parsed
 {
-    printf("Parsing Interface\n");
+    //Debug print statements
+    //printf("Parsing Interface\n");
     //printf("class = %i\n",intf_class);
     //printf("subclass = %i\n",intf_subclass);
     //printf("msd_intf = %i\n",msd_intf);
-    printf("intf_class = %i\n",intf_class);
+    //printf("intf_class = %i\n",intf_class);
     if ((sm_intf == -1) && (intf_class == CDCCONTROL))
     {
         sm_intf = intf_nb;
@@ -133,14 +134,14 @@
 
 /*virtual*/ bool USBHostSocketModem::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) //Must return true if the endpoint will be used
 {
-    printf("Setting up Endpoint\n");
+    //printf("Setting up Endpoint\n");
     if ((intf_nb == int_intf) || (intf_nb == bulk_intf)){
         /*if (type == INTERRUPT_ENDPOINT)*/
         if ((type == BULK_ENDPOINT) || (type == INTERRUPT_ENDPOINT)){
-            printf("type == %s\n", type);
+            //printf("type == %s\n", type);
             nb_ep++;
             if (nb_ep == 2)
-                printf("nb_ep == 2\n");
+                //printf("nb_ep == 2\n");
                 sm_device_found = true;
             return true;
         }
@@ -156,14 +157,16 @@
 
 void USBHostSocketModem::testAT()
 {
-    uint8_t buf[] = "at\r";
+    uint8_t buf[] = "AT\r";
     uint8_t result[64] = {0};
-    int rc,rt;
+    int rc,rt,i;
     rc = host->bulkWrite(dev, bulk_out, buf, sizeof(buf));
     printf("rc = %i\n", rc);
     rt = host->bulkRead(dev, bulk_in, result, sizeof(result));
     printf("rt = %i\n", rt);
-    printf("%s\n", result);
+    for (i = 0;i<sizeof(result);i++){
+        printf("result %i = %i\n", i, result[i]);
+    }
 }