USB Host Library for Sprint Dongles
Fork of USBHostWANDongleSprint by
Diff: USB3GModule/WANDongleInitializer.cpp
- Revision:
- 8:65cd51339647
- Parent:
- 6:aaf432a6819b
--- a/USB3GModule/WANDongleInitializer.cpp Wed Oct 10 08:29:36 2012 +0000 +++ b/USB3GModule/WANDongleInitializer.cpp Fri Nov 30 13:08:13 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