SNMP agent attached to SPI slave

Dependencies:   mbed

Committer:
lorcansmith
Date:
Mon Aug 13 15:07:40 2012 +0000
Revision:
0:2a53a4c3238c
v1.1 release includes ioAlarm traps

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lorcansmith 0:2a53a4c3238c 1
lorcansmith 0:2a53a4c3238c 2 /*
lorcansmith 0:2a53a4c3238c 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
lorcansmith 0:2a53a4c3238c 4
lorcansmith 0:2a53a4c3238c 5 Permission is hereby granted, free of charge, to any person obtaining a copy
lorcansmith 0:2a53a4c3238c 6 of this software and associated documentation files (the "Software"), to deal
lorcansmith 0:2a53a4c3238c 7 in the Software without restriction, including without limitation the rights
lorcansmith 0:2a53a4c3238c 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
lorcansmith 0:2a53a4c3238c 9 copies of the Software, and to permit persons to whom the Software is
lorcansmith 0:2a53a4c3238c 10 furnished to do so, subject to the following conditions:
lorcansmith 0:2a53a4c3238c 11
lorcansmith 0:2a53a4c3238c 12 The above copyright notice and this permission notice shall be included in
lorcansmith 0:2a53a4c3238c 13 all copies or substantial portions of the Software.
lorcansmith 0:2a53a4c3238c 14
lorcansmith 0:2a53a4c3238c 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
lorcansmith 0:2a53a4c3238c 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
lorcansmith 0:2a53a4c3238c 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
lorcansmith 0:2a53a4c3238c 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
lorcansmith 0:2a53a4c3238c 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
lorcansmith 0:2a53a4c3238c 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
lorcansmith 0:2a53a4c3238c 21 THE SOFTWARE.
lorcansmith 0:2a53a4c3238c 22 */
lorcansmith 0:2a53a4c3238c 23
lorcansmith 0:2a53a4c3238c 24 #include "netCfg.h"
lorcansmith 0:2a53a4c3238c 25 #if NET_UMTS
lorcansmith 0:2a53a4c3238c 26
lorcansmith 0:2a53a4c3238c 27 #include "UMTSStick.h"
lorcansmith 0:2a53a4c3238c 28
lorcansmith 0:2a53a4c3238c 29 #define __DEBUG
lorcansmith 0:2a53a4c3238c 30 #include "dbg/dbg.h"
lorcansmith 0:2a53a4c3238c 31
lorcansmith 0:2a53a4c3238c 32 UMTSStick::UMTSStick() : m_host(), m_pDev(NULL)
lorcansmith 0:2a53a4c3238c 33 {
lorcansmith 0:2a53a4c3238c 34
lorcansmith 0:2a53a4c3238c 35 }
lorcansmith 0:2a53a4c3238c 36
lorcansmith 0:2a53a4c3238c 37 UMTSStick::~UMTSStick()
lorcansmith 0:2a53a4c3238c 38 {
lorcansmith 0:2a53a4c3238c 39
lorcansmith 0:2a53a4c3238c 40 }
lorcansmith 0:2a53a4c3238c 41
lorcansmith 0:2a53a4c3238c 42
lorcansmith 0:2a53a4c3238c 43 UMTSStickErr UMTSStick::getSerial(UsbSerial** ppUsbSerial)
lorcansmith 0:2a53a4c3238c 44 {
lorcansmith 0:2a53a4c3238c 45 m_host.init();
lorcansmith 0:2a53a4c3238c 46
lorcansmith 0:2a53a4c3238c 47 UMTSStickErr rc;
lorcansmith 0:2a53a4c3238c 48
lorcansmith 0:2a53a4c3238c 49 rc = waitForDevice();
lorcansmith 0:2a53a4c3238c 50 if(rc)
lorcansmith 0:2a53a4c3238c 51 return rc;
lorcansmith 0:2a53a4c3238c 52
lorcansmith 0:2a53a4c3238c 53 //Device is now enumerated, read table
lorcansmith 0:2a53a4c3238c 54
lorcansmith 0:2a53a4c3238c 55 uint16_t vid = m_pDev->getVid();
lorcansmith 0:2a53a4c3238c 56 uint16_t pid = m_pDev->getPid();
lorcansmith 0:2a53a4c3238c 57
lorcansmith 0:2a53a4c3238c 58 DBG("Configuration set: vid:%04x pid:%04x\n", vid, pid);
lorcansmith 0:2a53a4c3238c 59
lorcansmith 0:2a53a4c3238c 60 bool handled = false;
lorcansmith 0:2a53a4c3238c 61 bool cdfs = false;
lorcansmith 0:2a53a4c3238c 62 const UMTSSwitchingInfo* pInfo;
lorcansmith 0:2a53a4c3238c 63 for(int i = 0; i < UMTS_SWITCHING_COUNT; i++)
lorcansmith 0:2a53a4c3238c 64 {
lorcansmith 0:2a53a4c3238c 65 pInfo = &UMTSwitchingTable[i];
lorcansmith 0:2a53a4c3238c 66 if( !checkDeviceState(pInfo, &cdfs) )
lorcansmith 0:2a53a4c3238c 67 {
lorcansmith 0:2a53a4c3238c 68 handled = true;
lorcansmith 0:2a53a4c3238c 69 break;
lorcansmith 0:2a53a4c3238c 70 }
lorcansmith 0:2a53a4c3238c 71
lorcansmith 0:2a53a4c3238c 72 } //for(int i = 0; i < UMTS_SWITCHING_COUNT; i++)
lorcansmith 0:2a53a4c3238c 73
lorcansmith 0:2a53a4c3238c 74 if(!handled)
lorcansmith 0:2a53a4c3238c 75 {
lorcansmith 0:2a53a4c3238c 76 DBG("Don't know this device!\n");
lorcansmith 0:2a53a4c3238c 77 return UMTSERR_NOTIMPLEMENTED;
lorcansmith 0:2a53a4c3238c 78 }
lorcansmith 0:2a53a4c3238c 79
lorcansmith 0:2a53a4c3238c 80 //Check if the device is in CDFS mode, in this case switch
lorcansmith 0:2a53a4c3238c 81 if(cdfs)
lorcansmith 0:2a53a4c3238c 82 {
lorcansmith 0:2a53a4c3238c 83 DBG("Switching the device by sending a magic packet\n");
lorcansmith 0:2a53a4c3238c 84
lorcansmith 0:2a53a4c3238c 85 rc = switchMode(pInfo);
lorcansmith 0:2a53a4c3238c 86 if(rc)
lorcansmith 0:2a53a4c3238c 87 return rc;
lorcansmith 0:2a53a4c3238c 88
lorcansmith 0:2a53a4c3238c 89 DBG("Now wait for device to reconnect\n");
lorcansmith 0:2a53a4c3238c 90
lorcansmith 0:2a53a4c3238c 91 m_host.releaseDevice(m_pDev);
lorcansmith 0:2a53a4c3238c 92
lorcansmith 0:2a53a4c3238c 93 //Wait for device to reconnect
lorcansmith 0:2a53a4c3238c 94 wait(3);
lorcansmith 0:2a53a4c3238c 95 rc = waitForDevice();
lorcansmith 0:2a53a4c3238c 96 if(rc)
lorcansmith 0:2a53a4c3238c 97 return rc;
lorcansmith 0:2a53a4c3238c 98 }
lorcansmith 0:2a53a4c3238c 99
lorcansmith 0:2a53a4c3238c 100 rc = findSerial(ppUsbSerial);
lorcansmith 0:2a53a4c3238c 101 if(rc)
lorcansmith 0:2a53a4c3238c 102 return rc;
lorcansmith 0:2a53a4c3238c 103
lorcansmith 0:2a53a4c3238c 104 return UMTSERR_OK;
lorcansmith 0:2a53a4c3238c 105 }
lorcansmith 0:2a53a4c3238c 106
lorcansmith 0:2a53a4c3238c 107 UMTSStickErr UMTSStick::waitForDevice()
lorcansmith 0:2a53a4c3238c 108 {
lorcansmith 0:2a53a4c3238c 109 bool ready = false;
lorcansmith 0:2a53a4c3238c 110 while(!ready)
lorcansmith 0:2a53a4c3238c 111 {
lorcansmith 0:2a53a4c3238c 112 while(!m_host.devicesCount())
lorcansmith 0:2a53a4c3238c 113 {}
lorcansmith 0:2a53a4c3238c 114 wait(1);
lorcansmith 0:2a53a4c3238c 115 if(m_host.devicesCount())
lorcansmith 0:2a53a4c3238c 116 ready = true;
lorcansmith 0:2a53a4c3238c 117 }
lorcansmith 0:2a53a4c3238c 118
lorcansmith 0:2a53a4c3238c 119 wait(2); //Wait for device to be initialized
lorcansmith 0:2a53a4c3238c 120
lorcansmith 0:2a53a4c3238c 121 if(!m_host.devicesCount())
lorcansmith 0:2a53a4c3238c 122 return UMTSERR_DISCONNECTED;
lorcansmith 0:2a53a4c3238c 123
lorcansmith 0:2a53a4c3238c 124 m_pDev = m_host.getDevice(0);
lorcansmith 0:2a53a4c3238c 125
lorcansmith 0:2a53a4c3238c 126 while(!m_pDev->enumerated())
lorcansmith 0:2a53a4c3238c 127 {
lorcansmith 0:2a53a4c3238c 128 m_host.poll();
lorcansmith 0:2a53a4c3238c 129 if(!m_host.devicesCount())
lorcansmith 0:2a53a4c3238c 130 return UMTSERR_DISCONNECTED;
lorcansmith 0:2a53a4c3238c 131 }
lorcansmith 0:2a53a4c3238c 132
lorcansmith 0:2a53a4c3238c 133 return UMTSERR_OK;
lorcansmith 0:2a53a4c3238c 134 }
lorcansmith 0:2a53a4c3238c 135
lorcansmith 0:2a53a4c3238c 136 UMTSStickErr UMTSStick::checkDeviceState(const UMTSSwitchingInfo* pInfo, bool* pCdfs)
lorcansmith 0:2a53a4c3238c 137 {
lorcansmith 0:2a53a4c3238c 138 uint16_t vid = m_pDev->getVid();
lorcansmith 0:2a53a4c3238c 139 uint16_t pid = m_pDev->getPid();
lorcansmith 0:2a53a4c3238c 140 bool handled = false;
lorcansmith 0:2a53a4c3238c 141 if( (vid == pInfo->cdfsVid) && (pid == pInfo->cdfsPid) )
lorcansmith 0:2a53a4c3238c 142 {
lorcansmith 0:2a53a4c3238c 143 DBG("Match on dongles list\n");
lorcansmith 0:2a53a4c3238c 144 if( !pInfo->targetClass ) //No specific interface to check, vid/pid couple is specific to CDFS mode
lorcansmith 0:2a53a4c3238c 145 {
lorcansmith 0:2a53a4c3238c 146 DBG("Found device in CDFS mode\n");
lorcansmith 0:2a53a4c3238c 147 handled = true;
lorcansmith 0:2a53a4c3238c 148 *pCdfs = true;
lorcansmith 0:2a53a4c3238c 149 }
lorcansmith 0:2a53a4c3238c 150 else //if( !pInfo->targetClass )
lorcansmith 0:2a53a4c3238c 151 {
lorcansmith 0:2a53a4c3238c 152 //Has to check if there is an interface of class targetClass
lorcansmith 0:2a53a4c3238c 153 byte* desc = NULL;
lorcansmith 0:2a53a4c3238c 154 int c = 0;
lorcansmith 0:2a53a4c3238c 155
lorcansmith 0:2a53a4c3238c 156 while( !m_pDev->getInterfaceDescriptor(1, c++, &desc) )
lorcansmith 0:2a53a4c3238c 157 {
lorcansmith 0:2a53a4c3238c 158 if( desc[5] == pInfo->targetClass )
lorcansmith 0:2a53a4c3238c 159 {
lorcansmith 0:2a53a4c3238c 160 DBG("Found device in Serial mode\n");
lorcansmith 0:2a53a4c3238c 161 handled = true;
lorcansmith 0:2a53a4c3238c 162 *pCdfs = false;
lorcansmith 0:2a53a4c3238c 163 break;
lorcansmith 0:2a53a4c3238c 164 }
lorcansmith 0:2a53a4c3238c 165 }
lorcansmith 0:2a53a4c3238c 166
lorcansmith 0:2a53a4c3238c 167 if(!handled)
lorcansmith 0:2a53a4c3238c 168 {
lorcansmith 0:2a53a4c3238c 169 //All interfaces were tried, so we are in CDFS mode
lorcansmith 0:2a53a4c3238c 170 DBG("Found device in CDFS mode\n");
lorcansmith 0:2a53a4c3238c 171 handled = true;
lorcansmith 0:2a53a4c3238c 172 *pCdfs = true;
lorcansmith 0:2a53a4c3238c 173 }
lorcansmith 0:2a53a4c3238c 174 } //if( !pInfo->targetClass )
lorcansmith 0:2a53a4c3238c 175 } //if( (vid == pInfo->cdfsVid) && (pid == pInfo->cdfsPid) )
lorcansmith 0:2a53a4c3238c 176 else
lorcansmith 0:2a53a4c3238c 177 {
lorcansmith 0:2a53a4c3238c 178 //Try every vid/pid couple of the serial list
lorcansmith 0:2a53a4c3238c 179 for( int i = 0; i < 16 ; i++)
lorcansmith 0:2a53a4c3238c 180 {
lorcansmith 0:2a53a4c3238c 181 if(!pInfo->serialPidList[i])
lorcansmith 0:2a53a4c3238c 182 break;
lorcansmith 0:2a53a4c3238c 183 if( (pInfo->serialVid == vid) && (pInfo->serialPidList[i] == pid) )
lorcansmith 0:2a53a4c3238c 184 {
lorcansmith 0:2a53a4c3238c 185 DBG("Found device in Serial mode\n");
lorcansmith 0:2a53a4c3238c 186 handled = true;
lorcansmith 0:2a53a4c3238c 187 *pCdfs = false;
lorcansmith 0:2a53a4c3238c 188 break;
lorcansmith 0:2a53a4c3238c 189 }
lorcansmith 0:2a53a4c3238c 190 }
lorcansmith 0:2a53a4c3238c 191 } //if( (vid == pInfo->cdfsVid) && (pid == pInfo->cdfsPid) )
lorcansmith 0:2a53a4c3238c 192
lorcansmith 0:2a53a4c3238c 193 if(!handled)
lorcansmith 0:2a53a4c3238c 194 return UMTSERR_NOTFOUND;
lorcansmith 0:2a53a4c3238c 195
lorcansmith 0:2a53a4c3238c 196 return UMTSERR_OK;
lorcansmith 0:2a53a4c3238c 197 }
lorcansmith 0:2a53a4c3238c 198
lorcansmith 0:2a53a4c3238c 199 UMTSStickErr UMTSStick::switchMode(const UMTSSwitchingInfo* pInfo)
lorcansmith 0:2a53a4c3238c 200 {
lorcansmith 0:2a53a4c3238c 201 if(!pInfo->huaweiPacket) //Send SCSI packet on first bulk ep
lorcansmith 0:2a53a4c3238c 202 {
lorcansmith 0:2a53a4c3238c 203 //Find first bulk ep
lorcansmith 0:2a53a4c3238c 204 byte* desc = NULL;
lorcansmith 0:2a53a4c3238c 205 int c = 0;
lorcansmith 0:2a53a4c3238c 206
lorcansmith 0:2a53a4c3238c 207 UsbEndpoint *pEpOut = NULL;
lorcansmith 0:2a53a4c3238c 208
lorcansmith 0:2a53a4c3238c 209 while( !m_pDev->getInterfaceDescriptor(1, c++, &desc) )
lorcansmith 0:2a53a4c3238c 210 {
lorcansmith 0:2a53a4c3238c 211 byte* p = desc;
lorcansmith 0:2a53a4c3238c 212 int epNum = 0;
lorcansmith 0:2a53a4c3238c 213 p = p + p[0]; //Move to next descriptor (which should be an ep descriptor)
lorcansmith 0:2a53a4c3238c 214 while (epNum < desc[4]) //Eps count in this if
lorcansmith 0:2a53a4c3238c 215 {
lorcansmith 0:2a53a4c3238c 216 if (p[1] != USB_DESCRIPTOR_TYPE_ENDPOINT)
lorcansmith 0:2a53a4c3238c 217 break;
lorcansmith 0:2a53a4c3238c 218
lorcansmith 0:2a53a4c3238c 219 if( (p[3] == 0x02) && !(p[2] & 0x80) ) //Bulk endpoint, out
lorcansmith 0:2a53a4c3238c 220 {
lorcansmith 0:2a53a4c3238c 221 DBG("Found bulk ep %02x\n", p[2]);
lorcansmith 0:2a53a4c3238c 222 pEpOut = new UsbEndpoint( m_pDev, p[2], false, USB_BULK, *((uint16_t*)&p[4]) );
lorcansmith 0:2a53a4c3238c 223 break;
lorcansmith 0:2a53a4c3238c 224 }
lorcansmith 0:2a53a4c3238c 225
lorcansmith 0:2a53a4c3238c 226 p = p + p[0]; //Move to next ep desc
lorcansmith 0:2a53a4c3238c 227 epNum++;
lorcansmith 0:2a53a4c3238c 228 }
lorcansmith 0:2a53a4c3238c 229 if(pEpOut)
lorcansmith 0:2a53a4c3238c 230 break;
lorcansmith 0:2a53a4c3238c 231 }
lorcansmith 0:2a53a4c3238c 232
lorcansmith 0:2a53a4c3238c 233 if(!pEpOut)
lorcansmith 0:2a53a4c3238c 234 return UMTSERR_NOTFOUND;
lorcansmith 0:2a53a4c3238c 235
lorcansmith 0:2a53a4c3238c 236 //Send SCSI packet
lorcansmith 0:2a53a4c3238c 237
lorcansmith 0:2a53a4c3238c 238 DBG("Sending SCSI Packet to switch\n");
lorcansmith 0:2a53a4c3238c 239 byte ramCdfsBuf[31];
lorcansmith 0:2a53a4c3238c 240 memcpy(ramCdfsBuf, pInfo->cdfsPacket, 31);
lorcansmith 0:2a53a4c3238c 241 pEpOut->transfer((volatile byte*)ramCdfsBuf, 31);
lorcansmith 0:2a53a4c3238c 242 while(pEpOut->status() == USBERR_PROCESSING);
lorcansmith 0:2a53a4c3238c 243 int ret = pEpOut->status();
lorcansmith 0:2a53a4c3238c 244 if((ret < 0) && (ret !=USBERR_DISCONNECTED)) //Packet was not transfered
lorcansmith 0:2a53a4c3238c 245 {
lorcansmith 0:2a53a4c3238c 246 DBG("Usb error %d\n", ret);
lorcansmith 0:2a53a4c3238c 247 delete pEpOut;
lorcansmith 0:2a53a4c3238c 248 return UMTSERR_USBERR;
lorcansmith 0:2a53a4c3238c 249 }
lorcansmith 0:2a53a4c3238c 250
lorcansmith 0:2a53a4c3238c 251 delete pEpOut;
lorcansmith 0:2a53a4c3238c 252 }
lorcansmith 0:2a53a4c3238c 253 else
lorcansmith 0:2a53a4c3238c 254 {
lorcansmith 0:2a53a4c3238c 255 UsbErr usbErr;
lorcansmith 0:2a53a4c3238c 256 //Send the Huawei-specific control packet
lorcansmith 0:2a53a4c3238c 257 usbErr = m_pDev->controlSend(0, 0x03, 1, 0, NULL, 0);
lorcansmith 0:2a53a4c3238c 258 if(usbErr && (usbErr != USBERR_DISCONNECTED))
lorcansmith 0:2a53a4c3238c 259 return UMTSERR_USBERR;
lorcansmith 0:2a53a4c3238c 260 }
lorcansmith 0:2a53a4c3238c 261
lorcansmith 0:2a53a4c3238c 262 DBG("The stick should be switching in serial mode now\n");
lorcansmith 0:2a53a4c3238c 263
lorcansmith 0:2a53a4c3238c 264 return UMTSERR_OK;
lorcansmith 0:2a53a4c3238c 265 }
lorcansmith 0:2a53a4c3238c 266
lorcansmith 0:2a53a4c3238c 267 UMTSStickErr UMTSStick::findSerial(UsbSerial** ppUsbSerial)
lorcansmith 0:2a53a4c3238c 268 {
lorcansmith 0:2a53a4c3238c 269 byte* desc = NULL;
lorcansmith 0:2a53a4c3238c 270 int c = 0;
lorcansmith 0:2a53a4c3238c 271
lorcansmith 0:2a53a4c3238c 272 int epOut = 0;
lorcansmith 0:2a53a4c3238c 273 int epIn = 0;
lorcansmith 0:2a53a4c3238c 274
lorcansmith 0:2a53a4c3238c 275 while( !m_pDev->getInterfaceDescriptor(1, c++, &desc) )
lorcansmith 0:2a53a4c3238c 276 {
lorcansmith 0:2a53a4c3238c 277 byte* p = desc;
lorcansmith 0:2a53a4c3238c 278 int epNum = 0;
lorcansmith 0:2a53a4c3238c 279
lorcansmith 0:2a53a4c3238c 280 DBG("Interface of type %02x\n", desc[5]);
lorcansmith 0:2a53a4c3238c 281
lorcansmith 0:2a53a4c3238c 282 if(desc[5] != 0xFF) //Not a serial-like if
lorcansmith 0:2a53a4c3238c 283 continue;
lorcansmith 0:2a53a4c3238c 284
lorcansmith 0:2a53a4c3238c 285 p = p + p[0]; //Move to next descriptor (which should be an ep descriptor)
lorcansmith 0:2a53a4c3238c 286 while (epNum < desc[4]) //Eps count in this if
lorcansmith 0:2a53a4c3238c 287 {
lorcansmith 0:2a53a4c3238c 288 if (p[1] == USB_DESCRIPTOR_TYPE_ENDPOINT)
lorcansmith 0:2a53a4c3238c 289 {
lorcansmith 0:2a53a4c3238c 290 if( (p[3] == 0x02) && !(p[2] & 0x80) && !epOut ) //Bulk endpoint, out
lorcansmith 0:2a53a4c3238c 291 {
lorcansmith 0:2a53a4c3238c 292 DBG("Found bulk out ep %02x of payload size %04x\n", p[2], *((uint16_t*)&p[4]));
lorcansmith 0:2a53a4c3238c 293 epOut = p[2] & 0x7F;
lorcansmith 0:2a53a4c3238c 294 }
lorcansmith 0:2a53a4c3238c 295
lorcansmith 0:2a53a4c3238c 296 if( (p[3] == 0x02) && (p[2] & 0x80) && !epIn ) //Bulk endpoint, in
lorcansmith 0:2a53a4c3238c 297 {
lorcansmith 0:2a53a4c3238c 298 DBG("Found bulk in ep %02x of payload size %04x\n", p[2], *((uint16_t*)&p[4]));
lorcansmith 0:2a53a4c3238c 299 epIn = p[2] & 0x7F;
lorcansmith 0:2a53a4c3238c 300 }
lorcansmith 0:2a53a4c3238c 301
lorcansmith 0:2a53a4c3238c 302 if(epOut && epIn)
lorcansmith 0:2a53a4c3238c 303 break;
lorcansmith 0:2a53a4c3238c 304 }
lorcansmith 0:2a53a4c3238c 305
lorcansmith 0:2a53a4c3238c 306 p = p + p[0]; //Move to next ep desc
lorcansmith 0:2a53a4c3238c 307 epNum++;
lorcansmith 0:2a53a4c3238c 308 }
lorcansmith 0:2a53a4c3238c 309
lorcansmith 0:2a53a4c3238c 310 if(epOut && epIn)
lorcansmith 0:2a53a4c3238c 311 break;
lorcansmith 0:2a53a4c3238c 312 }
lorcansmith 0:2a53a4c3238c 313
lorcansmith 0:2a53a4c3238c 314 if(!epOut || !epIn)
lorcansmith 0:2a53a4c3238c 315 return UMTSERR_NOTFOUND;
lorcansmith 0:2a53a4c3238c 316
lorcansmith 0:2a53a4c3238c 317 DBG("Endpoints found, create serial object\n");
lorcansmith 0:2a53a4c3238c 318
lorcansmith 0:2a53a4c3238c 319 *ppUsbSerial = new UsbSerial(m_pDev, epIn, epOut);
lorcansmith 0:2a53a4c3238c 320
lorcansmith 0:2a53a4c3238c 321 DBG("UsbSerial object created\n");
lorcansmith 0:2a53a4c3238c 322
lorcansmith 0:2a53a4c3238c 323 return UMTSERR_OK;
lorcansmith 0:2a53a4c3238c 324 }
lorcansmith 0:2a53a4c3238c 325
lorcansmith 0:2a53a4c3238c 326 #endif