Changes to support Vodafone K4606

Dependents:   VodafoneUSBModem

Fork of USBHostWANDongle by mbed official

Revision:
28:34cdecfff9f4
Parent:
25:3184f71557bf
--- a/USB3GModule/WANDongle.cpp	Fri Sep 20 10:40:15 2013 +0000
+++ b/USB3GModule/WANDongle.cpp	Wed Jan 28 11:38:44 2015 +0000
@@ -30,6 +30,7 @@
 
 WANDongle::WANDongle() : m_pInitializer(NULL), m_serialCount(0)
 {
+    m_lastDongle = NULL;
     host = USBHost::getHostInst();
     init();
     DBG("WANDongle object instantiated. getHostInst method called on USBHost.");
@@ -112,7 +113,7 @@
             }
             else if ((dev->getVid() == m_pInitializer->getMSDVid()) && (dev->getPid() == m_pInitializer->getMSDPid()))
             {
-              DBG("Vodafone K3370 dongle detected in MSD mode");
+              DBG("Vodafone dongle detected in MSD mode");
               //Try to switch   
               if( m_pInitializer->switchMode(dev) )
               {
@@ -192,6 +193,14 @@
   
   while(*initializer)
   {
+    if (m_lastDongle)
+    {
+        DBG("Initializer has been already detected in previous step");
+        m_pInitializer = m_lastDongle;    
+        break;
+    }
+    
+    
     DBG("*initializer=%p", *initializer);
     DBG("(*initializer)->getSerialVid()=%04x", (*initializer)->getSerialVid());
     DBG("(*initializer)->getSerialPid()=%04x", (*initializer)->getSerialPid());
@@ -205,6 +214,11 @@
     {
       DBG("Vodafone K3370 dongle detected in MSD mode");
       m_pInitializer = *initializer;
+      
+      //Store successfully detected modem type so that after switch to serial mode 
+      //we can distinuguish modems with same Vid-Pid pairs
+      m_lastDongle = *initializer;
+      
       break;
     }
     initializer++;