USB Host Library for Sprint Dongles

Fork of USBHostWANDongleSprint_bleedingedge by Donatien Garnier

Legacy Warning

This is an mbed 2 libary. To learn more about mbed OS 5, visit the docs.

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Wed Sep 26 07:07:47 2012 +0000
Parent:
2:34c976009b70
Child:
4:cd9864d1db52
Child:
5:99f453c4756b
Commit message:
Tweaks for Sprint dongle compat

Changed in this revision

USB3GModule/WANDongle.cpp Show annotated file Show diff for this revision Revisions of this file
USB3GModule/WANDongleInitializer.cpp Show annotated file Show diff for this revision Revisions of this file
USB3GModule/WANDongleInitializer.h Show annotated file Show diff for this revision Revisions of this file
USBHost/USBDeviceConnected.h Show annotated file Show diff for this revision Revisions of this file
USBHost/USBHALHost.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
--- a/USB3GModule/WANDongle.cpp	Mon Sep 24 09:08:49 2012 +0000
+++ b/USB3GModule/WANDongle.cpp	Wed Sep 26 07:07:47 2012 +0000
@@ -16,7 +16,7 @@
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#define __DEBUG__ 4
+#define __DEBUG__ 0
 #ifndef __MODULE__
 #define __MODULE__ "WANDongle.cpp"
 #endif
--- a/USB3GModule/WANDongleInitializer.cpp	Mon Sep 24 09:08:49 2012 +0000
+++ b/USB3GModule/WANDongleInitializer.cpp	Wed Sep 26 07:07:47 2012 +0000
@@ -16,7 +16,7 @@
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#define __DEBUG__ 4
+#define __DEBUG__ 0
 #ifndef __MODULE__
 #define __MODULE__ "WANDongleInitializer.cpp"
 #endif
@@ -76,11 +76,13 @@
       m_hasSwitched = true;
       m_currentSerialIntf = 0;
       m_endpointsToFetch = 4;
+      m_endpointsToSkip = 0;
     }
     else
     {
       m_hasSwitched = false;
       m_endpointsToFetch = 0;
+      m_endpointsToSkip = 0;
     }
 }
 
@@ -91,7 +93,7 @@
     DBG("Interface #%d; Class:%02x; SubClass:%02x; Protocol:%02x", intf_nb, intf_class, intf_subclass, intf_protocol);
     if( intf_class == 0xFF )
     {
-      if( (m_currentSerialIntf == 0) || (m_currentSerialIntf == 1) )
+      if( (m_currentSerialIntf == 0) )
       {
         m_currentSerialIntf++;
         return true;
@@ -109,8 +111,15 @@
     DBG("USBEndpoint on Interface #%d; Type:%d; Direction:%d", intf_nb, type, dir);
     if( (type == BULK_ENDPOINT) && m_endpointsToFetch )
     {
-      m_endpointsToFetch--;
-      return true;
+      if(!m_endpointsToSkip)
+      {
+        m_endpointsToFetch--;
+        return true;
+      }
+      else
+      {
+        m_endpointsToSkip--;
+      }
     }
   }
   return false;
--- a/USB3GModule/WANDongleInitializer.h	Mon Sep 24 09:08:49 2012 +0000
+++ b/USB3GModule/WANDongleInitializer.h	Wed Sep 26 07:07:47 2012 +0000
@@ -92,6 +92,7 @@
   bool m_hasSwitched;
   int m_currentSerialIntf;
   int m_endpointsToFetch;
+  int m_endpointsToSkip;
 };
 
 #endif
--- a/USBHost/USBDeviceConnected.h	Mon Sep 24 09:08:49 2012 +0000
+++ b/USBHost/USBDeviceConnected.h	Wed Sep 26 07:07:47 2012 +0000
@@ -22,8 +22,8 @@
 #include "stdint.h"
 #include "USBEndpoint.h"
 
-#define MAX_ENDPOINT_PER_INTERFACE  2
-#define MAX_INTF                    2
+#define MAX_ENDPOINT_PER_INTERFACE  4
+#define MAX_INTF                    1
 
 typedef struct {
     bool in_use;
--- a/USBHost/USBHALHost.cpp	Mon Sep 24 09:08:49 2012 +0000
+++ b/USBHost/USBHALHost.cpp	Wed Sep 26 07:07:47 2012 +0000
@@ -356,7 +356,7 @@
           { //Root device disconnected
             //Device disconnected
             WARN("Device disconnected!!");
-            Thread::wait(2000);
+            //Thread::wait(2000);
             if (!(int_status & OR_INTR_STATUS_WDH))
             {
               usb_hcca->DoneHead = 0;
--- a/USBHost/USBHost.cpp	Mon Sep 24 09:08:49 2012 +0000
+++ b/USBHost/USBHost.cpp	Wed Sep 26 07:07:47 2012 +0000
@@ -16,7 +16,7 @@
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#define __DEBUG__ 4 //WARN: ENABLING DEBUGGING HERE WILL PRINTF IN IRQS!! UNEXPECTED BEHAVIOUR MAY RESULT...
+#define __DEBUG__ 0 //WARN: ENABLING DEBUGGING HERE WILL PRINTF IN IRQS!! UNEXPECTED BEHAVIOUR MAY RESULT...
 #ifndef __MODULE__
 #define __MODULE__ "USBHost.cpp"
 #endif
@@ -28,7 +28,7 @@
 #include "rtos.h"
 
 
-#define NB_MAX_INTF 2
+#define NB_MAX_INTF 1
 
 USBHost * USBHost::instHost = NULL;
 
@@ -156,7 +156,7 @@
  * Call in ISR when a device has been connected
  */
 void USBHost::deviceConnected(int hub, int port, bool lowSpeed)  {
-
+  WARN("Device connected");
   for (int i = 0; i < MAX_DEVICE_NB; i++) {
     if (!deviceInUse[i]) {
       deviceInUse[i] = true;