USB Host Library for Sprint Dongles
Fork of USBHostWANDongleSprint by
Revision 9:2a7b7333245f, committed 2012-12-10
- Comitter:
- donatien
- Date:
- Mon Dec 10 18:18:35 2012 +0000
- Parent:
- 7:3fdc32f938d9
- Parent:
- 8:65cd51339647
- Commit message:
- Merge
Changed in this revision
USB3GModule/WANDongle.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/USB3GModule/WANDongle.cpp Wed Oct 24 15:26:55 2012 +0000 +++ b/USB3GModule/WANDongle.cpp Mon Dec 10 18:18:35 2012 +0000 @@ -179,7 +179,7 @@ /*virtual*/ void WANDongle::setVidPid(uint16_t vid, uint16_t pid) { - //Load right initializer + //Load right initializer WANDongleInitializer** initializer = WANDongleInitializer::getInitializers(host); while(*initializer)
--- a/USB3GModule/WANDongleInitializer.cpp Wed Oct 24 15:26:55 2012 +0000 +++ b/USB3GModule/WANDongleInitializer.cpp Mon Dec 10 18:18:35 2012 +0000 @@ -36,7 +36,8 @@ WANDongleInitializer** WANDongleInitializer::getInitializers(USBHost* pHost) { static Sprint598UInitializer sprint598U(pHost); - const static WANDongleInitializer* list[] = { &sprint598U, NULL }; + static SprintMC5728VInitializer sprintMC5728V(pHost); + const static WANDongleInitializer* list[] = { &sprint598U, &sprintMC5728V, NULL }; return (WANDongleInitializer**)list; } @@ -127,3 +128,75 @@ { return WAN_DONGLE_TYPE_SPRINT598U; } + +//Sierra Wireless MC5728V (Sprint) +SprintMC5728VInitializer::SprintMC5728VInitializer(USBHost* pHost) : WANDongleInitializer(pHost) +{ + +} + +uint16_t SprintMC5728VInitializer::getMSDVid() { return 0x1199; } +uint16_t SprintMC5728VInitializer::getMSDPid() { return 0x0000; } //No MSD mode (presumably) + +uint16_t SprintMC5728VInitializer::getSerialVid() { return 0x1199; } +uint16_t SprintMC5728VInitializer::getSerialPid() { return 0x0028; } + +bool SprintMC5728VInitializer::switchMode(USBDeviceConnected* pDev) +{ + return true; +} + +USBEndpoint* SprintMC5728VInitializer::getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx) +{ + return pDev->getEndpoint(serialPortNumber, BULK_ENDPOINT, tx?OUT:IN, 0); +} + +int SprintMC5728VInitializer::getSerialPortCount() +{ + return 1; +} + +/*virtual*/ void SprintMC5728VInitializer::setVidPid(uint16_t vid, uint16_t pid) +{ + m_currentSerialIntf = 0; + m_currentEndpoint = 0; +} + +/*virtual*/ bool SprintMC5728VInitializer::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 +{ + 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++; + return true; + } + m_currentSerialIntf++; + } + return false; +} + +/*virtual*/ bool SprintMC5728VInitializer::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) //Must return true if the endpoint will be used +{ + DBG("USBEndpoint on Interface #%d; Type:%d; Direction:%d", intf_nb, type, dir); + if(type == BULK_ENDPOINT) + { + if( (m_currentEndpoint >= 0) && (m_currentEndpoint < 2) ) + { + m_currentEndpoint++; + return true; + } + else + { + m_currentEndpoint++; + } + } + return false; +} + + +/*virtual*/ WAN_DONGLE_TYPE SprintMC5728VInitializer::getType() +{ + return WAN_DONGLE_TYPE_SPRINTMC5728V; +} \ No newline at end of file
--- a/USB3GModule/WANDongleInitializer.h Wed Oct 24 15:26:55 2012 +0000 +++ b/USB3GModule/WANDongleInitializer.h Mon Dec 10 18:18:35 2012 +0000 @@ -30,6 +30,7 @@ { WAN_DONGLE_TYPE_UNKNOWN = -1, WAN_DONGLE_TYPE_SPRINT598U = 10, + WAN_DONGLE_TYPE_SPRINTMC5728V = 11, }; class WANDongleInitializer : public IUSBEnumerator @@ -94,4 +95,35 @@ int m_currentEndpoint; }; +class SprintMC5728VInitializer : public WANDongleInitializer +{ +public: + SprintMC5728VInitializer(USBHost* pHost); + + virtual uint16_t getMSDVid(); + virtual uint16_t getMSDPid(); + + virtual uint16_t getSerialVid(); + virtual uint16_t getSerialPid(); + + virtual bool switchMode(USBDeviceConnected* pDev); + + virtual USBEndpoint* getEp(USBDeviceConnected* pDev, int serialPortNumber, bool tx); + + virtual int getSerialPortCount(); + + virtual void setVidPid(uint16_t vid, uint16_t pid); + + virtual bool 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 + + virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used + + virtual WAN_DONGLE_TYPE getType(); + +private: + + int m_currentSerialIntf; + int m_currentEndpoint; +}; + #endif