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
Revision 26:53970cabf56d, committed 2015-06-26
- Comitter:
- fritz291
- Date:
- Fri Jun 26 19:30:55 2015 +0000
- Parent:
- 25:36cbb55f5627
- Commit message:
- Fixed small error in testAT function
Changed in this revision
--- 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]); + } }
--- a/USBHostSocketModem/USBHostSocketModem.h Fri Jun 26 16:55:15 2015 +0000 +++ b/USBHostSocketModem/USBHostSocketModem.h Fri Jun 26 19:30:55 2015 +0000 @@ -27,17 +27,17 @@ class USBHostSocketModem : public IUSBEnumerator { public: /** - * Constructor - * - * @param rootdir mount name - */ + * Constructor + * + * @param rootdir mount name + */ USBHostSocketModem(); /** - * Check if a MSD device is connected - * - * @return true if a MSD device is connected - */ + * Check if a MSD device is connected + * + * @return true if a MSD device is connected + */ bool connected(); /** @@ -49,6 +49,7 @@ /** * Send AT command test function. + * * Sends the "AT" command which responds with "OK" if sim card is present else "ERROR". */ void testAT();