89 // was already loaded at boot time.) |
93 // was already loaded at boot time.) |
90 TInt r = User::LoadLogicalDevice(KUsbLddFilename); |
94 TInt r = User::LoadLogicalDevice(KUsbLddFilename); |
91 if (r != KErrNone && r != KErrAlreadyExists) |
95 if (r != KErrNone && r != KErrAlreadyExists) |
92 { |
96 { |
93 TUSB_PRINT1("Error %d on loading USB LDD", r); |
97 TUSB_PRINT1("Error %d on loading USB LDD", r); |
|
98 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL, "Error %d on loading USB LDD", r); |
94 User::Leave(-1); |
99 User::Leave(-1); |
95 return; |
100 return; |
96 } |
101 } |
97 TUSB_PRINT("Successfully loaded USB LDD"); |
102 TUSB_PRINT("Successfully loaded USB LDD"); |
|
103 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP01, "Successfully loaded USB LDD"); |
98 |
104 |
99 // Open USB channel |
105 // Open USB channel |
100 r = iPort.Open(0); |
106 r = iPort.Open(0); |
101 if (r != KErrNone) |
107 if (r != KErrNone) |
102 { |
108 { |
103 TUSB_PRINT1("Error %d on opening USB port", r); |
109 TUSB_PRINT1("Error %d on opening USB port", r); |
|
110 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP02, "Error %d on opening USB port", r); |
104 User::Leave(-1); |
111 User::Leave(-1); |
105 return; |
112 return; |
106 } |
113 } |
107 TUSB_PRINT("Successfully opened USB port"); |
114 TUSB_PRINT("Successfully opened USB port"); |
|
115 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP03, "Successfully opened USB port"); |
108 |
116 |
109 // Create Reader/Writer active object |
117 // Create Reader/Writer active object |
110 iRW = CActiveRW::NewL(iConsole, &iPort, iVerbose); |
118 iRW = CActiveRW::NewL(iConsole, &iPort, iVerbose); |
111 if (!iRW) |
119 if (!iRW) |
112 { |
120 { |
113 TUSB_PRINT("Failed to create reader/writer"); |
121 TUSB_PRINT("Failed to create reader/writer"); |
|
122 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP04, "Failed to create reader/writer"); |
114 User::Leave(-1); |
123 User::Leave(-1); |
115 return; |
124 return; |
116 } |
125 } |
117 TUSB_PRINT("Created reader/writer"); |
126 TUSB_PRINT("Created reader/writer"); |
|
127 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP05, "Created reader/writer"); |
118 |
128 |
119 // check for endpoint resource allocation v2 support |
129 // check for endpoint resource allocation v2 support |
120 TUsbDeviceCaps d_caps; |
130 TUsbDeviceCaps d_caps; |
121 r = iPort.DeviceCaps(d_caps); |
131 r = iPort.DeviceCaps(d_caps); |
122 if (r != KErrNone) |
132 if (r != KErrNone) |
123 { |
133 { |
124 TUSB_PRINT1("Error %d on querying device capabilities", r); |
134 TUSB_PRINT1("Error %d on querying device capabilities", r); |
|
135 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP06, "Error %d on querying device capabilities", r); |
125 User::Leave(-1); |
136 User::Leave(-1); |
126 return; |
137 return; |
127 } |
138 } |
128 iResourceAllocationV2 = ((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0); |
139 iResourceAllocationV2 = ((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0); |
129 |
140 |
173 // Query the USB device/Setup the USB interface |
189 // Query the USB device/Setup the USB interface |
174 TInt r = QueryUsbClientL(); |
190 TInt r = QueryUsbClientL(); |
175 if (r != KErrNone) |
191 if (r != KErrNone) |
176 { |
192 { |
177 TUSB_PRINT1("Interface setup failed", r); |
193 TUSB_PRINT1("Interface setup failed", r); |
|
194 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE, "Interface setup failed:%d", r); |
178 return r; |
195 return r; |
179 } |
196 } |
180 TUSB_PRINT("Interface successfully set up"); |
197 TUSB_PRINT("Interface successfully set up"); |
|
198 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE_DUP01, "Interface successfully set up"); |
181 |
199 |
182 // Change some descriptors to contain suitable values |
200 // Change some descriptors to contain suitable values |
183 r = SetupDescriptors(); |
201 r = SetupDescriptors(); |
184 if (r != KErrNone) |
202 if (r != KErrNone) |
185 { |
203 { |
186 TUSB_PRINT1("Descriptor setup failed", r); |
204 TUSB_PRINT1("Descriptor setup failed", r); |
|
205 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE_DUP02, "Descriptor setup failed:%d ", r); |
187 return r; |
206 return r; |
188 } |
207 } |
189 |
208 |
190 // Create device state active object |
209 // Create device state active object |
191 iDeviceStateNotifier = CActiveDeviceStateNotifier::NewL(iConsole, &iPort, iVerbose); |
210 iDeviceStateNotifier = CActiveDeviceStateNotifier::NewL(iConsole, &iPort, iVerbose); |
192 if (!iDeviceStateNotifier) |
211 if (!iDeviceStateNotifier) |
193 { |
212 { |
194 TUSB_PRINT("Failed to create device state notifier"); |
213 TUSB_PRINT("Failed to create device state notifier"); |
|
214 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE_DUP03, "Failed to create device state notifier"); |
195 return r; |
215 return r; |
196 } |
216 } |
197 iDeviceStateNotifier->Activate(); |
217 iDeviceStateNotifier->Activate(); |
198 |
218 |
199 // Create endpoint stall status active object |
219 // Create endpoint stall status active object |
200 iStallNotifier = CActiveStallNotifier::NewL(iConsole, &iPort, iVerbose); |
220 iStallNotifier = CActiveStallNotifier::NewL(iConsole, &iPort, iVerbose); |
201 if (!iStallNotifier) |
221 if (!iStallNotifier) |
202 { |
222 { |
203 TUSB_PRINT("Failed to create stall notifier"); |
223 TUSB_PRINT("Failed to create stall notifier"); |
|
224 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE_DUP04, "Failed to create stall notifier"); |
204 return r; |
225 return r; |
205 } |
226 } |
206 iStallNotifier->Activate(); |
227 iStallNotifier->Activate(); |
207 |
228 |
208 return r; |
229 return r; |
210 |
231 |
211 |
232 |
212 CActiveConsole::~CActiveConsole() |
233 CActiveConsole::~CActiveConsole() |
213 { |
234 { |
214 TUSB_VERBOSE_PRINT("CActiveConsole::~CActiveConsole()"); |
235 TUSB_VERBOSE_PRINT("CActiveConsole::~CActiveConsole()"); |
|
236 if(iVerbose) |
|
237 { |
|
238 OstTrace0(TRACE_VERBOSE, CACTIVECONSOLE_DCACTIVECONSOLE, "CActiveConsole::~CActiveConsole()"); |
|
239 } |
215 Cancel(); // base class cancel -> calls our DoCancel |
240 Cancel(); // base class cancel -> calls our DoCancel |
216 delete iRW; // destroy the reader/writer |
241 delete iRW; // destroy the reader/writer |
217 delete iDeviceStateNotifier; |
242 delete iDeviceStateNotifier; |
218 delete iStallNotifier; |
243 delete iStallNotifier; |
219 TInt r = iPort.RemoveStringDescriptor(stridx1); |
244 TInt r = iPort.RemoveStringDescriptor(stridx1); |
220 if (r != KErrNone) |
245 if (r != KErrNone) |
221 { |
246 { |
222 TUSB_PRINT1("Error %d on string removal", r); |
247 TUSB_PRINT1("Error %d on string removal", r); |
|
248 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP01, "Error %d on string removal", r); |
223 } |
249 } |
224 r = iPort.RemoveStringDescriptor(stridx2); |
250 r = iPort.RemoveStringDescriptor(stridx2); |
225 if (r != KErrNone) |
251 if (r != KErrNone) |
226 { |
252 { |
227 TUSB_PRINT1("Error %d on string removal", r); |
253 TUSB_PRINT1("Error %d on string removal", r); |
|
254 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP02, "Error %d on string removal", r); |
228 } |
255 } |
229 if (iOtg) |
256 if (iOtg) |
230 { |
257 { |
231 TUSB_PRINT("Running on OTG device: unloading OTG driver"); |
258 TUSB_PRINT("Running on OTG device: unloading OTG driver"); |
|
259 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP03, "Running on OTG device: unloading OTG driver"); |
232 iOtgPort.StopStacks(); |
260 iOtgPort.StopStacks(); |
233 iOtgPort.Close(); |
261 iOtgPort.Close(); |
234 r = User::FreeLogicalDevice(RUsbOtgDriver::Name()); |
262 r = User::FreeLogicalDevice(RUsbOtgDriver::Name()); |
235 if (r != KErrNone) |
263 if (r != KErrNone) |
236 { |
264 { |
237 TUSB_PRINT1("Error %d on freeing OTG LDD", r); |
265 TUSB_PRINT1("Error %d on freeing OTG LDD", r); |
|
266 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP04, "Error %d on freeing OTG LDD", r); |
238 } |
267 } |
239 } |
268 } |
240 iPort.Close(); // close USB channel |
269 iPort.Close(); // close USB channel |
241 r = User::FreeLogicalDevice(KUsbDeviceName); |
270 r = User::FreeLogicalDevice(KUsbDeviceName); |
242 if (r != KErrNone) |
271 if (r != KErrNone) |
243 { |
272 { |
244 TUSB_PRINT1("Error %d during unloading USB LDD", r); |
273 TUSB_PRINT1("Error %d during unloading USB LDD", r); |
|
274 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP05, "Error %d during unloading USB LDD", r); |
245 User::Leave(-1); |
275 User::Leave(-1); |
246 return; |
276 return; |
247 } |
277 } |
248 TUSB_PRINT("Successfully unloaded USB LDD"); |
278 TUSB_PRINT("Successfully unloaded USB LDD"); |
|
279 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP06, "Successfully unloaded USB LDD"); |
249 } |
280 } |
250 |
281 |
251 |
282 |
252 void CActiveConsole::DoCancel() |
283 void CActiveConsole::DoCancel() |
253 { |
284 { |
254 TUSB_VERBOSE_PRINT("CActiveConsole::DoCancel()"); |
285 TUSB_VERBOSE_PRINT("CActiveConsole::DoCancel()"); |
|
286 if(iVerbose) |
|
287 { |
|
288 OstTrace0(TRACE_VERBOSE, CACTIVECONSOLE_DOCANCEL, "CActiveConsole::DoCancel()"); |
|
289 } |
255 iConsole->ReadCancel(); |
290 iConsole->ReadCancel(); |
256 } |
291 } |
257 |
292 |
258 |
293 |
259 void CActiveConsole::RunL() |
294 void CActiveConsole::RunL() |
260 { |
295 { |
261 TUSB_VERBOSE_PRINT("CActiveConsole::RunL()"); |
296 TUSB_VERBOSE_PRINT("CActiveConsole::RunL()"); |
|
297 if(iVerbose) |
|
298 { |
|
299 OstTrace0(TRACE_VERBOSE, CACTIVECONSOLE_RUNL, "CActiveConsole::RunL()"); |
|
300 } |
262 ProcessKeyPressL(static_cast<TChar>(iConsole->KeyCode())); |
301 ProcessKeyPressL(static_cast<TChar>(iConsole->KeyCode())); |
263 } |
302 } |
264 |
303 |
265 |
304 |
266 void CActiveConsole::RequestCharacter() |
305 void CActiveConsole::RequestCharacter() |
268 // A request is issued to the CConsoleBase to accept a character from the keyboard. |
307 // A request is issued to the CConsoleBase to accept a character from the keyboard. |
269 __ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666)); |
308 __ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666)); |
270 if (!iBufferSizeChosen) |
309 if (!iBufferSizeChosen) |
271 { |
310 { |
272 iConsole->Printf(_L("\n")); |
311 iConsole->Printf(_L("\n")); |
|
312 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER, "\n"); |
273 iConsole->Printf(_L("++++ Choose max. Transfer Size ++++\n")); |
313 iConsole->Printf(_L("++++ Choose max. Transfer Size ++++\n")); |
|
314 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP01, "++++ Choose max. Transfer Size ++++\n"); |
274 iConsole->Printf(_L(" '0' - Set up USB device for USBCV\n")); |
315 iConsole->Printf(_L(" '0' - Set up USB device for USBCV\n")); |
|
316 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP02, " '0' - Set up USB device for USBCV\n"); |
275 iConsole->Printf(_L(" '1' - 32 bytes\n")); |
317 iConsole->Printf(_L(" '1' - 32 bytes\n")); |
|
318 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP03, " '1' - 32 bytes\n"); |
276 iConsole->Printf(_L(" '2' - 1024 bytes\n")); |
319 iConsole->Printf(_L(" '2' - 1024 bytes\n")); |
|
320 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP04, " '2' - 1024 bytes\n"); |
277 iConsole->Printf(_L(" '3' - 64 kbytes\n")); |
321 iConsole->Printf(_L(" '3' - 64 kbytes\n")); |
|
322 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP05, " '3' - 64 kbytes\n"); |
278 iConsole->Printf(_L(" '4' - 1 Mbyte\n")); |
323 iConsole->Printf(_L(" '4' - 1 Mbyte\n")); |
|
324 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP06, " '4' - 1 Mbyte\n"); |
279 } |
325 } |
280 else if (!iBandwidthPriorityChosen) |
326 else if (!iBandwidthPriorityChosen) |
281 { |
327 { |
282 iConsole->Printf(_L("\n")); |
328 iConsole->Printf(_L("\n")); |
|
329 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP07, "\n"); |
283 iConsole->Printf(_L("++++ Choose Bandwidth Priority ++++\n")); |
330 iConsole->Printf(_L("++++ Choose Bandwidth Priority ++++\n")); |
|
331 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP08, "++++ Choose Bandwidth Priority ++++\n"); |
284 iConsole->Printf(_L(" '1' - Economical buffering - default\n")); |
332 iConsole->Printf(_L(" '1' - Economical buffering - default\n")); |
|
333 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP09, " '1' - Economical buffering - default\n"); |
285 iConsole->Printf(_L(" '2' - More memory than default buffering - Plus1\n")); |
334 iConsole->Printf(_L(" '2' - More memory than default buffering - Plus1\n")); |
|
335 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP10, " '2' - More memory than default buffering - Plus1\n"); |
286 iConsole->Printf(_L(" '3' - More memory than Plus1 buffering - Plus2\n")); |
336 iConsole->Printf(_L(" '3' - More memory than Plus1 buffering - Plus2\n")); |
|
337 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP11, " '3' - More memory than Plus1 buffering - Plus2\n"); |
287 iConsole->Printf(_L(" '4' - Maximum buffering\n")); |
338 iConsole->Printf(_L(" '4' - Maximum buffering\n")); |
|
339 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP12, " '4' - Maximum buffering\n"); |
288 } |
340 } |
289 else if (!iDMAChosen) |
341 else if (!iDMAChosen) |
290 { |
342 { |
291 iConsole->Printf(_L("\n")); |
343 iConsole->Printf(_L("\n")); |
|
344 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP13, "\n"); |
292 iConsole->Printf(_L("++++ Choose Endpoint I/O Transfer Mode ++++\n")); |
345 iConsole->Printf(_L("++++ Choose Endpoint I/O Transfer Mode ++++\n")); |
|
346 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP14, "++++ Choose Endpoint I/O Transfer Mode ++++\n"); |
293 iConsole->Printf(_L(" '1' - Interrupt Mode\n")); |
347 iConsole->Printf(_L(" '1' - Interrupt Mode\n")); |
|
348 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP15, " '1' - Interrupt Mode\n"); |
294 iConsole->Printf(_L(" '2' - DMA Mode (recommended)\n")); |
349 iConsole->Printf(_L(" '2' - DMA Mode (recommended)\n")); |
|
350 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP16, " '2' - DMA Mode (recommended\n"); |
295 } |
351 } |
296 else if (!iDoubleBufferingChosen) |
352 else if (!iDoubleBufferingChosen) |
297 { |
353 { |
298 iConsole->Printf(_L("\n")); |
354 iConsole->Printf(_L("\n")); |
|
355 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP17, "\n"); |
299 iConsole->Printf(_L("++++ Choose Endpoint FIFO Mode ++++\n")); |
356 iConsole->Printf(_L("++++ Choose Endpoint FIFO Mode ++++\n")); |
|
357 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP18, "++++ Choose Endpoint FIFO Mode ++++\n"); |
300 iConsole->Printf(_L(" '1' - Normal Buffering Mode\n")); |
358 iConsole->Printf(_L(" '1' - Normal Buffering Mode\n")); |
|
359 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP19, " '1' - Normal Buffering Mode\n"); |
301 iConsole->Printf(_L(" '2' - Double Buffering Mode (recommended)\n")); |
360 iConsole->Printf(_L(" '2' - Double Buffering Mode (recommended)\n")); |
|
361 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP20, " '2' - Double Buffering Mode (recommended\n"); |
302 } |
362 } |
303 else |
363 else |
304 { |
364 { |
305 iConsole->Printf(_L("\n")); |
365 iConsole->Printf(_L("\n")); |
|
366 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP21, "\n"); |
306 iConsole->Printf(_L("++++ Select Program Option ++++\n")); |
367 iConsole->Printf(_L("++++ Select Program Option ++++\n")); |
|
368 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP22, "++++ Select Program Option ++++\n"); |
307 iConsole->Printf(_L(" 'L'oop test\n")); |
369 iConsole->Printf(_L(" 'L'oop test\n")); |
|
370 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP23, " 'L'oop test\n"); |
308 iConsole->Printf(_L(" Loop test with data 'C'ompare\n")); |
371 iConsole->Printf(_L(" Loop test with data 'C'ompare\n")); |
|
372 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP24, " Loop test with data 'C'ompare\n"); |
309 iConsole->Printf(_L(" 'R'eceive-only test (we receive, host transmits)\n")); |
373 iConsole->Printf(_L(" 'R'eceive-only test (we receive, host transmits)\n")); |
|
374 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP25, " 'R'eceive-only test (we receive, host transmits\n"); |
310 iConsole->Printf(_L(" 'T'ransmit-only test\n")); |
375 iConsole->Printf(_L(" 'T'ransmit-only test\n")); |
|
376 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP26, " 'T'ransmit-only test\n"); |
311 iConsole->Printf(_L(" Receive and 'P'ut (write) to File\n")); |
377 iConsole->Printf(_L(" Receive and 'P'ut (write) to File\n")); |
|
378 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP27, " Receive and 'P'ut (writeto File\n"); |
312 iConsole->Printf(_L(" Transmit and 'G'et (read) from File\n")); |
379 iConsole->Printf(_L(" Transmit and 'G'et (read) from File\n")); |
|
380 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP28, " Transmit and 'G'et (readfrom File\n"); |
313 iConsole->Printf(_L(" Signal Remote-'W'akeup to the host\n")); |
381 iConsole->Printf(_L(" Signal Remote-'W'akeup to the host\n")); |
|
382 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP29, " Signal Remote-'W'akeup to the host\n"); |
314 iConsole->Printf(_L(" 'S'top current transfer\n")); |
383 iConsole->Printf(_L(" 'S'top current transfer\n")); |
|
384 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP30, " 'S'top current transfer\n"); |
315 #ifdef WITH_DUMP_OPTION |
385 #ifdef WITH_DUMP_OPTION |
316 iConsole->Printf(_L(" 'D'ump USB regs to debugout\n")); |
386 iConsole->Printf(_L(" 'D'ump USB regs to debugout\n")); |
|
387 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP31, " 'D'ump USB regs to debugout\n"); |
317 #endif |
388 #endif |
318 iConsole->Printf(_L(" Re'E'numerate device\n")); |
389 iConsole->Printf(_L(" Re'E'numerate device\n")); |
|
390 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP32, " Re'E'numerate device\n"); |
319 iConsole->Printf(_L(" 'Q'uit this app\n")); |
391 iConsole->Printf(_L(" 'Q'uit this app\n")); |
|
392 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP33, " 'Q'uit this app\n"); |
320 } |
393 } |
321 iConsole->Read(iStatus); |
394 iConsole->Read(iStatus); |
322 SetActive(); |
395 SetActive(); |
323 } |
396 } |
324 |
397 |
325 |
398 |
326 void CActiveConsole::ProcessKeyPressL(TChar aChar) |
399 void CActiveConsole::ProcessKeyPressL(TChar aChar) |
327 { |
400 { |
328 if (aChar == EKeyEscape) |
401 if (aChar == EKeyEscape) |
329 { |
402 { |
330 RDebug::Print(_L("CActiveConsole: ESC key pressed -> stopping active scheduler...")); |
403 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL, "CActiveConsole: ESC key pressed -> stopping active scheduler..."); |
331 CActiveScheduler::Stop(); |
404 CActiveScheduler::Stop(); |
332 return; |
405 return; |
333 } |
406 } |
334 if (!iBufferSizeChosen) |
407 if (!iBufferSizeChosen) |
335 { |
408 { |
353 case '4': |
426 case '4': |
354 iRW->SetMaxBufSize(KMaxBufSize); |
427 iRW->SetMaxBufSize(KMaxBufSize); |
355 break; |
428 break; |
356 default: |
429 default: |
357 TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint()); |
430 TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint()); |
|
431 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP01, "Not a valid input character: %c", aChar.operator TUint()); |
358 goto request_char; |
432 goto request_char; |
359 } |
433 } |
360 TUSB_PRINT1("Maximum buffer size set to %d bytes", iRW->MaxBufSize()); |
434 TUSB_PRINT1("Maximum buffer size set to %d bytes", iRW->MaxBufSize()); |
|
435 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP02, "Maximum buffer size set to %d bytes", iRW->MaxBufSize()); |
361 iBufferSizeChosen = ETrue; |
436 iBufferSizeChosen = ETrue; |
362 } |
437 } |
363 else if (!iBandwidthPriorityChosen) |
438 else if (!iBandwidthPriorityChosen) |
364 { |
439 { |
365 // Set bandwidth priority from keypress |
440 // Set bandwidth priority from keypress |
366 switch (aChar) |
441 switch (aChar) |
367 { |
442 { |
368 case '1': |
443 case '1': |
369 iBandwidthPriority = EUsbcBandwidthOUTDefault | EUsbcBandwidthINDefault; |
444 iBandwidthPriority = EUsbcBandwidthOUTDefault | EUsbcBandwidthINDefault; |
370 TUSB_PRINT("Bandwith priority set to default"); |
445 TUSB_PRINT("Bandwith priority set to default"); |
|
446 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP03, "Bandwith priority set to default"); |
371 break; |
447 break; |
372 case '2': |
448 case '2': |
373 iBandwidthPriority = EUsbcBandwidthOUTPlus1 | EUsbcBandwidthINPlus1; |
449 iBandwidthPriority = EUsbcBandwidthOUTPlus1 | EUsbcBandwidthINPlus1; |
374 TUSB_PRINT("Bandwith priority set to Plus1"); |
450 TUSB_PRINT("Bandwith priority set to Plus1"); |
|
451 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP04, "Bandwith priority set to Plus1"); |
375 break; |
452 break; |
376 case '3': |
453 case '3': |
377 iBandwidthPriority = EUsbcBandwidthOUTPlus2 | EUsbcBandwidthINPlus2; |
454 iBandwidthPriority = EUsbcBandwidthOUTPlus2 | EUsbcBandwidthINPlus2; |
378 TUSB_PRINT("Bandwith priority set to Plus2"); |
455 TUSB_PRINT("Bandwith priority set to Plus2"); |
|
456 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP05, "Bandwith priority set to Plus2"); |
379 break; |
457 break; |
380 case '4': |
458 case '4': |
381 iBandwidthPriority = EUsbcBandwidthINMaximum | EUsbcBandwidthOUTMaximum; |
459 iBandwidthPriority = EUsbcBandwidthINMaximum | EUsbcBandwidthOUTMaximum; |
382 TUSB_PRINT("Bandwith priority set to maximum"); |
460 TUSB_PRINT("Bandwith priority set to maximum"); |
|
461 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP06, "Bandwith priority set to maximum"); |
383 break; |
462 break; |
384 default: |
463 default: |
385 TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint()); |
464 TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint()); |
|
465 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP07, "Not a valid input character: %c", aChar.operator TUint()); |
386 goto request_char; |
466 goto request_char; |
387 } |
467 } |
388 TUSB_PRINT1("(Set to 0x%08X)", iBandwidthPriority); |
468 TUSB_PRINT1("(Set to 0x%08X)", iBandwidthPriority); |
|
469 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP08, "(Set to 0x%08X)", iBandwidthPriority); |
389 iBandwidthPriorityChosen = ETrue; |
470 iBandwidthPriorityChosen = ETrue; |
390 |
471 |
391 if (!iResourceAllocationV2) |
472 if (!iResourceAllocationV2) |
392 { |
473 { |
393 TUSB_PRINT("Configuring interface..."); |
474 TUSB_PRINT("Configuring interface..."); |
|
475 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP09, "Configuring interface..."); |
394 TInt r = SetupInterface(); |
476 TInt r = SetupInterface(); |
395 if (r != KErrNone) |
477 if (r != KErrNone) |
396 { |
478 { |
397 TUSB_PRINT1("Error: %d. Stopping active scheduler...", r); |
479 TUSB_PRINT1("Error: %d. Stopping active scheduler...", r); |
|
480 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP10, "Error: %d. Stopping active scheduler...", r); |
398 CActiveScheduler::Stop(); |
481 CActiveScheduler::Stop(); |
399 return; |
482 return; |
400 } |
483 } |
401 } |
484 } |
402 } |
485 } |
450 break; |
537 break; |
451 } |
538 } |
452 case '2': |
539 case '2': |
453 { |
540 { |
454 TUSB_PRINT("- Trying to allocate Double Buffering:\n"); |
541 TUSB_PRINT("- Trying to allocate Double Buffering:\n"); |
|
542 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP15, "- Trying to allocate Double Buffering:\n"); |
455 if (!iResourceAllocationV2) |
543 if (!iResourceAllocationV2) |
456 { |
544 { |
457 AllocateDoubleBuffering(EEndpoint1); |
545 AllocateDoubleBuffering(EEndpoint1); |
458 AllocateDoubleBuffering(EEndpoint2); |
546 AllocateDoubleBuffering(EEndpoint2); |
459 } |
547 } |
460 iAllocateDoubleBuffering = ETrue; |
548 iAllocateDoubleBuffering = ETrue; |
461 break; |
549 break; |
462 } |
550 } |
463 default: |
551 default: |
464 TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint()); |
552 TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint()); |
|
553 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP16, "Not a valid input character: %c", aChar.operator TUint()); |
465 goto request_char; |
554 goto request_char; |
466 } |
555 } |
467 iDoubleBufferingChosen = ETrue; |
556 iDoubleBufferingChosen = ETrue; |
468 |
557 |
469 if (iResourceAllocationV2) |
558 if (iResourceAllocationV2) |
470 { |
559 { |
471 TUSB_PRINT("Configuring interface..."); |
560 TUSB_PRINT("Configuring interface..."); |
|
561 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP17, "Configuring interface..."); |
472 TInt r = SetupInterface(); |
562 TInt r = SetupInterface(); |
473 if (r != KErrNone) |
563 if (r != KErrNone) |
474 { |
564 { |
475 TUSB_PRINT1("Error: %d. Stopping active scheduler...", r); |
565 TUSB_PRINT1("Error: %d. Stopping active scheduler...", r); |
|
566 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP18, "Error: %d. Stopping active scheduler...", r); |
476 CActiveScheduler::Stop(); |
567 CActiveScheduler::Stop(); |
477 return; |
568 return; |
478 } |
569 } |
479 } |
570 } |
480 |
571 |
481 // Everything chosen, so let's re-enumerate... |
572 // Everything chosen, so let's re-enumerate... |
482 TUSB_PRINT("Enumeration..."); |
573 TUSB_PRINT("Enumeration..."); |
|
574 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP19, "Enumeration..."); |
483 TInt r = ReEnumerate(); |
575 TInt r = ReEnumerate(); |
484 if (r != KErrNone) |
576 if (r != KErrNone) |
485 { |
577 { |
486 TUSB_PRINT1("Error: %d. Stopping active scheduler...", r); |
578 TUSB_PRINT1("Error: %d. Stopping active scheduler...", r); |
|
579 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP20, "Error: %d. Stopping active scheduler...", r); |
487 CActiveScheduler::Stop(); |
580 CActiveScheduler::Stop(); |
488 return; |
581 return; |
489 } |
582 } |
490 TUSB_PRINT("Device successfully re-enumerated\n"); |
583 TUSB_PRINT("Device successfully re-enumerated\n"); |
|
584 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP21, "Device successfully re-enumerated\n"); |
491 |
585 |
492 // Make sure program versions match if testing against USBRFLCT |
586 // Make sure program versions match if testing against USBRFLCT |
493 if (iRW->MaxBufSize() != 0) |
587 if (iRW->MaxBufSize() != 0) |
494 { |
588 { |
495 r = iRW->ExchangeVersions(); |
589 r = iRW->ExchangeVersions(); |
496 if (r != KErrNone) |
590 if (r != KErrNone) |
497 { |
591 { |
498 TUSB_PRINT1("Error: %d. Stopping active scheduler...", r); |
592 TUSB_PRINT1("Error: %d. Stopping active scheduler...", r); |
|
593 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP22, "Error: %d. Stopping active scheduler...", r); |
499 CActiveScheduler::Stop(); |
594 CActiveScheduler::Stop(); |
500 return; |
595 return; |
501 } |
596 } |
502 } |
597 } |
503 } |
598 } |
507 switch (aChar) |
602 switch (aChar) |
508 { |
603 { |
509 case 'l': // start loop test |
604 case 'l': // start loop test |
510 case 'L': |
605 case 'L': |
511 TUSB_PRINT("-> Loop test selected\n"); |
606 TUSB_PRINT("-> Loop test selected\n"); |
|
607 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP23, "-> Loop test selected\n"); |
512 iRW->SetTransferMode(ELoop); |
608 iRW->SetTransferMode(ELoop); |
513 iRW->SendPreamble(); |
609 iRW->SendPreamble(); |
514 break; |
610 break; |
515 case 'c': // start loop/compare test |
611 case 'c': // start loop/compare test |
516 case 'C': |
612 case 'C': |
517 TUSB_PRINT("-> Loop test with compare selected\n"); |
613 TUSB_PRINT("-> Loop test with compare selected\n"); |
|
614 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP24, "-> Loop test with compare selected\n"); |
518 iRW->SetTransferMode(ELoopComp); |
615 iRW->SetTransferMode(ELoopComp); |
519 iRW->SendPreamble(); |
616 iRW->SendPreamble(); |
520 break; |
617 break; |
521 case 'r': // start receive-only test |
618 case 'r': // start receive-only test |
522 case 'R': |
619 case 'R': |
523 TUSB_PRINT("-> Receive-only test selected\n"); |
620 TUSB_PRINT("-> Receive-only test selected\n"); |
|
621 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP25, "-> Receive-only test selected\n"); |
524 iRW->SetTransferMode(EReceiveOnly); |
622 iRW->SetTransferMode(EReceiveOnly); |
525 iRW->SendPreamble(); |
623 iRW->SendPreamble(); |
526 break; |
624 break; |
527 case 't': // start transmit-only test |
625 case 't': // start transmit-only test |
528 case 'T': |
626 case 'T': |
529 TUSB_PRINT("-> Transmit-only test selected\n"); |
627 TUSB_PRINT("-> Transmit-only test selected\n"); |
|
628 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP26, "-> Transmit-only test selected\n"); |
530 iRW->SetTransferMode(ETransmitOnly); |
629 iRW->SetTransferMode(ETransmitOnly); |
531 iRW->SendPreamble(); |
630 iRW->SendPreamble(); |
532 break; |
631 break; |
533 case 'g': // start transmit & get-from-file test |
632 case 'g': // start transmit & get-from-file test |
534 case 'G': |
633 case 'G': |
535 TUSB_PRINT("-> Transmit from file test selected\n"); |
634 TUSB_PRINT("-> Transmit from file test selected\n"); |
|
635 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP27, "-> Transmit from file test selected\n"); |
536 iRW->SetTransferMode(ETransmitOnly); |
636 iRW->SetTransferMode(ETransmitOnly); |
537 iRW->ReadFromDisk(ETrue); |
637 iRW->ReadFromDisk(ETrue); |
538 iRW->SendPreamble(); |
638 iRW->SendPreamble(); |
539 break; |
639 break; |
540 case 'p': // start receive & put-to-file test |
640 case 'p': // start receive & put-to-file test |
541 case 'P': |
641 case 'P': |
542 TUSB_PRINT("-> Receive to file test selected\n"); |
642 TUSB_PRINT("-> Receive to file test selected\n"); |
|
643 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP28, "-> Receive to file test selected\n"); |
543 iRW->SetTransferMode(EReceiveOnly); |
644 iRW->SetTransferMode(EReceiveOnly); |
544 iRW->WriteToDisk(ETrue); |
645 iRW->WriteToDisk(ETrue); |
545 iRW->SendPreamble(); |
646 iRW->SendPreamble(); |
546 break; |
647 break; |
547 case 'w': // remote-wakeup |
648 case 'w': // remote-wakeup |
548 case 'W': |
649 case 'W': |
549 TUSB_PRINT("-> Signal Remote-wakeup selected\n"); |
650 TUSB_PRINT("-> Signal Remote-wakeup selected\n"); |
|
651 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP29, "-> Signal Remote-wakeup selected\n"); |
550 iPort.SignalRemoteWakeup(); |
652 iPort.SignalRemoteWakeup(); |
551 break; |
653 break; |
552 case 's': // stop either |
654 case 's': // stop either |
553 case 'S': |
655 case 'S': |
554 TUSB_PRINT("-> Stop transfer selected\n"); |
656 TUSB_PRINT("-> Stop transfer selected\n"); |
|
657 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP30, "-> Stop transfer selected\n"); |
555 iRW->Stop(); |
658 iRW->Stop(); |
556 break; |
659 break; |
557 #ifdef WITH_DUMP_OPTION |
660 #ifdef WITH_DUMP_OPTION |
558 case 'd': // dump controller registers |
661 case 'd': // dump controller registers |
559 case 'D': |
662 case 'D': |
560 TUSB_PRINT("-> Dump option selected\n"); |
663 TUSB_PRINT("-> Dump option selected\n"); |
|
664 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP31, "-> Dump option selected\n"); |
561 iPort.DumpRegisters(); |
665 iPort.DumpRegisters(); |
562 QueryRxBuffer(); |
666 QueryRxBuffer(); |
563 break; |
667 break; |
564 #endif |
668 #endif |
565 case 'e': // ReEnumerate() |
669 case 'e': // ReEnumerate() |
566 case 'E': |
670 case 'E': |
567 TUSB_PRINT("-> Re-enumerate device selected\n"); |
671 TUSB_PRINT("-> Re-enumerate device selected\n"); |
|
672 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP32, "-> Re-enumerate device selected\n"); |
568 ReEnumerate(); |
673 ReEnumerate(); |
569 break; |
674 break; |
570 case 'q': // quit |
675 case 'q': // quit |
571 case 'Q': |
676 case 'Q': |
572 TUSB_PRINT("-> Quit program selected\n"); |
677 TUSB_PRINT("-> Quit program selected\n"); |
|
678 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP33, "-> Quit program selected\n"); |
573 TUSB_VERBOSE_PRINT("CActiveConsole: stopping active scheduler..."); |
679 TUSB_VERBOSE_PRINT("CActiveConsole: stopping active scheduler..."); |
|
680 if(iVerbose) |
|
681 { |
|
682 OstTrace0(TRACE_VERBOSE, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP34, "CActiveConsole: stopping active scheduler..."); |
|
683 } |
574 CActiveScheduler::Stop(); |
684 CActiveScheduler::Stop(); |
575 return; |
685 return; |
576 default: |
686 default: |
577 TUSB_PRINT1("-> Not a valid input character: %c", aChar.operator TUint()); |
687 TUSB_PRINT1("-> Not a valid input character: %c", aChar.operator TUint()); |
|
688 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP35, "-> Not a valid input character: %c", aChar.operator TUint()); |
578 goto request_char; |
689 goto request_char; |
579 } |
690 } |
580 } |
691 } |
581 request_char: |
692 request_char: |
582 RequestCharacter(); |
693 RequestCharacter(); |
635 TUsbDeviceCaps d_caps; |
746 TUsbDeviceCaps d_caps; |
636 TInt r = iPort.DeviceCaps(d_caps); |
747 TInt r = iPort.DeviceCaps(d_caps); |
637 if (r != KErrNone) |
748 if (r != KErrNone) |
638 { |
749 { |
639 TUSB_PRINT1("Error %d on querying device capabilities", r); |
750 TUSB_PRINT1("Error %d on querying device capabilities", r); |
|
751 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL, "Error %d on querying device capabilities", r); |
640 return KErrGeneral; |
752 return KErrGeneral; |
641 } |
753 } |
642 const TInt n = d_caps().iTotalEndpoints; |
754 const TInt n = d_caps().iTotalEndpoints; |
643 |
755 |
644 TUSB_PRINT("### USB device capabilities:"); |
756 TUSB_PRINT("### USB device capabilities:"); |
|
757 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP01, "### USB device capabilities:"); |
645 TUSB_PRINT1("Number of endpoints: %d", n); |
758 TUSB_PRINT1("Number of endpoints: %d", n); |
|
759 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP02, "Number of endpoints: %d", n); |
646 TUSB_PRINT1("Supports Software-Connect: %s", |
760 TUSB_PRINT1("Supports Software-Connect: %s", |
647 d_caps().iConnect ? _S("yes") : _S("no")); |
761 d_caps().iConnect ? _S("yes") : _S("no")); |
|
762 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP03, "Supports Software-Connect: %s", |
|
763 d_caps().iConnect ? _L("yes") : _L("no")); |
648 TUSB_PRINT1("Device is Self-Powered: %s", |
764 TUSB_PRINT1("Device is Self-Powered: %s", |
649 d_caps().iSelfPowered ? _S("yes") : _S("no")); |
765 d_caps().iSelfPowered ? _S("yes") : _S("no")); |
|
766 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP04, "Device is Self-Powered: %s", |
|
767 d_caps().iSelfPowered ? _L("yes") : _L("no")); |
650 TUSB_PRINT1("Supports Remote-Wakeup: %s", |
768 TUSB_PRINT1("Supports Remote-Wakeup: %s", |
651 d_caps().iRemoteWakeup ? _S("yes") : _S("no")); |
769 d_caps().iRemoteWakeup ? _S("yes") : _S("no")); |
|
770 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP05, "Supports Remote-Wakeup: %s", |
|
771 d_caps().iRemoteWakeup ? _L("yes") : _L("no")); |
652 TUSB_PRINT1("Supports High-speed: %s", |
772 TUSB_PRINT1("Supports High-speed: %s", |
653 d_caps().iHighSpeed ? _S("yes") : _S("no")); |
773 d_caps().iHighSpeed ? _S("yes") : _S("no")); |
|
774 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP06, "Supports High-speed: %s", |
|
775 d_caps().iHighSpeed ? _L("yes") : _L("no")); |
654 TUSB_PRINT1("Supports OTG: %s", |
776 TUSB_PRINT1("Supports OTG: %s", |
655 iOtg ? _S("yes") : _S("no")); |
777 iOtg ? _S("yes") : _S("no")); |
|
778 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP07, "Supports OTG: %s", |
|
779 iOtg ? _L("yes") : _L("no")); |
656 TUSB_PRINT1("Supports unpowered cable detection: %s", |
780 TUSB_PRINT1("Supports unpowered cable detection: %s", |
657 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? |
781 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? |
658 _S("yes") : _S("no")); |
782 _S("yes") : _S("no")); |
|
783 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP08, "Supports unpowered cable detection: %s", |
|
784 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? |
|
785 _L("yes") : _L("no")); |
659 TUSB_PRINT1("Supports endpoint resource alloc scheme V2: %s\n", |
786 TUSB_PRINT1("Supports endpoint resource alloc scheme V2: %s\n", |
660 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ? |
787 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ? |
661 _S("yes") : _S("no")); |
788 _S("yes") : _S("no")); |
|
789 OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP09, "Supports endpoint resource alloc scheme V2: %s\n", |
|
790 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ? |
|
791 _L("yes") : _L("no")); |
662 TUSB_PRINT(""); |
792 TUSB_PRINT(""); |
|
793 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP10, ""); |
663 |
794 |
664 iSoftwareConnect = d_caps().iConnect; // we need to remember this |
795 iSoftwareConnect = d_caps().iConnect; // we need to remember this |
665 |
796 |
666 if (n < 2) |
797 if (n < 2) |
667 { |
798 { |
668 TUSB_PRINT1("Error: only %d endpoints available on device", n); |
799 TUSB_PRINT1("Error: only %d endpoints available on device", n); |
|
800 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP11, "Error: only %d endpoints available on device", n); |
669 return KErrGeneral; |
801 return KErrGeneral; |
670 } |
802 } |
671 |
803 |
672 // Endpoints |
804 // Endpoints |
673 TUsbcEndpointData data[KUsbcMaxEndpoints]; |
805 TUsbcEndpointData data[KUsbcMaxEndpoints]; |
674 TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
806 TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
675 r = iPort.EndpointCaps(dataptr); |
807 r = iPort.EndpointCaps(dataptr); |
676 if (r != KErrNone) |
808 if (r != KErrNone) |
677 { |
809 { |
678 TUSB_PRINT1("Error %d on querying endpoint capabilities", r); |
810 TUSB_PRINT1("Error %d on querying endpoint capabilities", r); |
|
811 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP12, "Error %d on querying endpoint capabilities", r); |
679 return KErrGeneral; |
812 return KErrGeneral; |
680 } |
813 } |
681 TUSB_PRINT("### USB device endpoint capabilities:"); |
814 TUSB_PRINT("### USB device endpoint capabilities:"); |
|
815 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP13, "### USB device endpoint capabilities:"); |
682 for (TInt i = 0; i < n; i++) |
816 for (TInt i = 0; i < n; i++) |
683 { |
817 { |
684 const TUsbcEndpointCaps* caps = &data[i].iCaps; |
818 const TUsbcEndpointCaps* caps = &data[i].iCaps; |
685 TUSB_PRINT2("Endpoint: SizeMask = 0x%08x TypeDirMask = 0x%08x", |
819 TUSB_PRINT2("Endpoint: SizeMask = 0x%08x TypeDirMask = 0x%08x", |
686 caps->iSizes, caps->iTypesAndDir); |
820 caps->iSizes, caps->iTypesAndDir); |
|
821 OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP14, "Endpoint: SizeMask = 0x%08x TypeDirMask = 0x%08x", |
|
822 caps->iSizes, caps->iTypesAndDir); |
687 } |
823 } |
688 TUSB_PRINT(""); |
824 TUSB_PRINT(""); |
|
825 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP15, ""); |
689 |
826 |
690 // Set up the active interface |
827 // Set up the active interface |
691 TUsbcInterfaceInfoBuf ifc; |
828 TUsbcInterfaceInfoBuf ifc; |
692 TInt ep_found = 0; |
829 TInt ep_found = 0; |
693 TBool foundBulkIN = EFalse; |
830 TBool foundBulkIN = EFalse; |
848 ifc().iFeatureWord |= KUsbcInterfaceInfo_NoEp0RequestsPlease; |
991 ifc().iFeatureWord |= KUsbcInterfaceInfo_NoEp0RequestsPlease; |
849 r = iPort.SetInterface(1, ifc); |
992 r = iPort.SetInterface(1, ifc); |
850 if (r != KErrNone) |
993 if (r != KErrNone) |
851 { |
994 { |
852 TUSB_PRINT1("Error %d on setting alternate interface", r); |
995 TUSB_PRINT1("Error %d on setting alternate interface", r); |
|
996 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP22, "Error %d on setting alternate interface", r); |
853 } |
997 } |
854 |
998 |
855 return r; |
999 return r; |
856 } |
1000 } |
857 |
1001 |
858 |
1002 |
859 void CActiveConsole::AllocateEndpointDMA(TEndpointNumber aEndpoint) |
1003 void CActiveConsole::AllocateEndpointDMA(TEndpointNumber aEndpoint) |
860 { |
1004 { |
861 TInt r = iPort.AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
1005 TInt r = iPort.AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
862 if (r == KErrNone) |
1006 if (r == KErrNone) |
863 RDebug::Print(_L("DMA allocation on endpoint %d: KErrNone"), aEndpoint); |
1007 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA, "DMA allocation on endpoint %d: KErrNone", aEndpoint); |
864 else if (r == KErrInUse) |
1008 else if (r == KErrInUse) |
865 RDebug::Print(_L("DMA allocation on endpoint %d: KErrInUse"), aEndpoint); |
1009 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP01, "DMA allocation on endpoint %d: KErrInUse", aEndpoint); |
866 else if (r == KErrNotSupported) |
1010 else if (r == KErrNotSupported) |
867 RDebug::Print(_L("DMA allocation on endpoint %d: KErrNotSupported"), aEndpoint); |
1011 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP02, "DMA allocation on endpoint %d: KErrNotSupported", aEndpoint); |
868 else |
1012 else |
869 RDebug::Print(_L("DMA allocation on endpoint %d: unexpected return value %d"), |
1013 OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP03, "DMA allocation on endpoint %d: unexpected return value %d", |
870 aEndpoint, r); |
1014 aEndpoint, r); |
871 TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1015 TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
872 TUSB_PRINT2("DMA on endpoint %d %s\n", |
1016 TUSB_PRINT2("DMA on endpoint %d %s\n", |
873 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1017 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
|
1018 OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP04, "DMA on endpoint %d %s\n", |
|
1019 aEndpoint, res ? _L("allocated") : _L("not allocated")); |
874 |
1020 |
875 if ((r == KErrNone) && !res) |
1021 if ((r == KErrNone) && !res) |
876 RDebug::Print(_L("(Allocation success but negative query result: contradiction!)\n")); |
1022 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP05, "(Allocation success but negative query result: contradiction!)\n"); |
877 else if ((r != KErrNone) && res) |
1023 else if ((r != KErrNone) && res) |
878 RDebug::Print(_L("(Allocation failure but positive query result: contradiction!)\n")); |
1024 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP06, "(Allocation failure but positive query result: contradiction!)\n"); |
879 } |
1025 } |
880 |
1026 |
881 |
1027 |
882 void CActiveConsole::DeAllocateEndpointDMA(TEndpointNumber aEndpoint) |
1028 void CActiveConsole::DeAllocateEndpointDMA(TEndpointNumber aEndpoint) |
883 { |
1029 { |
884 TInt r = iPort.DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
1030 TInt r = iPort.DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
885 if (r == KErrNone) |
1031 if (r == KErrNone) |
886 RDebug::Print(_L("DMA deallocation on endpoint %d: KErrNone"), aEndpoint); |
1032 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEENDPOINTDMA, "DMA deallocation on endpoint %d: KErrNone", aEndpoint); |
887 else if (r == KErrNotSupported) |
1033 else if (r == KErrNotSupported) |
888 RDebug::Print(_L("DMA deallocation on endpoint %d: KErrNotSupported"), aEndpoint); |
1034 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEENDPOINTDMA_DUP01, "DMA deallocation on endpoint %d: KErrNotSupported", aEndpoint); |
889 else |
1035 else |
890 RDebug::Print(_L("DMA deallocation on endpoint %d: unexpected return value %d"), |
1036 OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEENDPOINTDMA_DUP02, "DMA deallocation on endpoint %d: unexpected return value %d", |
891 aEndpoint, r); |
1037 aEndpoint, r); |
892 TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1038 TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
893 TUSB_PRINT2("DMA on endpoint %d %s\n", |
1039 TUSB_PRINT2("DMA on endpoint %d %s\n", |
894 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1040 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
|
1041 OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEENDPOINTDMA_DUP03, "DMA on endpoint %d %s\n", |
|
1042 aEndpoint, res ? _L("allocated") : _L("not allocated")); |
895 } |
1043 } |
896 |
1044 |
897 |
1045 |
898 void CActiveConsole::AllocateDoubleBuffering(TEndpointNumber aEndpoint) |
1046 void CActiveConsole::AllocateDoubleBuffering(TEndpointNumber aEndpoint) |
899 { |
1047 { |
900 TInt r = iPort.AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1048 TInt r = iPort.AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
901 if (r == KErrNone) |
1049 if (r == KErrNone) |
902 RDebug::Print(_L("Double Buffering allocation on endpoint %d: KErrNone"), aEndpoint); |
1050 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING, "Double Buffering allocation on endpoint %d: KErrNone", aEndpoint); |
903 else if (r == KErrInUse) |
1051 else if (r == KErrInUse) |
904 RDebug::Print(_L("Double Buffering allocation on endpoint %d: KErrInUse"), aEndpoint); |
1052 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP01, "Double Buffering allocation on endpoint %d: KErrInUse", aEndpoint); |
905 else if (r == KErrNotSupported) |
1053 else if (r == KErrNotSupported) |
906 RDebug::Print(_L("Double Buffering allocation on endpoint %d: KErrNotSupported"), aEndpoint); |
1054 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP02, "Double Buffering allocation on endpoint %d: KErrNotSupported", aEndpoint); |
907 else |
1055 else |
908 RDebug::Print(_L("Double Buffering allocation on endpoint %d: unexpected return value %d"), |
1056 OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP03, "Double Buffering allocation on endpoint %d: unexpected return value %d", |
909 aEndpoint, r); |
1057 aEndpoint, r); |
910 TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1058 TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
911 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1059 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
912 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1060 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
|
1061 OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP04, "Double Buffering on endpoint %d %s\n", |
|
1062 aEndpoint, res ? _L("allocated") : _L("not allocated")); |
913 |
1063 |
914 if ((r == KErrNone) && !res) |
1064 if ((r == KErrNone) && !res) |
915 RDebug::Print(_L("(Allocation success but negative query result: contradiction!)\n")); |
1065 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP05, "(Allocation success but negative query result: contradiction!)\n"); |
916 else if ((r != KErrNone) && res) |
1066 else if ((r != KErrNone) && res) |
917 RDebug::Print(_L("(Allocation failure but positive query result: contradiction!)\n")); |
1067 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP06, "(Allocation failure but positive query result: contradiction!)\n"); |
918 } |
1068 } |
919 |
1069 |
920 |
1070 |
921 void CActiveConsole::DeAllocateDoubleBuffering(TEndpointNumber aEndpoint) |
1071 void CActiveConsole::DeAllocateDoubleBuffering(TEndpointNumber aEndpoint) |
922 { |
1072 { |
923 TInt r = iPort.DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1073 TInt r = iPort.DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
924 if (r == KErrNone) |
1074 if (r == KErrNone) |
925 RDebug::Print(_L("Double Buffering deallocation on endpoint %d: KErrNone"), aEndpoint); |
1075 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEDOUBLEBUFFERING, "Double Buffering deallocation on endpoint %d: KErrNone", aEndpoint); |
926 else if (r == KErrNotSupported) |
1076 else if (r == KErrNotSupported) |
927 RDebug::Print(_L("Double Buffering deallocation on endpoint %d: KErrNotSupported"), aEndpoint); |
1077 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEDOUBLEBUFFERING_DUP01, "Double Buffering deallocation on endpoint %d: KErrNotSupported", aEndpoint); |
928 else |
1078 else |
929 RDebug::Print(_L("Double Buffering deallocation on endpoint %d: unexpected return value %d"), |
1079 OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEDOUBLEBUFFERING_DUP02, "Double Buffering deallocation on endpoint %d: unexpected return value %d", |
930 aEndpoint, r); |
1080 aEndpoint, r); |
931 TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1081 TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
932 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1082 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
933 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1083 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
|
1084 OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEDOUBLEBUFFERING_DUP03, "Double Buffering on endpoint %d %s\n", |
|
1085 aEndpoint, res ? _L("allocated") : _L("not allocated")); |
934 } |
1086 } |
935 |
1087 |
936 |
1088 |
937 TInt CActiveConsole::ReEnumerate() |
1089 TInt CActiveConsole::ReEnumerate() |
938 { |
1090 { |
939 TRequestStatus enum_status; |
1091 TRequestStatus enum_status; |
940 iPort.ReEnumerate(enum_status); |
1092 iPort.ReEnumerate(enum_status); |
941 if (!iSoftwareConnect) |
1093 if (!iSoftwareConnect) |
942 { |
1094 { |
943 iConsole->Printf(_L("This device does not support software\n")); |
1095 iConsole->Printf(_L("This device does not support software\n")); |
|
1096 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE, "This device does not support software\n"); |
944 iConsole->Printf(_L("disconnect/reconnect\n")); |
1097 iConsole->Printf(_L("disconnect/reconnect\n")); |
|
1098 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP01, "disconnect/reconnect\n"); |
945 iConsole->Printf(_L("Please physically unplug and replug\n")); |
1099 iConsole->Printf(_L("Please physically unplug and replug\n")); |
|
1100 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP02, "Please physically unplug and replug\n"); |
946 iConsole->Printf(_L("the USB cable NOW... ")); |
1101 iConsole->Printf(_L("the USB cable NOW... ")); |
|
1102 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP03, "the USB cable NOW... "); |
947 } |
1103 } |
948 iConsole->Printf(_L("\n>>> START THE USBRFLCT PROGRAM ON THE HOST SIDE NOW <<<\n")); |
1104 iConsole->Printf(_L("\n>>> START THE USBRFLCT PROGRAM ON THE HOST SIDE NOW <<<\n")); |
|
1105 OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP04, "\n>>> START THE USBRFLCT PROGRAM ON THE HOST SIDE NOW <<<\n"); |
949 User::WaitForRequest(enum_status); |
1106 User::WaitForRequest(enum_status); |
950 if (enum_status != KErrNone) |
1107 if (enum_status != KErrNone) |
951 { |
1108 { |
952 TUSB_PRINT1("Error: Re-enumeration status = %d", enum_status.Int()); |
1109 TUSB_PRINT1("Error: Re-enumeration status = %d", enum_status.Int()); |
|
1110 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP05, "Error: Re-enumeration status = %d", enum_status.Int()); |
953 return KErrGeneral; |
1111 return KErrGeneral; |
954 } |
1112 } |
955 TUsbcDeviceState device_state = EUsbcDeviceStateUndefined; |
1113 TUsbcDeviceState device_state = EUsbcDeviceStateUndefined; |
956 TInt r = iPort.DeviceStatus(device_state); |
1114 TInt r = iPort.DeviceStatus(device_state); |
957 if (r != KErrNone) |
1115 if (r != KErrNone) |
958 { |
1116 { |
959 TUSB_PRINT1("Error %d on querying device state", r); |
1117 TUSB_PRINT1("Error %d on querying device state", r); |
|
1118 OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP06, "Error %d on querying device state", r); |
960 } |
1119 } |
961 else |
1120 else |
962 { |
1121 { |
963 TUSB_PRINT1("Current device state: %s", |
1122 TUSB_PRINT1("Current device state: %s", |
964 (device_state == EUsbcDeviceStateUndefined) ? _S("Undefined") : |
1123 (device_state == EUsbcDeviceStateUndefined) ? _S("Undefined") : |
1220 { |
1416 { |
1221 const TUint32 num = *reinterpret_cast<const TUint32*>(iReadBuf.Ptr()); |
1417 const TUint32 num = *reinterpret_cast<const TUint32*>(iReadBuf.Ptr()); |
1222 if (num != ++iPktNum) |
1418 if (num != ++iPktNum) |
1223 { |
1419 { |
1224 TUSB_PRINT2("*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum); |
1420 TUSB_PRINT2("*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum); |
|
1421 OstTraceExt2(TRACE_NORMAL, CACTIVERW_RUNL_DUP03, "*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum); |
1225 // Update the packet number with the received number, so that |
1422 // Update the packet number with the received number, so that |
1226 // if a single packet is duplicated or lost then a single error occurs |
1423 // if a single packet is duplicated or lost then a single error occurs |
1227 iPktNum = num; |
1424 iPktNum = num; |
1228 } |
1425 } |
1229 if (iDiskAccessEnabled) |
1426 if (iDiskAccessEnabled) |
1230 { |
1427 { |
1231 // Write out to disk previous completed Read |
1428 // Write out to disk previous completed Read |
1232 TUSB_VERBOSE_PRINT2("iMaxBufSz = %d (iReadBuf.Size(): %d)", |
1429 TUSB_VERBOSE_PRINT2("iMaxBufSz = %d (iReadBuf.Size(): %d)", |
1233 iMaxBufSz, iReadBuf.Size()); |
1430 iMaxBufSz, iReadBuf.Size()); |
|
1431 if(iVerbose) |
|
1432 { |
|
1433 OstTraceExt2(TRACE_VERBOSE, CACTIVERW_RUNL_DUP04, "iMaxBufSz = %d (iReadBuf.Size(): %d)", |
|
1434 iMaxBufSz, iReadBuf.Size()); |
|
1435 } |
1234 WriteBufferToDisk(iReadBuf, iMaxBufSz); |
1436 WriteBufferToDisk(iReadBuf, iMaxBufSz); |
1235 } |
1437 } |
1236 ReadData(); // next we read data |
1438 ReadData(); // next we read data |
1237 break; |
1439 break; |
1238 } |
1440 } |
1239 if (iXferMode == ELoopComp) |
1441 if (iXferMode == ELoopComp) |
1240 { |
1442 { |
1241 if (!CompareBuffers(iBufSz)) |
1443 if (!CompareBuffers(iBufSz)) |
1242 { |
1444 { |
1243 TUSB_PRINT1("Error while comparing tx & rx buffers for packet 0x%x", iPktNum); |
1445 TUSB_PRINT1("Error while comparing tx & rx buffers for packet 0x%x", iPktNum); |
|
1446 OstTrace1(TRACE_NORMAL, CACTIVERW_RUNL_DUP05, "Error while comparing tx & rx buffers for packet 0x%x", iPktNum); |
1244 } |
1447 } |
1245 } |
1448 } |
1246 else if (iBufSz > 3) |
1449 else if (iBufSz > 3) |
1247 { |
1450 { |
1248 const TUint32 num = *reinterpret_cast<const TUint32*>(iReadBuf.Ptr()); |
1451 const TUint32 num = *reinterpret_cast<const TUint32*>(iReadBuf.Ptr()); |
1249 if (num != iPktNum) |
1452 if (num != iPktNum) |
1250 { |
1453 { |
1251 TUSB_PRINT2("*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum); |
1454 TUSB_PRINT2("*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum); |
|
1455 OstTraceExt2(TRACE_NORMAL, CACTIVERW_RUNL_DUP06, "*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum); |
1252 } |
1456 } |
1253 } |
1457 } |
1254 if (iBufSz == iMaxBufSz) |
1458 if (iBufSz == iMaxBufSz) |
1255 { |
1459 { |
1256 iBufSz = KInitialBufSz; |
1460 iBufSz = KInitialBufSz; |
1290 iPreambleBuf[6] = 'r'; |
1501 iPreambleBuf[6] = 'r'; |
1291 iPreambleBuf[7] = 's'; |
1502 iPreambleBuf[7] = 's'; |
1292 TRequestStatus send_status; |
1503 TRequestStatus send_status; |
1293 iPort->Write(send_status, EEndpoint1, iPreambleBuf, KPreambleLength); |
1504 iPort->Write(send_status, EEndpoint1, iPreambleBuf, KPreambleLength); |
1294 TUSB_VERBOSE_PRINT("Waiting for write request to complete..."); |
1505 TUSB_VERBOSE_PRINT("Waiting for write request to complete..."); |
|
1506 if(iVerbose) |
|
1507 { |
|
1508 OstTrace0(TRACE_VERBOSE, CACTIVERW_SENDVERSION_DUP03, "Waiting for write request to complete..."); |
|
1509 } |
1295 User::WaitForRequest(send_status); |
1510 User::WaitForRequest(send_status); |
1296 TUSB_VERBOSE_PRINT("...done.\n"); |
1511 TUSB_VERBOSE_PRINT("...done.\n"); |
|
1512 if(iVerbose) |
|
1513 { |
|
1514 OstTrace0(TRACE_VERBOSE, CACTIVERW_SENDVERSION_DUP04, "...done.\n"); |
|
1515 } |
1297 return send_status.Int(); |
1516 return send_status.Int(); |
1298 } |
1517 } |
1299 |
1518 |
1300 |
1519 |
1301 TInt CActiveRW::ReceiveVersion() |
1520 TInt CActiveRW::ReceiveVersion() |
1302 { |
1521 { |
1303 TUSB_VERBOSE_PRINT("CActiveRW::ReceiveVersion()"); |
1522 TUSB_VERBOSE_PRINT("CActiveRW::ReceiveVersion()"); |
|
1523 if(iVerbose) |
|
1524 { |
|
1525 OstTrace0(TRACE_VERBOSE, CACTIVERW_RECEIVEVERSION, "CActiveRW::ReceiveVersion()"); |
|
1526 } |
1304 if (iXferMode != ::ENone) |
1527 if (iXferMode != ::ENone) |
1305 { |
1528 { |
1306 TUSB_PRINT1("Error : wrong state: %d", iXferMode); |
1529 TUSB_PRINT1("Error : wrong state: %d", iXferMode); |
|
1530 OstTrace1(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP01, "Error : wrong state: %d", iXferMode); |
1307 return KErrGeneral; |
1531 return KErrGeneral; |
1308 } |
1532 } |
1309 // Here we try to receive a version packet from the host. |
1533 // Here we try to receive a version packet from the host. |
1310 // (We can use the preamble buffer because we only need it |
1534 // (We can use the preamble buffer because we only need it |
1311 // once and that's also before the preamble uses.) |
1535 // once and that's also before the preamble uses.) |
1312 TUSB_PRINT("Getting host program versions..."); |
1536 TUSB_PRINT("Getting host program versions..."); |
|
1537 OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP02, "Getting host program versions..."); |
1313 iPreambleBuf.FillZ(); |
1538 iPreambleBuf.FillZ(); |
1314 TRequestStatus receive_status; |
1539 TRequestStatus receive_status; |
1315 iPort->Read(receive_status, EEndpoint2, iPreambleBuf, KPreambleLength); |
1540 iPort->Read(receive_status, EEndpoint2, iPreambleBuf, KPreambleLength); |
1316 TUSB_VERBOSE_PRINT("Waiting for read request to complete..."); |
1541 TUSB_VERBOSE_PRINT("Waiting for read request to complete..."); |
|
1542 if(iVerbose) |
|
1543 { |
|
1544 OstTrace0(TRACE_VERBOSE, CACTIVERW_RECEIVEVERSION_DUP03, "Waiting for read request to complete..."); |
|
1545 } |
1317 iTimeoutTimer->Activate(5000000); // Host gets 5s |
1546 iTimeoutTimer->Activate(5000000); // Host gets 5s |
1318 User::WaitForRequest(receive_status, iTimeoutTimer->iStatus); |
1547 User::WaitForRequest(receive_status, iTimeoutTimer->iStatus); |
1319 if (receive_status == KRequestPending) |
1548 if (receive_status == KRequestPending) |
1320 { |
1549 { |
1321 // Read() still pending... |
1550 // Read() still pending... |
1322 TUSB_PRINT("Cancelling USB Read(): no response from host.\n"); |
1551 TUSB_PRINT("Cancelling USB Read(): no response from host.\n"); |
|
1552 OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP04, "Cancelling USB Read(): no response from host.\n"); |
1323 iPort->ReadCancel(EEndpoint2); |
1553 iPort->ReadCancel(EEndpoint2); |
1324 TUSB_PRINT("THIS COULD BE DUE TO AN OLD VERSION OF USBRFLCT ON THE PC:"); |
1554 TUSB_PRINT("THIS COULD BE DUE TO AN OLD VERSION OF USBRFLCT ON THE PC:"); |
|
1555 OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP05, "THIS COULD BE DUE TO AN OLD VERSION OF USBRFLCT ON THE PC:"); |
1325 TUSB_PRINT3("PLEASE CHECK THE VERSION THERE - WE NEED AT LEAST V%d.%d.%d!\n", |
1556 TUSB_PRINT3("PLEASE CHECK THE VERSION THERE - WE NEED AT LEAST V%d.%d.%d!\n", |
|
1557 KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro); |
|
1558 OstTraceExt3(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP06, "PLEASE CHECK THE VERSION THERE - WE NEED AT LEAST V%d.%d.%d!\n", |
1326 KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro); |
1559 KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro); |
1327 TUSB_PRINT("When updating an existing USBRFLCT installation <= v1.3.1,\n" \ |
1560 TUSB_PRINT("When updating an existing USBRFLCT installation <= v1.3.1,\n" \ |
1328 L"the following three things will need to be done:\n"); |
1561 L"the following three things will need to be done:\n"); |
|
1562 OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP07, "When updating an existing USBRFLCT installation <= v1.3.1,\n" \ |
|
1563 L"the following three things will need to be done:\n"); |
1329 TUSB_PRINT("1. Connect the device to the PC & start T_USB (just as now),\n" \ |
1564 TUSB_PRINT("1. Connect the device to the PC & start T_USB (just as now),\n" \ |
|
1565 L"then find the USB device in the Windows Device Manager\n" \ |
|
1566 L"('Control Panel'->'System'->'Hardware'->'Device Manager').\n" \ |
|
1567 L"Right click on the device name and choose 'Uninstall...'.\n"); |
|
1568 OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP08, "1. Connect the device to the PC & start T_USB (just as now),\n" \ |
1330 L"then find the USB device in the Windows Device Manager\n" \ |
1569 L"then find the USB device in the Windows Device Manager\n" \ |
1331 L"('Control Panel'->'System'->'Hardware'->'Device Manager').\n" \ |
1570 L"('Control Panel'->'System'->'Hardware'->'Device Manager').\n" \ |
1332 L"Right click on the device name and choose 'Uninstall...'.\n"); |
1571 L"Right click on the device name and choose 'Uninstall...'.\n"); |
1333 TUSB_PRINT("2. In c:\\winnt\\inf\\, find (by searching for \"Symbian\") and\n" \ |
1572 TUSB_PRINT("2. In c:\\winnt\\inf\\, find (by searching for \"Symbian\") and\n" \ |
1334 L"delete the *.INF file that was used to install the existing\n" \ |
1573 L"delete the *.INF file that was used to install the existing\n" \ |
1335 L"version of USBRFLCT.SYS. Make sure to also delete the\n" \ |
1574 L"version of USBRFLCT.SYS. Make sure to also delete the\n" \ |
1336 L"precompiled version of that file (<samename>.PNF).\n"); |
1575 L"precompiled version of that file (<samename>.PNF).\n"); |
|
1576 OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP09, "2. In c:\\winnt\\inf\\, find (by searching for \"Symbian\") and\n" \ |
|
1577 L"delete the *.INF file that was used to install the existing\n" \ |
|
1578 L"version of USBRFLCT.SYS. Make sure to also delete the\n" \ |
|
1579 L"precompiled version of that file (<samename>.PNF).\n"); |
1337 TUSB_PRINT("3. In c:\\winnt\\system32\\drivers\\, delete the file USBRFLCT.SYS.\n"); |
1580 TUSB_PRINT("3. In c:\\winnt\\system32\\drivers\\, delete the file USBRFLCT.SYS.\n"); |
|
1581 OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP10, "3. In c:\\winnt\\system32\\drivers\\, delete the file USBRFLCT.SYS.\n"); |
1338 TUSB_PRINT("Then unplug & reconnect the USB device and, when prompted, install\n" \ |
1582 TUSB_PRINT("Then unplug & reconnect the USB device and, when prompted, install\n" \ |
1339 L"the new USBRFLCT.SYS driver using the .INF file from this distribution.\n" \ |
1583 L"the new USBRFLCT.SYS driver using the .INF file from this distribution.\n" \ |
1340 L"(All files can be found under e32test\\win32\\usbrflct_distribution\\.)\n"); |
1584 L"(All files can be found under e32test\\win32\\usbrflct_distribution\\.)\n"); |
|
1585 OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP11, "Then unplug & reconnect the USB device and, when prompted, install\n" \ |
|
1586 L"the new USBRFLCT.SYS driver using the .INF file from this distribution.\n" \ |
|
1587 L"(All files can be found under e32test\\win32\\usbrflct_distribution\\.)\n"); |
1341 TUSB_PRINT("Use the new USBRFLCT.EXE from this distribution.\n"); |
1588 TUSB_PRINT("Use the new USBRFLCT.EXE from this distribution.\n"); |
|
1589 OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP12, "Use the new USBRFLCT.EXE from this distribution.\n"); |
1342 } |
1590 } |
1343 else |
1591 else |
1344 { |
1592 { |
1345 TUSB_VERBOSE_PRINT("...done."); |
1593 TUSB_VERBOSE_PRINT("...done."); |
|
1594 if(iVerbose) |
|
1595 { |
|
1596 OstTrace0(TRACE_VERBOSE, CACTIVERW_RECEIVEVERSION_DUP13, "...done."); |
|
1597 } |
1346 // Timeout not needed any longer |
1598 // Timeout not needed any longer |
1347 TUSB_VERBOSE_PRINT("Cancelling timeout timer: USB Read() completed.\n"); |
1599 TUSB_VERBOSE_PRINT("Cancelling timeout timer: USB Read() completed.\n"); |
|
1600 if(iVerbose) |
|
1601 { |
|
1602 OstTrace0(TRACE_VERBOSE, CACTIVERW_RECEIVEVERSION_DUP14, "Cancelling timeout timer: USB Read() completed.\n"); |
|
1603 } |
1348 iTimeoutTimer->Cancel(); |
1604 iTimeoutTimer->Cancel(); |
1349 } |
1605 } |
1350 return receive_status.Int(); |
1606 return receive_status.Int(); |
1351 } |
1607 } |
1352 |
1608 |
1353 |
1609 |
1354 TInt CActiveRW::ExchangeVersions() |
1610 TInt CActiveRW::ExchangeVersions() |
1355 { |
1611 { |
1356 TUSB_VERBOSE_PRINT("CActiveRW::ExchangeVersions()"); |
1612 TUSB_VERBOSE_PRINT("CActiveRW::ExchangeVersions()"); |
|
1613 if(iVerbose) |
|
1614 { |
|
1615 OstTrace0(TRACE_VERBOSE, CACTIVERW_EXCHANGEVERSIONS, "CActiveRW::ExchangeVersions()"); |
|
1616 } |
1357 // First check the version of USBRFLCT that's running on the host |
1617 // First check the version of USBRFLCT that's running on the host |
1358 TInt r = ReceiveVersion(); |
1618 TInt r = ReceiveVersion(); |
1359 if (r != KErrNone) |
1619 if (r != KErrNone) |
1360 { |
1620 { |
1361 return KErrGeneral; |
1621 return KErrGeneral; |
1366 TUint8 usbio_ver_major = iPreambleBuf[3]; |
1626 TUint8 usbio_ver_major = iPreambleBuf[3]; |
1367 TUint8 usbio_ver_minor = iPreambleBuf[4]; |
1627 TUint8 usbio_ver_minor = iPreambleBuf[4]; |
1368 TUSB_PRINT5("Host-side: USBRFLCT v%d.%d.%d USBIO v%d.%d\n", |
1628 TUSB_PRINT5("Host-side: USBRFLCT v%d.%d.%d USBIO v%d.%d\n", |
1369 usbrflct_ver_major, usbrflct_ver_minor, usbrflct_ver_micro, |
1629 usbrflct_ver_major, usbrflct_ver_minor, usbrflct_ver_micro, |
1370 usbio_ver_major, usbio_ver_minor); |
1630 usbio_ver_major, usbio_ver_minor); |
|
1631 OstTraceExt5(TRACE_NORMAL, CACTIVERW_EXCHANGEVERSIONS_DUP01, "Host-side: USBRFLCT v%d.%d.%d USBIO v%d.%d\n", |
|
1632 usbrflct_ver_major, usbrflct_ver_minor, usbrflct_ver_micro, |
|
1633 usbio_ver_major, usbio_ver_minor); |
1371 if (usbrflct_ver_major < KUsbrflctVersionMajor) |
1634 if (usbrflct_ver_major < KUsbrflctVersionMajor) |
1372 { |
1635 { |
1373 TUSB_PRINT1("USBRFLCT version not sufficient (need at least v%d.x.x)\n", |
1636 TUSB_PRINT1("USBRFLCT version not sufficient (need at least v%d.x.x)\n", |
|
1637 KUsbrflctVersionMajor); |
|
1638 OstTrace1(TRACE_NORMAL, CACTIVERW_EXCHANGEVERSIONS_DUP02, "USBRFLCT version not sufficient (need at least v%d.x.x)\n", |
1374 KUsbrflctVersionMajor); |
1639 KUsbrflctVersionMajor); |
1375 return KErrGeneral; |
1640 return KErrGeneral; |
1376 } |
1641 } |
1377 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
1642 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
1378 // GCC compiler warning because Kxxx can also be zero (in which case there's no '<'). |
1643 // GCC compiler warning because Kxxx can also be zero (in which case there's no '<'). |
1379 else if ((usbrflct_ver_minor <= KUsbrflctVersionMinor) && |
1644 else if ((usbrflct_ver_minor <= KUsbrflctVersionMinor) && |
1380 !(usbrflct_ver_minor == KUsbrflctVersionMinor)) |
1645 !(usbrflct_ver_minor == KUsbrflctVersionMinor)) |
1381 { |
1646 { |
1382 TUSB_PRINT2("USBRFLCT version not sufficient (need at least v%d.%d.x)\n", |
1647 TUSB_PRINT2("USBRFLCT version not sufficient (need at least v%d.%d.x)\n", |
1383 KUsbrflctVersionMajor, KUsbrflctVersionMinor); |
1648 KUsbrflctVersionMajor, KUsbrflctVersionMinor); |
|
1649 OstTraceExt2(TRACE_NORMAL, CACTIVERW_EXCHANGEVERSIONS_DUP03, "USBRFLCT version not sufficient (need at least v%d.%d.x)\n", |
|
1650 KUsbrflctVersionMajor, KUsbrflctVersionMinor); |
1384 return KErrGeneral; |
1651 return KErrGeneral; |
1385 } |
1652 } |
1386 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
1653 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
1387 // GCC compiler warning because Kxxx can also be zero (in which case there's no '<'). |
1654 // GCC compiler warning because Kxxx can also be zero (in which case there's no '<'). |
1388 else if ((usbrflct_ver_micro <= KUsbrflctVersionMicro) && |
1655 else if ((usbrflct_ver_micro <= KUsbrflctVersionMicro) && |
1389 !(usbrflct_ver_micro == KUsbrflctVersionMicro)) |
1656 !(usbrflct_ver_micro == KUsbrflctVersionMicro)) |
1390 { |
1657 { |
1391 TUSB_PRINT3("USBRFLCT version not sufficient (need at least v%d.%d.%d)\n", |
1658 TUSB_PRINT3("USBRFLCT version not sufficient (need at least v%d.%d.%d)\n", |
1392 KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro); |
1659 KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro); |
|
1660 OstTraceExt3(TRACE_NORMAL, CACTIVERW_EXCHANGEVERSIONS_DUP04, "USBRFLCT version not sufficient (need at least v%d.%d.%d)\n", |
|
1661 KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro); |
1393 return KErrGeneral; |
1662 return KErrGeneral; |
1394 } |
1663 } |
1395 // Now we send T_USB's version to the host |
1664 // Now we send T_USB's version to the host |
1396 r = SendVersion(); |
1665 r = SendVersion(); |
1397 if (r != KErrNone) |
1666 if (r != KErrNone) |
1601 } |
1904 } |
1602 const TInt r = iFile.Read(aBuffer, aLen); |
1905 const TInt r = iFile.Read(aBuffer, aLen); |
1603 if (r != KErrNone) |
1906 if (r != KErrNone) |
1604 { |
1907 { |
1605 TUSB_PRINT2("Error reading from %S (%d)", &iFileName, r); |
1908 TUSB_PRINT2("Error reading from %S (%d)", &iFileName, r); |
|
1909 OstTraceExt2(TRACE_NORMAL, CACTIVERW_READBUFFERFROMDISK, "Error reading from %S (%d)", iFileName, r); |
1606 iDiskAccessEnabled = EFalse; |
1910 iDiskAccessEnabled = EFalse; |
1607 return; |
1911 return; |
1608 } |
1912 } |
1609 TInt readLen = aBuffer.Length(); |
1913 TInt readLen = aBuffer.Length(); |
1610 TUSB_VERBOSE_PRINT1("CActiveRW::ReadBufferFromDisk(), len = %d\n", readLen); |
1914 TUSB_VERBOSE_PRINT1("CActiveRW::ReadBufferFromDisk(), len = %d\n", readLen); |
|
1915 if(iVerbose) |
|
1916 { |
|
1917 OstTrace1(TRACE_VERBOSE, CACTIVERW_READBUFFERFROMDISK_DUP01, "CActiveRW::ReadBufferFromDisk(), len = %d\n", readLen); |
|
1918 } |
1611 if (readLen < aLen) |
1919 if (readLen < aLen) |
1612 { |
1920 { |
1613 TUSB_PRINT3("Only %d bytes of %d read from file %S)", |
1921 TUSB_PRINT3("Only %d bytes of %d read from file %S)", |
1614 readLen, aLen, &iFileName); |
1922 readLen, aLen, &iFileName); |
|
1923 OstTraceExt3(TRACE_NORMAL, CACTIVERW_READBUFFERFROMDISK_DUP02, "Only %d bytes of %d read from file %S)", |
|
1924 readLen, aLen, iFileName); |
1615 iDiskAccessEnabled = EFalse; |
1925 iDiskAccessEnabled = EFalse; |
1616 return; |
1926 return; |
1617 } |
1927 } |
1618 iFileOffset += aLen; |
1928 iFileOffset += aLen; |
1619 } |
1929 } |
1620 |
1930 |
1621 |
1931 |
1622 void CActiveRW::ReadData() |
1932 void CActiveRW::ReadData() |
1623 { |
1933 { |
1624 TUSB_VERBOSE_PRINT("CActiveRW::ReadData()"); |
1934 TUSB_VERBOSE_PRINT("CActiveRW::ReadData()"); |
|
1935 if(iVerbose) |
|
1936 { |
|
1937 OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA, "CActiveRW::ReadData()"); |
|
1938 } |
1625 __ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666)); |
1939 __ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666)); |
1626 TUSB_VERBOSE_PRINT1("Reading data: %d bytes", iBufSz); |
1940 TUSB_VERBOSE_PRINT1("Reading data: %d bytes", iBufSz); |
|
1941 if(iVerbose) |
|
1942 { |
|
1943 OstTrace1(TRACE_VERBOSE, CACTIVERW_READDATA_DUP01, "Reading data: %d bytes", iBufSz); |
|
1944 } |
1627 if (iXferMode == EReceiveOnly) |
1945 if (iXferMode == EReceiveOnly) |
1628 { |
1946 { |
1629 TUSB_VERBOSE_PRINT(" (rx only)"); |
1947 TUSB_VERBOSE_PRINT(" (rx only)"); |
|
1948 if(iVerbose) |
|
1949 { |
|
1950 OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA_DUP02, " (rx only)"); |
|
1951 } |
1630 iPort->Read(iStatus, EEndpoint2, iReadBuf, iBufSz); |
1952 iPort->Read(iStatus, EEndpoint2, iReadBuf, iBufSz); |
1631 } |
1953 } |
1632 else if (iBufSz == iMaxPktSz) |
1954 else if (iBufSz == iMaxPktSz) |
1633 { |
1955 { |
1634 // we also want to test the packet version of Read() |
1956 // we also want to test the packet version of Read() |
1635 TUSB_VERBOSE_PRINT(" (a single packet)"); |
1957 TUSB_VERBOSE_PRINT(" (a single packet)"); |
|
1958 if(iVerbose) |
|
1959 { |
|
1960 OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA_DUP03, " (a single packet)"); |
|
1961 } |
1636 iPort->ReadPacket(iStatus, EEndpoint2, iReadBuf, iBufSz); |
1962 iPort->ReadPacket(iStatus, EEndpoint2, iReadBuf, iBufSz); |
1637 } |
1963 } |
1638 else if (iBufSz == iReadBuf.MaxSize()) |
1964 else if (iBufSz == iReadBuf.MaxSize()) |
1639 { |
1965 { |
1640 // or we could perhaps test the three-parameter version |
1966 // or we could perhaps test the three-parameter version |
1641 TUSB_VERBOSE_PRINT(" (w/o length)"); |
1967 TUSB_VERBOSE_PRINT(" (w/o length)"); |
|
1968 if(iVerbose) |
|
1969 { |
|
1970 OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA_DUP04, " (w/o length)"); |
|
1971 } |
1642 iPort->Read(iStatus, EEndpoint2, iReadBuf); |
1972 iPort->Read(iStatus, EEndpoint2, iReadBuf); |
1643 } |
1973 } |
1644 else |
1974 else |
1645 { |
1975 { |
1646 // otherwise, we use the universal default version |
1976 // otherwise, we use the universal default version |
1647 TUSB_VERBOSE_PRINT(" (normal)"); |
1977 TUSB_VERBOSE_PRINT(" (normal)"); |
|
1978 if(iVerbose) |
|
1979 { |
|
1980 OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA_DUP05, " (normal)"); |
|
1981 } |
1648 iPort->Read(iStatus, EEndpoint2, iReadBuf, iBufSz); |
1982 iPort->Read(iStatus, EEndpoint2, iReadBuf, iBufSz); |
1649 } |
1983 } |
1650 iCurrentXfer = EReadXfer; |
1984 iCurrentXfer = EReadXfer; |
1651 SetActive(); |
1985 SetActive(); |
1652 } |
1986 } |
1812 { |
2185 { |
1813 switch (iDeviceState) |
2186 switch (iDeviceState) |
1814 { |
2187 { |
1815 case EUsbcDeviceStateUndefined: |
2188 case EUsbcDeviceStateUndefined: |
1816 TUSB_PRINT("Device State notifier: Undefined"); |
2189 TUSB_PRINT("Device State notifier: Undefined"); |
|
2190 OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL, "Device State notifier: Undefined"); |
1817 break; |
2191 break; |
1818 case EUsbcDeviceStateAttached: |
2192 case EUsbcDeviceStateAttached: |
1819 TUSB_PRINT("Device State notifier: Attached"); |
2193 TUSB_PRINT("Device State notifier: Attached"); |
|
2194 OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP01, "Device State notifier: Attached"); |
1820 break; |
2195 break; |
1821 case EUsbcDeviceStatePowered: |
2196 case EUsbcDeviceStatePowered: |
1822 TUSB_PRINT("Device State notifier: Powered"); |
2197 TUSB_PRINT("Device State notifier: Powered"); |
|
2198 OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP02, "Device State notifier: Powered"); |
1823 break; |
2199 break; |
1824 case EUsbcDeviceStateDefault: |
2200 case EUsbcDeviceStateDefault: |
1825 TUSB_PRINT("Device State notifier: Default"); |
2201 TUSB_PRINT("Device State notifier: Default"); |
|
2202 OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP03, "Device State notifier: Default"); |
1826 break; |
2203 break; |
1827 case EUsbcDeviceStateAddress: |
2204 case EUsbcDeviceStateAddress: |
1828 TUSB_PRINT("Device State notifier: Address"); |
2205 TUSB_PRINT("Device State notifier: Address"); |
|
2206 OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP04, "Device State notifier: Address"); |
1829 break; |
2207 break; |
1830 case EUsbcDeviceStateConfigured: |
2208 case EUsbcDeviceStateConfigured: |
1831 TUSB_PRINT("Device State notifier: Configured"); |
2209 TUSB_PRINT("Device State notifier: Configured"); |
|
2210 OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP05, "Device State notifier: Configured"); |
1832 break; |
2211 break; |
1833 case EUsbcDeviceStateSuspended: |
2212 case EUsbcDeviceStateSuspended: |
1834 TUSB_PRINT("Device State notifier: Suspended"); |
2213 TUSB_PRINT("Device State notifier: Suspended"); |
|
2214 OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP06, "Device State notifier: Suspended"); |
1835 break; |
2215 break; |
1836 default: |
2216 default: |
1837 TUSB_PRINT("Device State notifier: ***BAD***"); |
2217 TUSB_PRINT("Device State notifier: ***BAD***"); |
|
2218 OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP07, "Device State notifier: ***BAD***"); |
1838 } |
2219 } |
1839 } |
2220 } |
1840 else if (iDeviceState & KUsbAlternateSetting) |
2221 else if (iDeviceState & KUsbAlternateSetting) |
1841 { |
2222 { |
1842 TUSB_PRINT1("Device State notifier: Alternate interface setting has changed: now %d", |
2223 TUSB_PRINT1("Device State notifier: Alternate interface setting has changed: now %d", |
|
2224 iDeviceState & ~KUsbAlternateSetting); |
|
2225 OstTrace1(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP08, "Device State notifier: Alternate interface setting has changed: now %d", |
1843 iDeviceState & ~KUsbAlternateSetting); |
2226 iDeviceState & ~KUsbAlternateSetting); |
1844 } |
2227 } |
1845 |
2228 |
1846 Activate(); |
2229 Activate(); |
1847 } |
2230 } |