USB Host WAN Dongle library

Fork of USBHostWANDongle_bleedingedge by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Thu Aug 30 14:13:24 2012 +0000
Parent:
10:08bce4cd973a
Child:
13:c154e7f2e42f
Commit message:
Added error checks in initialization code

Changed in this revision

USB3GModule/WANDongle.cpp Show annotated file Show diff for this revision Revisions of this file
USBHost/USBHost.cpp Show annotated file Show diff for this revision Revisions of this file
USBHost/USBHost.h Show annotated file Show diff for this revision Revisions of this file
--- a/USB3GModule/WANDongle.cpp	Thu Aug 30 09:15:55 2012 +0000
+++ b/USB3GModule/WANDongle.cpp	Thu Aug 30 14:13:24 2012 +0000
@@ -60,10 +60,20 @@
           m_pInitializer = NULL; //Will be set in setVidPid callback
       
           DBG("Found one device reset it");
-          host->resetDevice(dev);
+          int ret = host->resetDevice(dev);
+          if(ret)
+          {
+            host->unlock();
+            return false;
+          }
 
           DBG("Enumerate");
-          host->enumerate(dev, this);
+          ret = host->enumerate(dev, this);
+          if(ret)
+          {
+            host->unlock();
+            return false;
+          }
           
           DBG("Device has VID:%04x PID:%04x", dev->getVid(), dev->getPid());
                    
--- a/USBHost/USBHost.cpp	Thu Aug 30 09:15:55 2012 +0000
+++ b/USBHost/USBHost.cpp	Thu Aug 30 14:13:24 2012 +0000
@@ -316,12 +316,14 @@
 }
 
 
-void USBHost::resetDevice(USBDeviceConnected * dev)  {
+USB_TYPE USBHost::resetDevice(USBDeviceConnected * dev)  {
   int index = findDevice(dev);
   if ((index != -1) && (!deviceReset[index])) {
     resetPort(dev->getHub(), dev->getPort());
     deviceReset[index] = true;
+    return USB_TYPE_OK;
   }
+  return USB_TYPE_NOTFOUND;
 }
 
 // link the USBEndpoint to the linked list and attach an USBEndpoint to a device
@@ -956,4 +958,3 @@
   *((uint32_t*)&setupPacket[6]) = (uint32_t) len;
 }
 
-
--- a/USBHost/USBHost.h	Thu Aug 30 09:15:55 2012 +0000
+++ b/USBHost/USBHost.h	Thu Aug 30 14:13:24 2012 +0000
@@ -150,7 +150,7 @@
     *
     * @param pointer on the device hich will be reseted
     */
-    void resetDevice(USBDeviceConnected * dev) ;
+    USB_TYPE resetDevice(USBDeviceConnected * dev) ;
 
     /*
     * If there is a HID device connected, the host stores the length of the report descriptor.