149 CActiveControl* self = NewLC(aConsole, aConfigFile, aScriptFile); |
161 CActiveControl* self = NewLC(aConsole, aConfigFile, aScriptFile); |
150 CleanupStack::Pop(); |
162 CleanupStack::Pop(); |
151 return self; |
163 return self; |
152 } |
164 } |
153 |
165 |
154 |
|
155 void CActiveControl::ConstructL() |
166 void CActiveControl::ConstructL() |
156 { |
167 { |
157 CActiveScheduler::Add(this); |
168 CActiveScheduler::Add(this); |
|
169 #ifdef USB_SC |
|
170 if (gShareHandle) |
|
171 { |
|
172 // to do add call to server to transfer config file name |
|
173 iTranHandleServer = CTranHandleServer::NewL(*this); |
|
174 RTransferSrv aSrv; |
|
175 test.Next (_L("ConstructL")); |
|
176 User::LeaveIfError(aSrv.Connect()); |
|
177 CleanupClosePushL(aSrv); |
|
178 test.Next (_L("ConstructL1")); |
|
179 User::LeaveIfError(aSrv.SetConfigFileName(*iConfigFileName)); |
|
180 test.Next (_L("ConstructL2")); |
|
181 CleanupStack::Pop(); |
|
182 aSrv.Close(); |
|
183 return; |
|
184 } |
|
185 #endif |
158 TInt r; |
186 TInt r; |
159 |
187 |
160 User::LeaveIfError(iFs.Connect()); |
188 User::LeaveIfError(iFs.Connect()); |
161 |
189 |
162 test.Start (_L("Configuration")); |
190 test.Start (_L("Configuration")); |
163 |
191 |
164 test_Compare(iConfigFileName->Length(),!=,0); |
192 test_Compare(iConfigFileName->Length(),!=,0); |
165 |
193 |
166 iTimer.CreateLocal(); |
194 iTimer.CreateLocal(); |
167 iPending = EPendingNone; |
195 iPending = EPendingNone; |
168 |
196 |
169 test.Next (_L("Open configuration file")); |
197 test.Next (_L("Open configuration file")); |
170 // set the session path to use the ROM if no drive specified |
198 // set the session path to use the ROM if no drive specified |
171 r=iFs.SetSessionPath(_L("Z:\\test\\")); |
199 r=iFs.SetSessionPath(_L("Z:\\test\\")); |
172 test_KErrNone(r); |
200 test_KErrNone(r); |
173 |
201 |
174 r = iConfigFile.Open(iFs, * iConfigFileName, EFileShareReadersOnly | EFileStreamText | EFileRead); |
202 r = iConfigFile.Open(iFs, * iConfigFileName, EFileShareReadersOnly | EFileStreamText | EFileRead); |
175 test_KErrNone(r); |
203 test_KErrNone(r); |
176 TUSB_VERBOSE_PRINT1("Configuration file %s Opened successfully", iConfigFileName->PtrZ()); |
204 TUSB_VERBOSE_PRINT1("Configuration file %s Opened successfully", iConfigFileName->PtrZ()); |
|
205 if(gVerbose) |
|
206 { |
|
207 OstTraceExt1(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTL, "Configuration file %S Opened successfully", *iConfigFileName); |
|
208 } |
177 |
209 |
178 test.Next (_L("Process configuration file")); |
210 test.Next (_L("Process configuration file")); |
179 test(ProcessConfigFile (iConfigFile,iConsole,&iLddPtr)); |
211 test(ProcessConfigFile (iConfigFile,iConsole,&iLddPtr)); |
180 |
212 |
181 iConfigFile.Close(); |
213 iConfigFile.Close(); |
182 |
214 |
183 test.Next (_L("LDD in configuration file")); |
215 test.Next (_L("LDD in configuration file")); |
184 test_NotNull(iLddPtr); |
216 test_NotNull(iLddPtr); |
185 |
217 |
186 LDDConfigPtr lddPtr = iLddPtr; |
218 LDDConfigPtr lddPtr = iLddPtr; |
187 TInt nextPort = 0; |
219 TInt nextPort = 0; |
188 while (lddPtr != NULL) |
220 while (lddPtr != NULL) |
189 { |
221 { |
190 // Load logical driver (LDD) |
222 // Load logical driver (LDD) |
191 // (There's no physical driver (PDD) with USB: it's a kernel extension DLL which |
223 // (There's no physical driver (PDD) with USB: it's a kernel extension DLL which |
192 // was already loaded at boot time.) |
224 // was already loaded at boot time.) |
193 test.Next (_L("Loading USB LDD")); |
225 test.Next (_L("Loading USB LDD")); |
194 TUSB_VERBOSE_PRINT1("Loading USB LDD ",lddPtr->iName.PtrZ()); |
226 TUSB_VERBOSE_PRINT1("Loading USB LDD ",lddPtr->iName.PtrZ()); |
|
227 if(gVerbose) |
|
228 { |
|
229 OstTraceExt1(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTL_DUP01, "Loading USB LDD:%S ", lddPtr->iName); |
|
230 } |
195 r = User::LoadLogicalDevice(lddPtr->iName); |
231 r = User::LoadLogicalDevice(lddPtr->iName); |
196 test(r == KErrNone || r == KErrAlreadyExists); |
232 test(r == KErrNone || r == KErrAlreadyExists); |
197 |
233 |
198 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
234 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
199 |
235 |
200 test.Next (_L("Opening Channels")); |
236 test.Next (_L("Opening Channels")); |
201 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
237 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
202 { |
238 { |
203 test_Compare(lddPtr->iNumChannels,>,0); |
239 test_Compare(lddPtr->iNumChannels,>,0); |
204 |
240 |
205 // Open USB channel |
241 // Open USB channel |
206 r = iPort[portNumber].Open(0); |
242 r = iPort[portNumber].Open(0); |
207 test_KErrNone(r); |
243 test_KErrNone(r); |
208 TUSB_VERBOSE_PRINT("Successfully opened USB port"); |
244 TUSB_VERBOSE_PRINT("Successfully opened USB port"); |
|
245 if(gVerbose) |
|
246 { |
|
247 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTL_DUP02, "Successfully opened USB port"); |
|
248 } |
209 |
249 |
210 // Query the USB device/Setup the USB interface |
250 // Query the USB device/Setup the USB interface |
211 if (portNumber == nextPort) |
251 if (portNumber == nextPort) |
212 { |
252 { |
213 // Change some descriptors to contain suitable values |
253 // Change some descriptors to contain suitable values |
214 SetupDescriptors(lddPtr, &iPort[portNumber]); |
254 SetupDescriptors(lddPtr, &iPort[portNumber]); |
215 } |
255 } |
216 |
256 |
217 if (portNumber == 0) |
257 if (portNumber == 0) |
218 { |
258 { |
219 QueryUsbClientL(lddPtr, &iPort[portNumber]); |
259 QueryUsbClientL(lddPtr, &iPort[portNumber]); |
220 } |
260 } |
221 |
261 |
222 test_NotNull(ifPtr); |
262 test_NotNull(ifPtr); |
223 |
263 |
224 if (iSupportResourceAllocationV2) |
264 if (iSupportResourceAllocationV2) |
225 { |
265 { |
226 PopulateInterfaceResourceAllocation(ifPtr, portNumber); |
266 PopulateInterfaceResourceAllocation(ifPtr, portNumber); |
227 } |
267 } |
228 |
268 |
229 IFConfigPtr defaultIfPtr = ifPtr; |
269 IFConfigPtr defaultIfPtr = ifPtr; |
230 SetupInterface(&ifPtr,portNumber); |
270 SetupInterface(&ifPtr,portNumber); |
231 |
271 |
232 #ifdef USB_SC |
272 #ifdef USB_SC |
233 RChunk *tChunk = &gChunk; |
273 RChunk *tChunk = &gChunk; |
234 test_KErrNone(iPort[portNumber].FinalizeInterface(tChunk)); |
274 test_KErrNone(iPort[portNumber].FinalizeInterface(tChunk)); |
235 #endif |
275 #endif |
236 |
276 |
268 User::After(100000); // 0.1 second |
312 User::After(100000); // 0.1 second |
269 TInt64 val1 = iIdleCounter->iCounter; |
313 TInt64 val1 = iIdleCounter->iCounter; |
270 User::After(1000000); // 1 second |
314 User::After(1000000); // 1 second |
271 TInt64 val2 = iIdleCounter->iCounter; |
315 TInt64 val2 = iIdleCounter->iCounter; |
272 TUSB_PRINT1("Idle Counter when test inactive: %Ldinc/ms", (val2 - val1) / 1000); |
316 TUSB_PRINT1("Idle Counter when test inactive: %Ldinc/ms", (val2 - val1) / 1000); |
|
317 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_CONSTRUCTL_DUP04, "Idle Counter when test inactive: %Ldinc/ms", (val2 - val1) / 1000); |
273 |
318 |
274 test.Next (_L("Enumeration...")); |
319 test.Next (_L("Enumeration...")); |
275 r = ReEnumerate(); |
320 r = ReEnumerate(); |
276 test_KErrNone(r); |
321 test_KErrNone(r); |
277 |
322 |
278 TUSB_VERBOSE_PRINT("Device successfully re-enumerated\n"); |
323 TUSB_VERBOSE_PRINT("Device successfully re-enumerated\n"); |
|
324 if(gVerbose) |
|
325 { |
|
326 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTL_DUP05, "Device successfully re-enumerated\n"); |
|
327 } |
279 |
328 |
280 |
329 |
281 if (iLddPtr->iHighSpeed && !gSkip) |
330 if (iLddPtr->iHighSpeed && !gSkip) |
282 { |
331 { |
283 test.Next (_L("High Speed")); |
332 test.Next (_L("High Speed")); |
284 test(iHighSpeed); |
333 test(iHighSpeed); |
285 } |
334 } |
286 |
335 |
287 test.Next (_L("Create Notifiers")); |
336 test.Next (_L("Create Notifiers")); |
288 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
337 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
289 { |
338 { |
290 |
339 |
291 // Create device state active object |
340 // Create device state active object |
292 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
341 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
293 test_NotNull(iDeviceStateNotifier[portNumber]); |
342 test_NotNull(iDeviceStateNotifier[portNumber]); |
294 iDeviceStateNotifier[portNumber]->Activate(); |
343 iDeviceStateNotifier[portNumber]->Activate(); |
295 TUSB_VERBOSE_PRINT("Created device state notifier"); |
344 TUSB_VERBOSE_PRINT("Created device state notifier"); |
|
345 if(gVerbose) |
|
346 { |
|
347 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTL_DUP06, "Created device state notifier"); |
|
348 } |
296 |
349 |
297 // Create endpoint stall status active object |
350 // Create endpoint stall status active object |
298 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
351 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
299 test_NotNull(iStallNotifier[portNumber]); |
352 test_NotNull(iStallNotifier[portNumber]); |
300 iStallNotifier[portNumber]->Activate(); |
353 iStallNotifier[portNumber]->Activate(); |
301 TUSB_VERBOSE_PRINT("Created stall notifier"); |
354 TUSB_VERBOSE_PRINT("Created stall notifier"); |
302 |
355 if(gVerbose) |
303 TestInvalidSetInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
356 { |
|
357 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTL_DUP07, "Created stall notifier"); |
|
358 } |
|
359 |
|
360 TestInvalidSetInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
304 TestInvalidReleaseInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
361 TestInvalidReleaseInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
305 |
362 |
306 } |
363 } |
307 |
364 |
308 test.Next (_L("Endpoint Zero Max Packet Sizes")); |
365 test.Next (_L("Endpoint Zero Max Packet Sizes")); |
309 TUint ep0Size = iPort[0].EndpointZeroMaxPacketSizes(); |
366 TUint ep0Size = iPort[0].EndpointZeroMaxPacketSizes(); |
310 switch (ep0Size) |
367 switch (ep0Size) |
311 { |
368 { |
312 case KUsbEpSize8 : |
369 case KUsbEpSize8 : |
313 iEp0PacketSize = 8; |
370 iEp0PacketSize = 8; |
314 break; |
371 break; |
315 |
372 |
316 case KUsbEpSize16 : |
373 case KUsbEpSize16 : |
317 iEp0PacketSize = 16; |
374 iEp0PacketSize = 16; |
318 break; |
375 break; |
319 |
376 |
320 case KUsbEpSize32 : |
377 case KUsbEpSize32 : |
352 LDDConfigPtr lddPtr = iLddPtr; |
409 LDDConfigPtr lddPtr = iLddPtr; |
353 TInt nextPort = 0; |
410 TInt nextPort = 0; |
354 while (lddPtr != NULL) |
411 while (lddPtr != NULL) |
355 { |
412 { |
356 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
413 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
357 |
414 |
358 test.Next (_L("Opening Channels")); |
415 test.Next (_L("Opening Channels")); |
359 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
416 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
360 { |
417 { |
361 // Open USB channel |
418 // Open USB channel |
362 r = iPort[portNumber].Open(0); |
419 r = iPort[portNumber].Open(0); |
363 test_KErrNone(r); |
420 test_KErrNone(r); |
364 TUSB_VERBOSE_PRINT("Successfully opened USB port"); |
421 TUSB_VERBOSE_PRINT("Successfully opened USB port"); |
|
422 if(gVerbose) |
|
423 { |
|
424 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_RECONNECT, "Successfully opened USB port"); |
|
425 } |
365 |
426 |
366 // Query the USB device/Setup the USB interface |
427 // Query the USB device/Setup the USB interface |
367 if (portNumber == nextPort) |
428 if (portNumber == nextPort) |
368 { |
429 { |
369 // Change some descriptors to contain suitable values |
430 // Change some descriptors to contain suitable values |
370 SetupDescriptors(lddPtr, &iPort[portNumber]); |
431 SetupDescriptors(lddPtr, &iPort[portNumber]); |
371 } |
432 } |
372 |
433 |
373 IFConfigPtr defaultIfPtr = ifPtr; |
434 IFConfigPtr defaultIfPtr = ifPtr; |
374 SetupInterface(&ifPtr,portNumber); |
435 SetupInterface(&ifPtr,portNumber); |
375 |
436 |
376 #ifdef USB_SC |
437 #ifdef USB_SC |
377 RChunk *tChunk = &gChunk; |
438 RChunk *tChunk = &gChunk; |
378 test_KErrNone(iPort[portNumber].FinalizeInterface(tChunk)); |
439 test_KErrNone(iPort[portNumber].FinalizeInterface(tChunk)); |
379 #endif |
440 #endif |
380 |
441 |
381 if (!iSupportResourceAllocationV2) |
442 if (!iSupportResourceAllocationV2) |
382 { |
443 { |
383 // allocate endpoint DMA and double buffering for all endpoints on default interface with resource allocation v1 api |
444 // allocate endpoint DMA and double buffering for all endpoints on default interface with resource allocation v1 api |
384 for (TUint8 i = 1; i <= defaultIfPtr->iInfoPtr->iTotalEndpointsUsed; i++) |
445 for (TUint8 i = 1; i <= defaultIfPtr->iInfoPtr->iTotalEndpointsUsed; i++) |
385 { |
446 { |
386 defaultIfPtr->iEpDMA[i-1] ? AllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i); |
447 defaultIfPtr->iEpDMA[i-1] ? AllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i); |
387 #ifndef USB_SC |
448 #ifndef USB_SC |
388 defaultIfPtr->iEpDoubleBuff[i-1] ? AllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i); |
449 defaultIfPtr->iEpDoubleBuff[i-1] ? AllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i); |
389 #endif |
450 #endif |
390 } |
451 } |
391 } |
452 } |
392 } |
453 } |
393 |
454 |
394 nextPort += lddPtr->iNumChannels; |
455 nextPort += lddPtr->iNumChannels; |
395 lddPtr = lddPtr->iPtrNext; |
456 lddPtr = lddPtr->iPtrNext; |
396 } |
457 } |
397 |
458 |
398 TUSB_VERBOSE_PRINT("All Interfaces and Alternate Settings successfully set up"); |
459 TUSB_VERBOSE_PRINT("All Interfaces and Alternate Settings successfully set up"); |
|
460 if(gVerbose) |
|
461 { |
|
462 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_RECONNECT_DUP01, "All Interfaces and Alternate Settings successfully set up"); |
|
463 } |
399 |
464 |
400 test.Next (_L("Enumeration...")); |
465 test.Next (_L("Enumeration...")); |
401 r = ReEnumerate(); |
466 r = ReEnumerate(); |
402 test_KErrNone(r); |
467 test_KErrNone(r); |
403 |
468 |
404 TUSB_VERBOSE_PRINT("Device successfully re-enumerated\n"); |
469 TUSB_VERBOSE_PRINT("Device successfully re-enumerated\n"); |
405 |
470 if(gVerbose) |
|
471 { |
|
472 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_RECONNECT_DUP02, "Device successfully re-enumerated\n"); |
|
473 } |
|
474 |
406 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
475 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
407 { |
476 { |
408 // Create device state active object |
477 // Create device state active object |
409 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
478 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
410 test_NotNull(iDeviceStateNotifier[portNumber]); |
479 test_NotNull(iDeviceStateNotifier[portNumber]); |
411 iDeviceStateNotifier[portNumber]->Activate(); |
480 iDeviceStateNotifier[portNumber]->Activate(); |
412 TUSB_VERBOSE_PRINT("Created device state notifier"); |
481 TUSB_VERBOSE_PRINT("Created device state notifier"); |
|
482 if(gVerbose) |
|
483 { |
|
484 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_RECONNECT_DUP03, "Created device state notifier"); |
|
485 } |
413 |
486 |
414 // Create endpoint stall status active object |
487 // Create endpoint stall status active object |
415 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
488 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
416 test_NotNull(iStallNotifier[portNumber]); |
489 test_NotNull(iStallNotifier[portNumber]); |
417 iStallNotifier[portNumber]->Activate(); |
490 iStallNotifier[portNumber]->Activate(); |
418 TUSB_VERBOSE_PRINT("Created stall notifier"); |
491 TUSB_VERBOSE_PRINT("Created stall notifier"); |
|
492 if(gVerbose) |
|
493 { |
|
494 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_RECONNECT_DUP04, "Created stall notifier"); |
|
495 } |
419 |
496 |
420 if (portNumber == 0) |
497 if (portNumber == 0) |
421 { |
498 { |
422 test.Next (_L("Set Device Control")); |
499 test.Next (_L("Set Device Control")); |
423 r = iPort[portNumber].SetDeviceControl(); |
500 r = iPort[portNumber].SetDeviceControl(); |
753 } |
852 } |
754 |
853 |
755 void CActiveControl::RunL() |
854 void CActiveControl::RunL() |
756 { |
855 { |
757 TInt r = KErrNone; |
856 TInt r = KErrNone; |
758 |
857 |
759 TUSB_VERBOSE_PRINT("CActiveControl::RunL()"); |
858 TUSB_VERBOSE_PRINT("CActiveControl::RunL()"); |
760 |
859 if(gVerbose) |
|
860 { |
|
861 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_RUNL, "CActiveControl::RunL()"); |
|
862 } |
|
863 |
761 switch (iPending) |
864 switch (iPending) |
762 { |
865 { |
763 case EPendingNone : |
866 case EPendingNone : |
764 break; |
867 break; |
765 |
868 |
766 case EPendingEp0Read : |
869 case EPendingEp0Read : |
767 iPending = EPendingNone; |
870 iPending = EPendingNone; |
768 if (iStatus != KErrNone) |
871 if (iStatus != KErrNone) |
769 { |
872 { |
770 TUSB_PRINT1("ActiveControl::Error %d in Ep0 Read Packet", iStatus.Int()); |
873 TUSB_PRINT1("ActiveControl::Error %d in Ep0 Read Packet", iStatus.Int()); |
|
874 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_RUNL_DUP01, "ActiveControl::Error %d in Ep0 Read Packet", iStatus.Int()); |
771 test(EFalse); |
875 test(EFalse); |
772 } |
876 } |
773 #ifdef USB_SC |
877 #ifdef USB_SC |
774 // for shared chunks this means that data is available in the buffer |
878 // for shared chunks this means that data is available in the buffer |
775 // but the data has yet to be transferred to a local buffer |
879 // but the data has yet to be transferred to a local buffer |
776 RequestEp0ControlPacket(); |
880 RequestEp0ControlPacket(); |
777 #else |
881 #else |
778 if (ProcessEp0ControlPacket() == KErrCompletion) |
882 if (ProcessEp0ControlPacket() == KErrCompletion) |
779 RequestEp0ControlPacket(); |
883 RequestEp0ControlPacket(); |
780 #endif |
884 #endif |
781 break; |
885 break; |
782 |
886 |
783 case EPendingTimer : |
887 case EPendingTimer : |
784 iPending = EPendingNone; |
888 iPending = EPendingNone; |
785 if (iStatus != KErrNone) |
889 if (iStatus != KErrNone) |
786 { |
890 { |
787 TUSB_PRINT1("ActiveControl::Error %d in Connection Timer Delay", iStatus.Int()); |
891 TUSB_PRINT1("ActiveControl::Error %d in Connection Timer Delay", iStatus.Int()); |
|
892 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_RUNL_DUP02, "ActiveControl::Error %d in Connection Timer Delay", iStatus.Int()); |
788 test(EFalse); |
893 test(EFalse); |
789 } |
894 } |
790 r = iPort[0].DeviceConnectToHost(); |
895 r = iPort[0].DeviceConnectToHost(); |
791 test_KErrNone (r); |
896 test_KErrNone (r); |
792 |
897 |
793 test.End(); |
898 test.End(); |
794 |
899 |
795 RequestEp0ControlPacket(); |
900 RequestEp0ControlPacket(); |
796 break; |
901 break; |
797 |
902 |
798 case EPendingEject : |
903 case EPendingEject : |
799 iPending = EPendingNone; |
904 iPending = EPendingNone; |
800 if (iStatus != KErrNone) |
905 if (iStatus != KErrNone) |
801 { |
906 { |
802 TUSB_PRINT1("ActiveControl::Error %d in Eject Timer Delay", iStatus.Int()); |
907 TUSB_PRINT1("ActiveControl::Error %d in Eject Timer Delay", iStatus.Int()); |
|
908 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_RUNL_DUP03, "ActiveControl::Error %d in Eject Timer Delay", iStatus.Int()); |
803 test(EFalse); |
909 test(EFalse); |
804 } |
910 } |
805 StopMassStorage(&iPort[0]); |
911 StopMassStorage(&iPort[0]); |
806 #ifdef USB_SC |
912 #ifdef USB_SC |
807 iEp0Buf.Close(); |
913 iEp0Buf.Close(); |
808 #endif |
914 #endif |
809 ReConnect(); |
915 ReConnect(); |
810 |
916 |
811 RequestEp0ControlPacket(); |
917 RequestEp0ControlPacket(); |
812 break; |
918 break; |
813 |
919 |
814 case EPendingCancel : |
920 case EPendingCancel : |
815 iPending = EPendingNone; |
921 iPending = EPendingNone; |
816 if (iStatus != KErrNone && iStatus != KErrCancel) |
922 if (iStatus != KErrNone && iStatus != KErrCancel) |
817 { |
923 { |
818 TUSB_PRINT1("ActiveControl::Error %d in Eject Timer Delay", iStatus.Int()); |
924 TUSB_PRINT1("ActiveControl::Error %d in Eject Timer Delay", iStatus.Int()); |
|
925 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_RUNL_DUP04, "ActiveControl::Error %d in Eject Timer Delay", iStatus.Int()); |
819 test(EFalse); |
926 test(EFalse); |
820 } |
927 } |
821 } |
928 } |
822 |
929 |
823 } |
930 } |
824 |
931 |
825 TInt CActiveControl::ProcessEp0ControlPacket() |
932 TInt CActiveControl::ProcessEp0ControlPacket() |
826 { |
933 { |
827 TUint16 value = *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wValueOffset]); |
934 TUint16 value = *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wValueOffset]); |
828 TUint16 index = *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wIndexOffset]); |
935 TUint16 index = *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wIndexOffset]); |
829 TUint16 length= *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wLengthOffset]); |
936 TUint16 length= *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wLengthOffset]); |
830 TUSB_VERBOSE_PRINT3("ProcessEp0ControlPacket length 0x%x value 0x%x index 0x%x",length,value,index); |
937 TUSB_VERBOSE_PRINT3("ProcessEp0ControlPacket length 0x%x value 0x%x index 0x%x",length,value,index); |
|
938 if(gVerbose) |
|
939 { |
|
940 OstTraceExt3(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET, "ProcessEp0ControlPacket length 0x%x value 0x%x index 0x%x",length,value,index); |
|
941 } |
831 TRequestStatus ep0Status; |
942 TRequestStatus ep0Status; |
832 TUint8 host_ver_major; |
943 TUint8 host_ver_major; |
833 TUint8 host_ver_minor; |
944 TUint8 host_ver_minor; |
834 TUint8 host_ver_micro; |
945 TUint8 host_ver_micro; |
835 TUint8 usbio_ver_major; |
946 TUint8 usbio_ver_major; |
847 |
958 |
848 if (((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_DestMask) == KUsbRequestType_DestDevice) && |
959 if (((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_DestMask) == KUsbRequestType_DestDevice) && |
849 ((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_TypeMask) == KUsbRequestType_TypeClass)) |
960 ((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_TypeMask) == KUsbRequestType_TypeClass)) |
850 { |
961 { |
851 TUSB_VERBOSE_PRINT("Received Device Directed setup packet"); |
962 TUSB_VERBOSE_PRINT("Received Device Directed setup packet"); |
|
963 if(gVerbose) |
|
964 { |
|
965 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP01, "Received Device Directed setup packet"); |
|
966 } |
852 if ((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_DirMask) == KUsbRequestType_DirToDev) |
967 if ((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_DirMask) == KUsbRequestType_DirToDev) |
853 { |
968 { |
854 iEp0DataBuffer.SetLength(0); |
969 iEp0DataBuffer.SetLength(0); |
855 while (iEp0DataBuffer.Length() < length) |
970 while (iEp0DataBuffer.Length() < length) |
856 { |
971 { |
857 TUSB_VERBOSE_PRINT("Reading Ep0 data packet"); |
972 TUSB_VERBOSE_PRINT("Reading Ep0 data packet"); |
|
973 if(gVerbose) |
|
974 { |
|
975 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP02, "Reading Ep0 data packet"); |
|
976 } |
858 #ifdef USB_SC |
977 #ifdef USB_SC |
859 r = iEp0Buf.GetBuffer (iEp0Packet,iEp0Size,iEp0Zlp,ep0Status); |
978 r = iEp0Buf.GetBuffer (iEp0Packet,iEp0Size,iEp0Zlp,ep0Status); |
860 test_Value(r, r == KErrNone || r == KErrCompletion || (r == KErrAlternateSettingChanged)); |
979 test_Value(r, r == KErrNone || r == KErrCompletion || (r == KErrAlternateSettingChanged)); |
861 while (r == KErrNone) |
980 while (r == KErrNone) |
862 { |
981 { |
863 TUSB_VERBOSE_PRINT("Waiting for Ep0 data packet"); |
982 TUSB_VERBOSE_PRINT("Waiting for Ep0 data packet"); |
|
983 if(gVerbose) |
|
984 { |
|
985 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP03, "Waiting for Ep0 data packet"); |
|
986 } |
864 User::WaitForRequest(ep0Status); |
987 User::WaitForRequest(ep0Status); |
865 test_KErrNone(ep0Status.Int()); |
988 test_KErrNone(ep0Status.Int()); |
866 r = iEp0Buf.GetBuffer (iEp0Packet,iEp0Size,iEp0Zlp,ep0Status); |
989 r = iEp0Buf.GetBuffer (iEp0Packet,iEp0Size,iEp0Zlp,ep0Status); |
867 test_Value(r, r == KErrNone || r == KErrCompletion || (r == KErrAlternateSettingChanged)); |
990 test_Value(r, r == KErrNone || r == KErrCompletion || (r == KErrAlternateSettingChanged)); |
868 } |
991 } |
869 TUSB_VERBOSE_PRINT1("Ep0 data packet - size %d",iEp0Size); |
992 TUSB_VERBOSE_PRINT1("Ep0 data packet - size %d",iEp0Size); |
870 iEp0DataBuffer.Append((TUint8 *)iEp0Packet,iEp0Size); |
993 if(gVerbose) |
|
994 { |
|
995 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP04, "Ep0 data packet - size %d",iEp0Size); |
|
996 } |
|
997 iEp0DataBuffer.Append((TUint8 *)iEp0Packet,iEp0Size); |
871 #else |
998 #else |
872 TUint16 packetLength = Min(length-iEp0DataBuffer.Length(),iEp0PacketSize); |
999 TUint16 packetLength = Min(length-iEp0DataBuffer.Length(),iEp0PacketSize); |
873 iPort[0].ReadPacket(ep0Status, EEndpoint0, ep0DataPacket, packetLength); |
1000 iPort[0].ReadPacket(ep0Status, EEndpoint0, ep0DataPacket, packetLength); |
874 User::WaitForRequest(ep0Status); |
1001 User::WaitForRequest(ep0Status); |
875 if (ep0Status == KErrNone) |
1002 if (ep0Status == KErrNone) |
876 { |
1003 { |
877 iEp0DataBuffer.Append(ep0DataPacket); |
1004 iEp0DataBuffer.Append(ep0DataPacket); |
878 } |
1005 } |
879 else |
1006 else |
880 { |
1007 { |
881 TUSB_PRINT1("ActiveControl::Error %d in Ep0 Read Data Packet", ep0Status.Int()); |
1008 TUSB_PRINT1("ActiveControl::Error %d in Ep0 Read Data Packet", ep0Status.Int()); |
|
1009 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP05, "ActiveControl::Error %d in Ep0 Read Data Packet", ep0Status.Int()); |
882 test(EFalse); |
1010 test(EFalse); |
883 return KErrNone; |
1011 return KErrNone; |
884 } |
1012 } |
885 #endif |
1013 #endif |
886 } |
1014 } |
887 TUSB_VERBOSE_PRINT4("Setup ToDevice Type %d length %d value %d index %d",iEp0SetUpPacket[KUsb_Ep0RequestOffset],length,value,index); |
1015 TUSB_VERBOSE_PRINT4("Setup ToDevice Type %d length %d value %d index %d",iEp0SetUpPacket[KUsb_Ep0RequestOffset],length,value,index); |
|
1016 if(gVerbose) |
|
1017 { |
|
1018 OstTraceExt4(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP06, "Setup ToDevice Type %d length %d value %d index %d",iEp0SetUpPacket[KUsb_Ep0RequestOffset],length,value,index); |
|
1019 } |
888 sendStatus = ETrue; |
1020 sendStatus = ETrue; |
889 switch (iEp0SetUpPacket[KUsb_Ep0RequestOffset]) |
1021 switch (iEp0SetUpPacket[KUsb_Ep0RequestOffset]) |
890 { |
1022 { |
891 case EStop : |
1023 case EStop : |
892 // send this now as the port will be disconnected |
1024 // send this now as the port will be disconnected |
893 sendStatus = EFalse; |
1025 sendStatus = EFalse; |
894 r = iPort[0].SendEp0StatusPacket(); |
1026 r = iPort[0].SendEp0StatusPacket(); |
895 test_KErrNone(r); |
1027 test_KErrNone(r); |
896 |
1028 |
897 if (value && firstBulkOutEndpoint > 0) |
1029 if (value && firstBulkOutEndpoint > 0) |
898 { |
1030 { |
899 PrintHostLog(); |
1031 PrintHostLog(); |
900 } |
1032 } |
901 |
1033 |
902 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
1034 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
903 { |
1035 { |
904 // base class cancel -> calls our DoCancel |
1036 // base class cancel -> calls our DoCancel |
905 delete iDeviceStateNotifier[portNumber]; |
1037 delete iDeviceStateNotifier[portNumber]; |
906 delete iStallNotifier[portNumber]; |
1038 delete iStallNotifier[portNumber]; |
908 { |
1040 { |
909 r = iPort[portNumber].RemoveStringDescriptor(stridx1); |
1041 r = iPort[portNumber].RemoveStringDescriptor(stridx1); |
910 if (r != KErrNone) |
1042 if (r != KErrNone) |
911 { |
1043 { |
912 TUSB_PRINT1("Error %d on string removal", r); |
1044 TUSB_PRINT1("Error %d on string removal", r); |
|
1045 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP07, "Error %d on string removal", r); |
913 } |
1046 } |
914 r = iPort[portNumber].RemoveStringDescriptor(stridx2); |
1047 r = iPort[portNumber].RemoveStringDescriptor(stridx2); |
915 if (r != KErrNone) |
1048 if (r != KErrNone) |
916 { |
1049 { |
917 TUSB_PRINT1("Error %d on string removal", r); |
1050 TUSB_PRINT1("Error %d on string removal", r); |
918 } |
1051 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP08, "Error %d on string removal", r); |
|
1052 } |
919 } |
1053 } |
920 TUSB_VERBOSE_PRINT1 ("Closing USB channel number %d",portNumber); |
1054 TUSB_VERBOSE_PRINT1 ("Closing USB channel number %d",portNumber); |
|
1055 if(gVerbose) |
|
1056 { |
|
1057 OstTrace1 (TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP09, "Closing USB channel number %d",portNumber); |
|
1058 } |
|
1059 #ifdef USB_SC |
|
1060 RChunk* commChunk; |
|
1061 User::LeaveIfError(iPort[portNumber].GetDataTransferChunk(commChunk)); |
|
1062 commChunk->Close(); |
|
1063 #endif |
921 iPort[portNumber].Close(); // close USB channel |
1064 iPort[portNumber].Close(); // close USB channel |
922 } |
1065 } |
923 TUSB_VERBOSE_PRINT("Closing Idle Counter Thread"); |
1066 TUSB_VERBOSE_PRINT("Closing Idle Counter Thread"); |
|
1067 if(gVerbose) |
|
1068 { |
|
1069 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP10, "Closing Idle Counter Thread"); |
|
1070 } |
924 iIdleCounter->iCommand = ETestIdleCounterClose; |
1071 iIdleCounter->iCommand = ETestIdleCounterClose; |
925 iIdleCounterChunk.Close(); |
1072 iIdleCounterChunk.Close(); |
926 // Allow time for low-priority thread to close |
1073 // Allow time for low-priority thread to close |
927 User::After(100000); |
1074 User::After(100000); |
928 iIdleCounterThread.Close(); |
1075 iIdleCounterThread.Close(); |
929 |
1076 |
930 CActiveScheduler::Stop(); |
1077 CActiveScheduler::Stop(); |
931 break; |
1078 break; |
932 |
1079 |
933 case EVersion : |
1080 case EVersion : |
934 TUSB_PRINT("Receiving t_usb_host version"); |
1081 TUSB_PRINT("Receiving t_usb_host version"); |
|
1082 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP11, "Receiving t_usb_host version"); |
935 host_ver_major = iEp0DataBuffer[0]; |
1083 host_ver_major = iEp0DataBuffer[0]; |
936 host_ver_minor = iEp0DataBuffer[1]; |
1084 host_ver_minor = iEp0DataBuffer[1]; |
937 host_ver_micro = iEp0DataBuffer[2]; |
1085 host_ver_micro = iEp0DataBuffer[2]; |
938 usbio_ver_major = iEp0DataBuffer[3]; |
1086 usbio_ver_major = iEp0DataBuffer[3]; |
939 usbio_ver_minor = iEp0DataBuffer[4]; |
1087 usbio_ver_minor = iEp0DataBuffer[4]; |
940 TUSB_PRINT5("Host-side: t_usb_host v%d.%d.%d USBIO v%d.%d\n", |
1088 TUSB_PRINT5("Host-side: t_usb_host v%d.%d.%d USBIO v%d.%d\n", |
941 host_ver_major, host_ver_minor, host_ver_micro, |
1089 host_ver_major, host_ver_minor, host_ver_micro, |
942 usbio_ver_major, usbio_ver_minor); |
1090 usbio_ver_major, usbio_ver_minor); |
|
1091 OstTraceExt5(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP12, "Host-side: t_usb_host v%d.%d.%d USBIO v%d.%d\n", |
|
1092 host_ver_major, host_ver_minor, host_ver_micro, |
|
1093 usbio_ver_major, usbio_ver_minor); |
943 if (host_ver_major < KHostVersionMajor) |
1094 if (host_ver_major < KHostVersionMajor) |
944 { |
1095 { |
945 TUSB_PRINT1("t_usb_host version not sufficient (need at least v%d.x.x)\n",KHostVersionMajor); |
1096 TUSB_PRINT1("t_usb_host version not sufficient (need at least v%d.x.x)\n",KHostVersionMajor); |
|
1097 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP13, "t_usb_host version not sufficient (need at least v%d.x.x)\n",KHostVersionMajor); |
946 User::Leave(-1); |
1098 User::Leave(-1); |
947 return KErrNone; |
1099 return KErrNone; |
948 } |
1100 } |
949 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
1101 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
950 // GCC compiler warning because Kxxx can also be zero (in which case there's no '<'). |
1102 // GCC compiler warning because Kxxx can also be zero (in which case there's no '<'). |
951 else if ((host_ver_minor <= KHostVersionMinor) && |
1103 else if ((host_ver_minor <= KHostVersionMinor) && |
952 !(host_ver_minor == KHostVersionMinor)) |
1104 !(host_ver_minor == KHostVersionMinor)) |
953 { |
1105 { |
954 TUSB_PRINT2("t_usb_host version not sufficient (need at least v%d.%d.x)\n", |
1106 TUSB_PRINT2("t_usb_host version not sufficient (need at least v%d.%d.x)\n", |
955 KHostVersionMajor, KHostVersionMinor); |
1107 KHostVersionMajor, KHostVersionMinor); |
|
1108 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP14, "t_usb_host version not sufficient (need at least v%d.%d.x)\n", |
|
1109 KHostVersionMajor, KHostVersionMinor); |
956 test(EFalse); |
1110 test(EFalse); |
957 return KErrNone; |
1111 return KErrNone; |
958 } |
1112 } |
959 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
1113 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
960 // GCC compiler warning because Kxxx can also be zero (in which case there's no '<'). |
1114 // GCC compiler warning because Kxxx can also be zero (in which case there's no '<'). |
961 else if ((host_ver_micro <= KHostVersionMicro) && |
1115 else if ((host_ver_micro <= KHostVersionMicro) && |
962 !(host_ver_micro == KHostVersionMicro)) |
1116 !(host_ver_micro == KHostVersionMicro)) |
963 { |
1117 { |
964 TUSB_PRINT3("USBRFLCT version not sufficient (need at least v%d.%d.%d)\n", |
1118 TUSB_PRINT3("USBRFLCT version not sufficient (need at least v%d.%d.%d)\n", |
|
1119 KHostVersionMajor, KHostVersionMinor, KHostVersionMicro); |
|
1120 OstTraceExt3(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP15, "USBRFLCT version not sufficient (need at least v%d.%d.%d)\n", |
965 KHostVersionMajor, KHostVersionMinor, KHostVersionMicro); |
1121 KHostVersionMajor, KHostVersionMinor, KHostVersionMicro); |
966 test(EFalse); |
1122 test(EFalse); |
967 return KErrNone; |
1123 return KErrNone; |
968 } |
1124 } |
969 break; |
1125 break; |
970 |
1126 |
971 case ETestParam : |
1127 case ETestParam : |
972 tpPtr = (TestParamPtr)(&iEp0DataBuffer[0]); |
1128 tpPtr = (TestParamPtr)(&iEp0DataBuffer[0]); |
973 TUSB_VERBOSE_PRINT4("Test Params - interface %d repeat %d settingRepeat %d beforeIndex %d",tpPtr->interfaceNumber,tpPtr->repeat,tpPtr->settingRepeat,tpPtr->beforeIndex); |
1129 TUSB_VERBOSE_PRINT4("Test Params - interface %d repeat %d settingRepeat %d beforeIndex %d",tpPtr->interfaceNumber,tpPtr->repeat,tpPtr->settingRepeat,tpPtr->beforeIndex); |
|
1130 if(gVerbose) |
|
1131 { |
|
1132 OstTraceExt4(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP16, "Test Params - interface %d repeat %d settingRepeat %d beforeIndex %d",tpPtr->interfaceNumber,tpPtr->repeat,tpPtr->settingRepeat,tpPtr->beforeIndex); |
|
1133 } |
974 if (index >= KMaxConcurrentTests) |
1134 if (index >= KMaxConcurrentTests) |
975 { |
1135 { |
976 TUSB_PRINT2("Test index %d is greater than maximum allowed (%d) concurrent tests",index,KMaxConcurrentTests); |
1136 TUSB_PRINT2("Test index %d is greater than maximum allowed (%d) concurrent tests",index,KMaxConcurrentTests); |
|
1137 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP17, "Test index %d is greater than maximum allowed (%d) concurrent tests",index,KMaxConcurrentTests); |
977 test(EFalse); |
1138 test(EFalse); |
978 return KErrNone; |
1139 return KErrNone; |
979 } |
1140 } |
980 // Create Reader/Writer active object |
1141 // Create Reader/Writer active object |
981 pActiveRW = CActiveRW::NewL(iConsole, &iPort[gInterfaceConfig[tpPtr->interfaceNumber][tpPtr->alternateSetting]->iPortNumber], iFs, index, lastSettingThread); |
1142 pActiveRW = CActiveRW::NewL(iConsole, &iPort[gInterfaceConfig[tpPtr->interfaceNumber][tpPtr->alternateSetting]->iPortNumber], iFs, index, lastSettingThread); |
982 if (!pActiveRW) |
1143 if (!pActiveRW) |
983 { |
1144 { |
984 TUSB_PRINT("Failed to create reader/writer"); |
1145 TUSB_PRINT("Failed to create reader/writer"); |
|
1146 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP18, "Failed to create reader/writer"); |
985 test(EFalse); |
1147 test(EFalse); |
986 return KErrNone; |
1148 return KErrNone; |
987 } |
1149 } |
988 TUSB_VERBOSE_PRINT("Created reader/writer"); |
1150 TUSB_VERBOSE_PRINT("Created reader/writer"); |
|
1151 if(gVerbose) |
|
1152 { |
|
1153 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP19, "Created reader/writer"); |
|
1154 } |
989 pActiveRW->SetTestParams(tpPtr); |
1155 pActiveRW->SetTestParams(tpPtr); |
990 switch (value) |
1156 switch (value) |
991 { |
1157 { |
992 case 'X' : |
1158 case 'X' : |
993 test.Start (_L("Xml")); |
1159 test.Start (_L("Xml")); |
994 break; |
1160 break; |
995 |
1161 |
996 case 'L' : |
1162 case 'L' : |
997 test.Start (_L("Loop")); |
1163 test.Start (_L("Loop")); |
998 pActiveRW->SetTransferMode(ELoop); |
1164 pActiveRW->SetTransferMode(ELoop); |
999 gAltSettingOnNotify = ETrue; |
1165 gAltSettingOnNotify = ETrue; |
1000 if (tpPtr->settingRepeat && !firstSettingThread) |
1166 if (tpPtr->settingRepeat && !firstSettingThread) |
1001 { |
1167 { |
1002 pActiveRW->Suspend(ESuspend); |
1168 pActiveRW->Suspend(ESuspend); |
1003 } |
1169 } |
1004 else |
1170 else |
1005 { |
1171 { |
1006 pActiveRW->StartOrSuspend(); |
1172 pActiveRW->StartOrSuspend(); |
1007 } |
1173 } |
1008 break; |
1174 break; |
1009 |
1175 |
1010 case 'C' : |
1176 case 'C' : |
1011 test.Start (_L("Compare")); |
1177 test.Start (_L("Compare")); |
1012 pActiveRW->SetTransferMode(ELoopComp); |
1178 pActiveRW->SetTransferMode(ELoopComp); |
1013 gAltSettingOnNotify = ETrue; |
1179 gAltSettingOnNotify = ETrue; |
1014 if (tpPtr->settingRepeat && !firstSettingThread) |
1180 if (tpPtr->settingRepeat && !firstSettingThread) |
1015 { |
1181 { |
1016 pActiveRW->Suspend(ESuspend); |
1182 pActiveRW->Suspend(ESuspend); |
1017 } |
1183 } |
1018 else |
1184 else |
1019 { |
1185 { |
1020 pActiveRW->StartOrSuspend(); |
1186 pActiveRW->StartOrSuspend(); |
1021 } |
1187 } |
1022 break; |
1188 break; |
1023 |
1189 |
1024 case 'S' : |
1190 case 'S' : |
1025 test.Start (_L("Stream")); |
1191 test.Start (_L("Stream")); |
1026 if (tpPtr->outPipe > KMaxEndpointsPerClient) |
1192 if (tpPtr->outPipe > KMaxEndpointsPerClient) |
1027 { |
1193 { |
1028 pActiveRW->SetTransferMode(ETransmitOnly); |
1194 pActiveRW->SetTransferMode(ETransmitOnly); |
1029 gAltSettingOnNotify = ETrue; |
1195 gAltSettingOnNotify = ETrue; |
1030 if (tpPtr->settingRepeat && !firstSettingThread) |
1196 if (tpPtr->settingRepeat && !firstSettingThread) |
1031 { |
1197 { |
1032 pActiveRW->Suspend(ESuspend); |
1198 pActiveRW->Suspend(ESuspend); |
1033 } |
1199 } |
1034 else |
1200 else |
1035 { |
1201 { |
1036 pActiveRW->StartOrSuspend(); |
1202 pActiveRW->StartOrSuspend(); |
1037 } |
1203 } |
1038 } |
1204 } |
1039 else |
1205 else |
1040 { |
1206 { |
1041 pActiveRW->SetTransferMode(EReceiveOnly); |
1207 pActiveRW->SetTransferMode(EReceiveOnly); |
1042 gAltSettingOnNotify = ETrue; |
1208 gAltSettingOnNotify = ETrue; |
1043 if (tpPtr->settingRepeat && !firstSettingThread) |
1209 if (tpPtr->settingRepeat && !firstSettingThread) |
1044 { |
1210 { |
1045 pActiveRW->Suspend(ESuspend); |
1211 pActiveRW->Suspend(ESuspend); |
1046 } |
1212 } |
1047 else |
1213 else |
1048 { |
1214 { |
1049 pActiveRW->StartOrSuspend(); |
1215 pActiveRW->StartOrSuspend(); |
1050 } |
1216 } |
1051 } |
1217 } |
1052 break; |
1218 break; |
1053 |
1219 |
1054 case 'F' : |
1220 case 'F' : |
1055 test.Start (_L("File")); |
1221 test.Start (_L("File")); |
1056 // send this now as the file setup takes a long time |
1222 // send this now as the file setup takes a long time |
1057 sendStatus = EFalse; |
1223 sendStatus = EFalse; |
1058 r = iPort[0].SendEp0StatusPacket(); |
1224 r = iPort[0].SendEp0StatusPacket(); |
1059 test_KErrNone(r); |
1225 test_KErrNone(r); |
1060 if (tpPtr->outPipe > KMaxEndpointsPerClient) |
1226 if (tpPtr->outPipe > KMaxEndpointsPerClient) |
1061 { |
1227 { |
1062 pActiveRW->SetTransferMode(ETransmitOnly); |
1228 pActiveRW->SetTransferMode(ETransmitOnly); |
1063 TInt maxFileSize = tpPtr->maxSize * tpPtr->repeat; |
1229 TInt maxFileSize = tpPtr->maxSize * tpPtr->repeat; |
1064 pActiveRW->ReadFromDisk((TChar)tpPtr->minSize,maxFileSize); |
1230 pActiveRW->ReadFromDisk((TChar)tpPtr->minSize,maxFileSize); |
1065 gAltSettingOnNotify = ETrue; |
1231 gAltSettingOnNotify = ETrue; |
1066 if (tpPtr->settingRepeat && !firstSettingThread) |
1232 if (tpPtr->settingRepeat && !firstSettingThread) |
1067 { |
1233 { |
1068 pActiveRW->Suspend(ESuspend); |
1234 pActiveRW->Suspend(ESuspend); |
1069 } |
1235 } |
1070 else |
1236 else |
1071 { |
1237 { |
1072 pActiveRW->StartOrSuspend(); |
1238 pActiveRW->StartOrSuspend(); |
1073 } |
1239 } |
1074 } |
1240 } |
1075 else |
1241 else |
1076 { |
1242 { |
1077 pActiveRW->SetTransferMode(EReceiveOnly); |
1243 pActiveRW->SetTransferMode(EReceiveOnly); |
1078 pActiveRW->WriteToDisk((TChar)tpPtr->minSize); |
1244 pActiveRW->WriteToDisk((TChar)tpPtr->minSize); |
1079 gAltSettingOnNotify = ETrue; |
1245 gAltSettingOnNotify = ETrue; |
1080 if (tpPtr->settingRepeat && !firstSettingThread) |
1246 if (tpPtr->settingRepeat && !firstSettingThread) |
1081 { |
1247 { |
1082 pActiveRW->Suspend(ESuspend); |
1248 pActiveRW->Suspend(ESuspend); |
1083 } |
1249 } |
1084 else |
1250 else |
1085 { |
1251 { |
1086 pActiveRW->StartOrSuspend(); |
1252 pActiveRW->StartOrSuspend(); |
1087 } |
1253 } |
1088 } |
1254 } |
1089 break; |
1255 break; |
1090 |
1256 |
1091 default : |
1257 default : |
1092 TUSB_PRINT1("Invalid test value %X",value); |
1258 TUSB_PRINT1("Invalid test value %X",value); |
|
1259 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP20, "Invalid test value %X",value); |
1093 test(EFalse); |
1260 test(EFalse); |
1094 } |
1261 } |
1095 |
1262 |
1096 gRW[index] = pActiveRW; |
1263 gRW[index] = pActiveRW; |
1097 break; |
1264 break; |
1098 |
1265 |
1099 case ETestResult : |
1266 case ETestResult : |
1100 TUSB_VERBOSE_PRINT2 ("Test index %d complete - value %d",index,value); |
1267 TUSB_VERBOSE_PRINT2 ("Test index %d complete - value %d",index,value); |
1101 // if failure, send this first to prevent panic corrupting EP0 |
1268 if(gVerbose) |
|
1269 { |
|
1270 OstTraceExt2 (TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP21, "Test index %d complete - value %d",index,value); |
|
1271 } |
|
1272 // if failure, send this first to prevent panic corrupting EP0 |
1102 if (!value) |
1273 if (!value) |
1103 { |
1274 { |
1104 sendStatus = EFalse; |
1275 sendStatus = EFalse; |
1105 r = iPort[0].SendEp0StatusPacket(); |
1276 r = iPort[0].SendEp0StatusPacket(); |
1106 } |
1277 } |
1107 if (index < KMaxConcurrentTests) |
1278 if (index < KMaxConcurrentTests) |
1108 { |
1279 { |
1109 if (gRW[index] != NULL) |
1280 if (gRW[index] != NULL) |
1110 { |
1281 { |
1134 break; |
1307 break; |
1135 |
1308 |
1136 case ETestConnect : |
1309 case ETestConnect : |
1137 test.Start (_L("Connect")); |
1310 test.Start (_L("Connect")); |
1138 sendStatus = EFalse; |
1311 sendStatus = EFalse; |
1139 r = iPort[0].SendEp0StatusPacket(); |
1312 r = iPort[0].SendEp0StatusPacket(); |
1140 if (iSoftwareConnect) |
1313 if (iSoftwareConnect) |
1141 { |
1314 { |
1142 r = iPort[0].DeviceDisconnectFromHost(); |
1315 r = iPort[0].DeviceDisconnectFromHost(); |
1143 test_KErrNone (r); |
1316 test_KErrNone (r); |
1144 |
1317 |
1145 TUint32 waitTime = (TUint32)value * 1000; |
1318 TUint32 waitTime = (TUint32)value * 1000; |
1146 if (waitTime == 0) |
1319 if (waitTime == 0) |
1147 { |
1320 { |
1148 waitTime = 5000; // default to 5 milliseconds |
1321 waitTime = 5000; // default to 5 milliseconds |
1149 } |
1322 } |
1150 iTimer.After(iStatus,waitTime); |
1323 iTimer.After(iStatus,waitTime); |
1151 iPending = EPendingTimer; |
1324 iPending = EPendingTimer; |
1152 |
1325 |
1153 SetActive(); |
1326 SetActive(); |
1154 } |
1327 } |
1155 else |
1328 else |
1156 { |
1329 { |
1157 iConsole->Printf(_L("This device does not support software\n")); |
1330 iConsole->Printf(_L("This device does not support software\n")); |
|
1331 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP24, "This device does not support software\n"); |
1158 iConsole->Printf(_L("disconnect/reconnect\n")); |
1332 iConsole->Printf(_L("disconnect/reconnect\n")); |
|
1333 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP25, "disconnect/reconnect\n"); |
1159 iConsole->Printf(_L("Please physically unplug and replug\n")); |
1334 iConsole->Printf(_L("Please physically unplug and replug\n")); |
|
1335 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP26, "Please physically unplug and replug\n"); |
1160 iConsole->Printf(_L("the USB cable NOW... ")); |
1336 iConsole->Printf(_L("the USB cable NOW... ")); |
|
1337 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP27, "the USB cable NOW... "); |
1161 test.End (); |
1338 test.End (); |
1162 } |
1339 } |
1163 break; |
1340 break; |
1164 |
1341 |
1165 case ETestDisconnect : |
1342 case ETestDisconnect : |
1166 test.Start (_L("Disconnect")); |
1343 test.Start (_L("Disconnect")); |
1167 // send this now as the port will be disconnected |
1344 // send this now as the port will be disconnected |
1168 sendStatus = EFalse; |
1345 sendStatus = EFalse; |
1169 r = iPort[0].SendEp0StatusPacket(); |
1346 r = iPort[0].SendEp0StatusPacket(); |
1170 if (iSoftwareConnect) |
1347 if (iSoftwareConnect) |
1171 { |
1348 { |
1172 r = iPort[0].DeviceDisconnectFromHost(); |
1349 r = iPort[0].DeviceDisconnectFromHost(); |
1173 test_KErrNone (r); |
1350 test_KErrNone (r); |
1174 } |
1351 } |
1175 else |
1352 else |
1176 { |
1353 { |
1177 iConsole->Printf(_L("This device does not support software\n")); |
1354 iConsole->Printf(_L("This device does not support software\n")); |
|
1355 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP28, "This device does not support software\n"); |
1178 iConsole->Printf(_L("disconnect/reconnect\n")); |
1356 iConsole->Printf(_L("disconnect/reconnect\n")); |
|
1357 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP29, "disconnect/reconnect\n"); |
1179 iConsole->Printf(_L("Please physically unplug and replug\n")); |
1358 iConsole->Printf(_L("Please physically unplug and replug\n")); |
|
1359 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP30, "Please physically unplug and replug\n"); |
1180 iConsole->Printf(_L("the USB cable NOW... ")); |
1360 iConsole->Printf(_L("the USB cable NOW... ")); |
1181 } |
1361 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP31, "the USB cable NOW... "); |
|
1362 } |
1182 |
1363 |
1183 test.End (); |
1364 test.End (); |
1184 break; |
1365 break; |
1185 |
1366 |
1186 case ETestMassStorage : |
1367 case ETestMassStorage : |
1187 test.Start (_L("Select Mass Storage")); |
1368 test.Start (_L("Select Mass Storage")); |
1188 |
1369 |
1189 // send this now as the port will be disconnected |
1370 // send this now as the port will be disconnected |
1190 sendStatus = EFalse; |
1371 sendStatus = EFalse; |
1191 r = iPort[0].SendEp0StatusPacket(); |
1372 r = iPort[0].SendEp0StatusPacket(); |
1192 test_KErrNone(r); |
1373 test_KErrNone(r); |
1193 |
1374 |
1194 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
1375 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
1195 { |
1376 { |
1196 delete iDeviceStateNotifier[portNumber]; |
1377 delete iDeviceStateNotifier[portNumber]; |
1197 delete iStallNotifier[portNumber]; |
1378 delete iStallNotifier[portNumber]; |
1198 if (portNumber == 0) |
1379 if (portNumber == 0) |
1199 { |
1380 { |
1200 r = iPort[portNumber].RemoveStringDescriptor(stridx1); |
1381 r = iPort[portNumber].RemoveStringDescriptor(stridx1); |
1201 if (r != KErrNone) |
1382 if (r != KErrNone) |
1202 { |
1383 { |
1203 TUSB_PRINT1("Error %d on string removal", r); |
1384 TUSB_PRINT1("Error %d on string removal", r); |
|
1385 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP32, "Error %d on string removal", r); |
1204 } |
1386 } |
1205 r = iPort[portNumber].RemoveStringDescriptor(stridx2); |
1387 r = iPort[portNumber].RemoveStringDescriptor(stridx2); |
1206 if (r != KErrNone) |
1388 if (r != KErrNone) |
1207 { |
1389 { |
1208 TUSB_PRINT1("Error %d on string removal", r); |
1390 TUSB_PRINT1("Error %d on string removal", r); |
1209 } |
1391 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP33, "Error %d on string removal", r); |
|
1392 } |
1210 } |
1393 } |
1211 TUSB_VERBOSE_PRINT1 ("Closing USB channel number %d",portNumber); |
1394 TUSB_VERBOSE_PRINT1 ("Closing USB channel number %d",portNumber); |
|
1395 if(gVerbose) |
|
1396 { |
|
1397 OstTrace1 (TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP34, "Closing USB channel number %d",portNumber); |
|
1398 } |
|
1399 #ifdef USB_SC |
|
1400 RChunk* commChunk; |
|
1401 User::LeaveIfError(iPort[portNumber].GetDataTransferChunk(commChunk)); |
|
1402 commChunk->Close(); |
|
1403 #endif |
1212 iPort[portNumber].Close(); // close USB channel |
1404 iPort[portNumber].Close(); // close USB channel |
1213 } |
1405 } |
1214 |
1406 |
1215 r = iPort[0].Open(0); |
1407 r = iPort[0].Open(0); |
1216 test_KErrNone(r); |
1408 test_KErrNone(r); |
1217 TUSB_VERBOSE_PRINT("Successfully opened USB port"); |
1409 TUSB_VERBOSE_PRINT("Successfully opened USB port"); |
|
1410 if(gVerbose) |
|
1411 { |
|
1412 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP35, "Successfully opened USB port"); |
|
1413 } |
1218 |
1414 |
1219 SetupDescriptors(iLddPtr, &iPort[0],value); |
1415 SetupDescriptors(iLddPtr, &iPort[0],value); |
1220 StartMassStorage(&iPort[0]); |
1416 StartMassStorage(&iPort[0]); |
1221 |
1417 |
1222 test.Next (_L("Enumeration...")); |
1418 test.Next (_L("Enumeration...")); |
1223 r = ReEnumerate(); |
1419 r = ReEnumerate(); |
1224 test_KErrNone(r); |
1420 test_KErrNone(r); |
1225 |
1421 |
1226 |
1422 |
1227 test.End (); |
1423 test.End (); |
1228 break; |
1424 break; |
1356 // that prevents the readZlp flag from being set |
1560 // that prevents the readZlp flag from being set |
1357 // test_Value(r, (r == KErrNone) || (r == KErrCompletion) || (r == KErrEof)); |
1561 // test_Value(r, (r == KErrNone) || (r == KErrCompletion) || (r == KErrEof)); |
1358 if (r == KErrCompletion) |
1562 if (r == KErrCompletion) |
1359 { |
1563 { |
1360 TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readSize); |
1564 TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readSize); |
|
1565 if(gVerbose) |
|
1566 { |
|
1567 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP01, "Host log file %d bytes read\n",readSize); |
|
1568 } |
1361 scCharPtr = (TUint8 *)scReadData; |
1569 scCharPtr = (TUint8 *)scReadData; |
1362 // Print the host log file |
1570 // Print the host log file |
1363 for (TUint i = 0; i < readSize; i++) |
1571 for (TUint i = 0; i < readSize; i++) |
1364 { |
1572 { |
1365 if (* scCharPtr == '\r') |
1573 if (* scCharPtr == '\r') |
1366 { |
1574 { |
1367 lineBuf[j++] = '\0'; |
1575 lineBuf[j++] = '\0'; |
1368 RDebug::Print (_L("%s"),lineBuf); |
1576 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP02, "%S",*lineBuf); |
1369 j = 0; |
1577 j = 0; |
1370 } |
1578 } |
1371 else |
1579 else |
1372 { |
1580 { |
1373 if (* scCharPtr != '\n') |
1581 if (* scCharPtr != '\n') |
1374 { |
1582 { |
1375 lineBuf[j++] = * scCharPtr; |
1583 lineBuf[j++] = * scCharPtr; |
1376 } |
1584 } |
1377 } |
1585 } |
1378 scCharPtr++; |
1586 scCharPtr++; |
1379 } |
1587 } |
1380 } |
1588 } |
1381 if (r == KErrNone) |
1589 if (r == KErrNone) |
1382 { |
1590 { |
1383 User::WaitForRequest(status); |
1591 User::WaitForRequest(status); |
1384 test_KErrNone(status.Int()); |
1592 test_KErrNone(status.Int()); |
1385 } |
1593 } |
1386 } |
1594 } |
1387 while (r >= KErrNone && !readZlp); |
1595 while (r >= KErrNone && !readZlp); |
1388 #else |
1596 #else |
1389 TPtr8 readBuf((TUint8 *)User::Alloc(KHostLogFileSize),KHostLogFileSize,KHostLogFileSize); |
1597 TPtr8 readBuf((TUint8 *)User::Alloc(KHostLogFileSize),KHostLogFileSize,KHostLogFileSize); |
1390 iPort[0].ReadUntilShort(status, (TEndpointNumber)firstBulkOutEndpoint, readBuf); |
1598 iPort[0].ReadUntilShort(status, (TEndpointNumber)firstBulkOutEndpoint, readBuf); |
1391 User::WaitForRequest(status); |
1599 User::WaitForRequest(status); |
1392 test_KErrNone(status.Int()); |
1600 test_KErrNone(status.Int()); |
1393 TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readBuf.Length()); |
1601 TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readBuf.Length()); |
|
1602 if(gVerbose) |
|
1603 { |
|
1604 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP03, "Host log file %d bytes read\n",readBuf.Length()); |
|
1605 } |
1394 for (TUint i = 0; i < readBuf.Length(); i++) |
1606 for (TUint i = 0; i < readBuf.Length(); i++) |
1395 { |
1607 { |
1396 if (readBuf[i] == '\r') |
1608 if (readBuf[i] == '\r') |
1397 { |
1609 { |
1398 lineBuf[j++] = '\0'; |
1610 lineBuf[j++] = '\0'; |
1399 RDebug::Print (_L("%s"),lineBuf); |
1611 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP04, "%s",*lineBuf); |
1400 j = 0; |
1612 j = 0; |
1401 } |
1613 } |
1402 else |
1614 else |
1403 { |
1615 { |
1404 if (readBuf[i] != '\n') |
1616 if (readBuf[i] != '\n') |
1405 { |
1617 { |
1406 lineBuf[j++] = readBuf[i]; |
1618 lineBuf[j++] = readBuf[i]; |
1407 } |
1619 } |
1408 } |
1620 } |
1409 } |
1621 } |
1410 User::Free ((TAny *)readBuf.Ptr()); |
1622 User::Free ((TAny *)readBuf.Ptr()); |
1411 #endif |
1623 #endif |
1412 } |
1624 } |
1413 |
1625 |
1414 void CActiveControl::QueryUsbClientL(LDDConfigPtr aLddPtr, RDEVCLIENT* aPort) |
1626 void CActiveControl::QueryUsbClientL(LDDConfigPtr aLddPtr, RDEVCLIENT* aPort) |
1415 { |
1627 { |
1416 // Get device/endpoint capabilities |
1628 // Get device/endpoint capabilities |
1417 // |
1629 // |
1418 // A TPckg, or TPckBuf was not used in the following, because |
1630 // A TPckg, or TPckBuf was not used in the following, because |
1436 // TPtr8 databuf(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
1648 // TPtr8 databuf(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
1437 // |
1649 // |
1438 |
1650 |
1439 // Device |
1651 // Device |
1440 // === Device Descriptor |
1652 // === Device Descriptor |
1441 |
1653 |
1442 test.Start(_L("Query device and Endpoint Capabilities")); |
1654 test.Start(_L("Query device and Endpoint Capabilities")); |
1443 |
1655 |
1444 |
1656 |
1445 TUsbDeviceCaps d_caps; |
1657 TUsbDeviceCaps d_caps; |
1446 TInt r = aPort->DeviceCaps(d_caps); |
1658 TInt r = aPort->DeviceCaps(d_caps); |
1447 test_KErrNone(r); |
1659 test_KErrNone(r); |
1448 |
1660 |
1449 const TInt n = d_caps().iTotalEndpoints; |
1661 const TInt n = d_caps().iTotalEndpoints; |
1450 |
1662 |
1451 TUSB_PRINT("### USB device capabilities:"); |
1663 TUSB_PRINT("### USB device capabilities:"); |
|
1664 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL, "### USB device capabilities:"); |
1452 TUSB_PRINT1("Number of endpoints: %d", n); |
1665 TUSB_PRINT1("Number of endpoints: %d", n); |
|
1666 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP01, "Number of endpoints: %d", n); |
1453 TUSB_PRINT1("Supports Software-Connect: %s", |
1667 TUSB_PRINT1("Supports Software-Connect: %s", |
1454 d_caps().iConnect ? _S("yes") : _S("no")); |
1668 d_caps().iConnect ? _S("yes") : _S("no")); |
|
1669 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP02, "Supports Software-Connect: %s", |
|
1670 d_caps().iConnect ? _L("yes") : _S("no")); |
1455 TUSB_PRINT1("Device is Self-Powered: %s", |
1671 TUSB_PRINT1("Device is Self-Powered: %s", |
1456 d_caps().iSelfPowered ? _S("yes") : _S("no")); |
1672 d_caps().iSelfPowered ? _S("yes") : _S("no")); |
|
1673 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP03, "Device is Self-Powered: %s", |
|
1674 d_caps().iSelfPowered ? _L("yes") : _L("no")); |
1457 TUSB_PRINT1("Supports Remote-Wakeup: %s", |
1675 TUSB_PRINT1("Supports Remote-Wakeup: %s", |
1458 d_caps().iRemoteWakeup ? _S("yes") : _S("no")); |
1676 d_caps().iRemoteWakeup ? _S("yes") : _S("no")); |
|
1677 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP04, "Supports Remote-Wakeup: %s", |
|
1678 d_caps().iRemoteWakeup ? _L("yes") : _L("no")); |
1459 TUSB_PRINT1("Supports High-speed: %s", |
1679 TUSB_PRINT1("Supports High-speed: %s", |
1460 d_caps().iHighSpeed ? _S("yes") : _S("no")); |
1680 d_caps().iHighSpeed ? _S("yes") : _S("no")); |
|
1681 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP05, "Supports High-speed: %s", |
|
1682 d_caps().iHighSpeed ? _L("yes") : _L("no")); |
1461 TUSB_PRINT1("Supports unpowered cable detection: %s\n", |
1683 TUSB_PRINT1("Supports unpowered cable detection: %s\n", |
|
1684 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? |
|
1685 _S("yes") : _S("no")); |
|
1686 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP06, "Supports unpowered cable detection: %s\n", |
1462 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? |
1687 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? |
1463 _S("yes") : _S("no")); |
1688 _L("yes") : _L("no")); |
1464 TUSB_PRINT1("Supports endpoint resource allocation v2 scheme: %s\n", |
1689 TUSB_PRINT1("Supports endpoint resource allocation v2 scheme: %s\n", |
|
1690 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ? |
|
1691 _S("yes") : _S("no")); |
|
1692 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP07, "Supports endpoint resource allocation v2 scheme: %s\n", |
1465 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ? |
1693 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ? |
1466 _S("yes") : _S("no")); |
1694 _L("yes") : _L("no")); |
1467 TUSB_PRINT(""); |
1695 TUSB_PRINT(""); |
|
1696 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP08, ""); |
1468 |
1697 |
1469 iSoftwareConnect = d_caps().iConnect; // we need to remember this |
1698 iSoftwareConnect = d_caps().iConnect; // we need to remember this |
1470 test_Equal(aLddPtr->iSoftConnect,iSoftwareConnect); |
1699 test_Equal(aLddPtr->iSoftConnect,iSoftwareConnect); |
1471 |
1700 |
1472 iSupportResourceAllocationV2 = ((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0); |
1701 iSupportResourceAllocationV2 = ((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0); |
1473 |
1702 |
1474 // only check capabilities if set; therefore allowing them to be disabled |
1703 // only check capabilities if set; therefore allowing them to be disabled |
1475 if (aLddPtr->iSelfPower) |
1704 if (aLddPtr->iSelfPower) |
1476 { |
1705 { |
1477 test(d_caps().iSelfPowered); |
1706 test(d_caps().iSelfPowered); |
1478 } |
1707 } |
1479 |
1708 |
1480 // only check capabilities if set; therefore allowing them to be disabled |
1709 // only check capabilities if set; therefore allowing them to be disabled |
1481 if (aLddPtr->iRemoteWakeup) |
1710 if (aLddPtr->iRemoteWakeup) |
1482 { |
1711 { |
1483 test(d_caps().iRemoteWakeup); |
1712 test(d_caps().iRemoteWakeup); |
1484 } |
1713 } |
1485 |
1714 |
1486 test_Equal(d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower,aLddPtr->iFeatures); |
1715 test_Equal(d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower,aLddPtr->iFeatures); |
1487 |
1716 |
1488 // only check capability if set; therefore allowing it to be disabled |
1717 // only check capability if set; therefore allowing it to be disabled |
1489 if (aLddPtr->iHighSpeed) |
1718 if (aLddPtr->iHighSpeed) |
1490 { |
1719 { |
1491 test(d_caps().iHighSpeed); |
1720 test(d_caps().iHighSpeed); |
1492 } |
1721 } |
1493 |
1722 |
1494 test_Equal(aLddPtr->iNumEndpoints,n); |
1723 test_Equal(aLddPtr->iNumEndpoints,n); |
1495 |
1724 |
1496 // Endpoints |
1725 // Endpoints |
1497 TUsbcEndpointData data[KUsbcMaxEndpoints]; |
1726 TUsbcEndpointData data[KUsbcMaxEndpoints]; |
1498 TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
1727 TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
1499 r = aPort->EndpointCaps(dataptr); |
1728 r = aPort->EndpointCaps(dataptr); |
1500 test_KErrNone(r); |
1729 test_KErrNone(r); |
1501 |
1730 |
1502 TUSB_PRINT("### USB device endpoint capabilities:"); |
1731 TUSB_PRINT("### USB device endpoint capabilities:"); |
|
1732 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP09, "### USB device endpoint capabilities:"); |
1503 for (TInt i = 0; i < n; i++) |
1733 for (TInt i = 0; i < n; i++) |
1504 { |
1734 { |
1505 const TUsbcEndpointCaps* caps = &data[i].iCaps; |
1735 const TUsbcEndpointCaps* caps = &data[i].iCaps; |
1506 |
1736 |
1507 |
1737 |
1508 TBuf<40> sizeStr(_S("unknown")); |
1738 TBuf<40> sizeStr(_S("unknown")); |
1509 if (caps->iSizes == KUsbEpNotAvailable) |
1739 if (caps->iSizes == KUsbEpNotAvailable) |
1510 { |
1740 { |
1511 sizeStr = _S("Not Available"); |
1741 sizeStr = _S("Not Available"); |
1512 } |
1742 } |
1513 else |
1743 else |
1514 { |
1744 { |
1515 sizeStr.SetLength(0); |
1745 sizeStr.SetLength(0); |
1516 if (caps->iSizes & KUsbEpSizeCont) |
1746 if (caps->iSizes & KUsbEpSizeCont) |
1517 sizeStr.Append(_S(" Continuous"),11); |
1747 sizeStr.Append(_S(" Continuous"),11); |
1546 if (caps->iTypesAndDir & KUsbEpTypeBulk) |
1776 if (caps->iTypesAndDir & KUsbEpTypeBulk) |
1547 typeStr.Append(_S("Bulk "),5); |
1777 typeStr.Append(_S("Bulk "),5); |
1548 if (caps->iTypesAndDir & KUsbEpTypeInterrupt) |
1778 if (caps->iTypesAndDir & KUsbEpTypeInterrupt) |
1549 typeStr.Append(_S("Interrupt "),10); |
1779 typeStr.Append(_S("Interrupt "),10); |
1550 if (caps->iTypesAndDir & KUsbEpTypeIsochronous) |
1780 if (caps->iTypesAndDir & KUsbEpTypeIsochronous) |
1551 typeStr.Append(_S("Isochronous"),11); |
1781 typeStr.Append(_S("Isochronous"),11); |
1552 } |
1782 } |
1553 |
1783 |
1554 TBuf<20> directionStr(_S("unknown")); |
1784 TBuf<20> directionStr(_S("unknown")); |
1555 |
1785 |
1556 if (caps->iTypesAndDir & KUsbEpDirIn) |
1786 if (caps->iTypesAndDir & KUsbEpDirIn) |
1557 directionStr = _S("In"); |
1787 directionStr = _S("In"); |
1558 if (caps->iTypesAndDir & KUsbEpDirOut) |
1788 if (caps->iTypesAndDir & KUsbEpDirOut) |
1559 directionStr = _S("Out"); |
1789 directionStr = _S("Out"); |
1560 if (caps->iTypesAndDir & KUsbEpDirBidirect) |
1790 if (caps->iTypesAndDir & KUsbEpDirBidirect) |
1561 directionStr = _S("Both"); |
1791 directionStr = _S("Both"); |
1562 |
1792 |
1563 TUSB_PRINT4("Endpoint:%d Sizes =%s Type = %s - %s", |
1793 TUSB_PRINT4("Endpoint:%d Sizes =%s Type = %s - %s", |
1564 i+1,sizeStr.PtrZ(), typeStr.PtrZ(), directionStr.PtrZ()); |
1794 i+1,sizeStr.PtrZ(), typeStr.PtrZ(), directionStr.PtrZ()); |
|
1795 OstTraceExt4(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP10, "Endpoint:%d Sizes =%S Type = %S - %S", |
|
1796 i+1,sizeStr, typeStr, directionStr); |
1565 } |
1797 } |
1566 TUSB_PRINT(""); |
1798 TUSB_PRINT(""); |
|
1799 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP11, ""); |
1567 |
1800 |
1568 test.End(); |
1801 test.End(); |
1569 |
1802 |
1570 } |
1803 } |
1571 |
1804 |
1572 |
1805 |
1573 void CActiveControl::AllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1806 void CActiveControl::AllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1574 { |
1807 { |
1575 TBool res = EFalse; |
1808 TBool res = EFalse; |
1576 |
1809 |
1577 TInt r = aPort->AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
1810 TInt r = aPort->AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
1578 if (r == KErrNone) |
1811 if (r == KErrNone) |
1579 RDebug::Print(_L("DMA allocation on endpoint %d: KErrNone"), aEndpoint); |
1812 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA, "DMA allocation on endpoint %d: KErrNone", aEndpoint); |
1580 else if (r == KErrInUse) |
1813 else if (r == KErrInUse) |
1581 RDebug::Print(_L("DMA allocation on endpoint %d: KErrInUse"), aEndpoint); |
1814 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA_DUP01, "DMA allocation on endpoint %d: KErrInUse", aEndpoint); |
1582 else if (r == KErrNotSupported) |
1815 else if (r == KErrNotSupported) |
1583 RDebug::Print(_L("DMA allocation on endpoint %d: KErrNotSupported"), aEndpoint); |
1816 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA_DUP02, "DMA allocation on endpoint %d: KErrNotSupported", aEndpoint); |
1584 else |
1817 else |
1585 RDebug::Print(_L("DMA allocation on endpoint %d: unexpected return value %d"), |
1818 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA_DUP03, "DMA allocation on endpoint %d: unexpected return value %d", aEndpoint, r); |
|
1819 #ifdef USB_SC |
|
1820 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
|
1821 #else |
|
1822 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
|
1823 #endif |
|
1824 |
|
1825 TUSB_PRINT2("DMA on endpoint %d %s\n", |
|
1826 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
|
1827 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA_DUP04, "DMA on endpoint %d %S\n", |
|
1828 aEndpoint, res ? _L("allocated") : _L("not allocated")); |
|
1829 |
|
1830 if ((r == KErrNone) && !res) |
|
1831 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA_DUP05, "(Allocation success but negative query result: contradiction!\n"); |
|
1832 else if ((r != KErrNone) && res) |
|
1833 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA_DUP06, "(Allocation failure but positive query result: contradiction!\n"); |
|
1834 } |
|
1835 |
|
1836 |
|
1837 void CActiveControl::DeAllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
|
1838 { |
|
1839 TBool res = FALSE; |
|
1840 TInt r = aPort->DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
|
1841 if (r == KErrNone) |
|
1842 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_DEALLOCATEENDPOINTDMA, "DMA deallocation on endpoint %d: KErrNone", aEndpoint); |
|
1843 else if (r == KErrNotSupported) |
|
1844 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_DEALLOCATEENDPOINTDMA_DUP01, "DMA deallocation on endpoint %d: KErrNotSupported", aEndpoint); |
|
1845 else |
|
1846 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_DEALLOCATEENDPOINTDMA_DUP02, "DMA deallocation on endpoint %d: unexpected return value %d", |
1586 aEndpoint, r); |
1847 aEndpoint, r); |
1587 #ifdef USB_SC |
1848 #ifdef USB_SC |
1588 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1849 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1589 #else |
1850 #else |
1590 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1851 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1591 #endif |
1852 #endif |
1592 |
1853 |
1593 TUSB_PRINT2("DMA on endpoint %d %s\n", |
1854 TUSB_PRINT2("DMA on endpoint %d %s\n", |
1594 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1855 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1595 |
1856 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_DEALLOCATEENDPOINTDMA_DUP03, "DMA on endpoint %d %s\n", |
1596 if ((r == KErrNone) && !res) |
1857 aEndpoint, res ? _L("allocated") : _L("not allocated")); |
1597 RDebug::Print(_L("(Allocation success but negative query result: contradiction!)\n")); |
|
1598 else if ((r != KErrNone) && res) |
|
1599 RDebug::Print(_L("(Allocation failure but positive query result: contradiction!)\n")); |
|
1600 } |
|
1601 |
|
1602 |
|
1603 void CActiveControl::DeAllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
|
1604 { |
|
1605 TBool res = FALSE; |
|
1606 TInt r = aPort->DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
|
1607 if (r == KErrNone) |
|
1608 RDebug::Print(_L("DMA deallocation on endpoint %d: KErrNone"), aEndpoint); |
|
1609 else if (r == KErrNotSupported) |
|
1610 RDebug::Print(_L("DMA deallocation on endpoint %d: KErrNotSupported"), aEndpoint); |
|
1611 else |
|
1612 RDebug::Print(_L("DMA deallocation on endpoint %d: unexpected return value %d"), |
|
1613 aEndpoint, r); |
|
1614 #ifdef USB_SC |
|
1615 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
|
1616 #else |
|
1617 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
|
1618 #endif |
|
1619 |
|
1620 TUSB_PRINT2("DMA on endpoint %d %s\n", |
|
1621 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
|
1622 } |
1858 } |
1623 |
1859 |
1624 #ifndef USB_SC |
1860 #ifndef USB_SC |
1625 void CActiveControl::AllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1861 void CActiveControl::AllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1626 { |
1862 { |
1627 TBool res = FALSE; |
1863 TBool res = FALSE; |
1628 TInt r = aPort->AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1864 TInt r = aPort->AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1629 if (r == KErrNone) |
1865 if (r == KErrNone) |
1630 RDebug::Print(_L("Double Buffering allocation on endpoint %d: KErrNone"), aEndpoint); |
1866 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEDOUBLEBUFFERING, "Double Buffering allocation on endpoint %d: KErrNone", aEndpoint); |
1631 else if (r == KErrInUse) |
1867 else if (r == KErrInUse) |
1632 RDebug::Print(_L("Double Buffering allocation on endpoint %d: KErrInUse"), aEndpoint); |
1868 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEDOUBLEBUFFERING_DUP01, "Double Buffering allocation on endpoint %d: KErrInUse", aEndpoint); |
1633 else if (r == KErrNotSupported) |
1869 else if (r == KErrNotSupported) |
1634 RDebug::Print(_L("Double Buffering allocation on endpoint %d: KErrNotSupported"), aEndpoint); |
1870 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEDOUBLEBUFFERING_DUP02, "Double Buffering allocation on endpoint %d: KErrNotSupported", aEndpoint); |
1635 else |
1871 else |
1636 RDebug::Print(_L("Double Buffering allocation on endpoint %d: unexpected return value %d"), |
1872 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEDOUBLEBUFFERING_DUP03, "Double Buffering allocation on endpoint %d: unexpected return value %d", |
1637 aEndpoint, r); |
1873 aEndpoint, r); |
1638 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1874 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1639 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1875 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1640 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1876 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
|
1877 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEDOUBLEBUFFERING_DUP04, "Double Buffering on endpoint %d %s\n", |
|
1878 aEndpoint, res ? _L("allocated") : _L("not allocated")); |
1641 |
1879 |
1642 if ((r == KErrNone) && !res) |
1880 if ((r == KErrNone) && !res) |
1643 RDebug::Print(_L("(Allocation success but negative query result: contradiction!)\n")); |
1881 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEDOUBLEBUFFERING_DUP05, "(Allocation success but negative query result: contradiction!\n"); |
1644 else if ((r != KErrNone) && res) |
1882 else if ((r != KErrNone) && res) |
1645 RDebug::Print(_L("(Allocation failure but positive query result: contradiction!)\n")); |
1883 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEDOUBLEBUFFERING_DUP06, "(Allocation failure but positive query result: contradiction!\n"); |
1646 } |
1884 } |
1647 |
1885 |
1648 |
1886 |
1649 void CActiveControl::DeAllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1887 void CActiveControl::DeAllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1650 { |
1888 { |
1651 TInt r = aPort->DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1889 TInt r = aPort->DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1652 if (r == KErrNone) |
1890 if (r == KErrNone) |
1653 RDebug::Print(_L("Double Buffering deallocation on endpoint %d: KErrNone"), aEndpoint); |
1891 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_DEALLOCATEDOUBLEBUFFERING, "Double Buffering deallocation on endpoint %d: KErrNone", aEndpoint); |
1654 else if (r == KErrNotSupported) |
1892 else if (r == KErrNotSupported) |
1655 RDebug::Print(_L("Double Buffering deallocation on endpoint %d: KErrNotSupported"), aEndpoint); |
1893 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_DEALLOCATEDOUBLEBUFFERING_DUP01, "Double Buffering deallocation on endpoint %d: KErrNotSupported", aEndpoint); |
1656 else |
1894 else |
1657 RDebug::Print(_L("Double Buffering deallocation on endpoint %d: unexpected return value %d"), |
1895 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_DEALLOCATEDOUBLEBUFFERING_DUP02, "Double Buffering deallocation on endpoint %d: unexpected return value %d", |
1658 aEndpoint, r); |
1896 aEndpoint, r); |
1659 TBool res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1897 TBool res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1660 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1898 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1661 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1899 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
|
1900 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_DEALLOCATEDOUBLEBUFFERING_DUP03, "Double Buffering on endpoint %d %s\n", |
|
1901 aEndpoint, res ? _L("allocated") : _L("not allocated")); |
1662 } |
1902 } |
1663 |
1903 |
1664 #endif |
1904 #endif |
1665 |
1905 |
1666 TInt CActiveControl::ReEnumerate() |
1906 TInt CActiveControl::ReEnumerate() |
1696 ((device_state == EUsbcDeviceStateDefault) ? _S("Default") : |
1943 ((device_state == EUsbcDeviceStateDefault) ? _S("Default") : |
1697 ((device_state == EUsbcDeviceStateAddress) ? _S("Address") : |
1944 ((device_state == EUsbcDeviceStateAddress) ? _S("Address") : |
1698 ((device_state == EUsbcDeviceStateConfigured) ? _S("Configured") : |
1945 ((device_state == EUsbcDeviceStateConfigured) ? _S("Configured") : |
1699 ((device_state == EUsbcDeviceStateSuspended) ? _S("Suspended") : |
1946 ((device_state == EUsbcDeviceStateSuspended) ? _S("Suspended") : |
1700 _S("Unknown")))))))); |
1947 _S("Unknown")))))))); |
|
1948 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_REENUMERATE_DUP07, "Current device state: %s", |
|
1949 (device_state == EUsbcDeviceStateUndefined) ? _L("Undefined") : |
|
1950 ((device_state == EUsbcDeviceStateAttached) ? _L("Attached") : |
|
1951 ((device_state == EUsbcDeviceStatePowered) ? _L("Powered") : |
|
1952 ((device_state == EUsbcDeviceStateDefault) ? _L("Default") : |
|
1953 ((device_state == EUsbcDeviceStateAddress) ? _L("Address") : |
|
1954 ((device_state == EUsbcDeviceStateConfigured) ? _L("Configured") : |
|
1955 ((device_state == EUsbcDeviceStateSuspended) ? _L("Suspended") : |
|
1956 _L("Unknown")))))))); |
1701 } |
1957 } |
1702 |
1958 |
1703 // Check the speed of the established physical USB connection |
1959 // Check the speed of the established physical USB connection |
1704 iHighSpeed = iPort[0].CurrentlyUsingHighSpeed(); |
1960 iHighSpeed = iPort[0].CurrentlyUsingHighSpeed(); |
1705 if (iHighSpeed) |
1961 if (iHighSpeed) |
1706 { |
1962 { |
1707 TUSB_PRINT("---> USB High-speed Testing\n"); |
1963 TUSB_PRINT("---> USB High-speed Testing\n"); |
|
1964 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_REENUMERATE_DUP08, "---> USB High-speed Testing\n"); |
1708 } |
1965 } |
1709 else |
1966 else |
1710 { |
1967 { |
1711 TUSB_PRINT("---> USB Full-speed Testing\n"); |
1968 TUSB_PRINT("---> USB Full-speed Testing\n"); |
|
1969 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_REENUMERATE_DUP09, "---> USB Full-speed Testing\n"); |
1712 } |
1970 } |
1713 |
1971 |
1714 return KErrNone; |
1972 return KErrNone; |
1715 } |
1973 } |
1716 |
1974 |
|
1975 |
|
1976 #ifdef USB_SC |
|
1977 |
|
1978 void CActiveControl::SetupTransferedInterface(IFConfigPtr* aIfPtr, TInt aPortNumber) |
|
1979 { |
|
1980 TInt r; |
|
1981 TUSB_VERBOSE_PRINT1("SetupTransferedInterface %d", aPortNumber); |
|
1982 if(gVerbose) |
|
1983 { |
|
1984 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_SETUPTRANSFEREDINTERFACE, "SetupTransferedInterface %d", aPortNumber); |
|
1985 } |
|
1986 test.Start (_L("Setup Transfered Interface ")); |
|
1987 |
|
1988 #ifdef USB_SC |
|
1989 TUsbcScInterfaceInfoBuf ifc = *((*aIfPtr)->iInfoPtr); |
|
1990 #else |
|
1991 TUsbcInterfaceInfoBuf ifc = *((*aIfPtr)->iInfoPtr); |
|
1992 #endif |
|
1993 |
|
1994 TBuf8<KUsbDescSize_Interface> ifDescriptor; |
|
1995 r = iPort[aPortNumber].GetInterfaceDescriptor(0, ifDescriptor); |
|
1996 test_KErrNone(r); |
|
1997 |
|
1998 // Check the interface descriptor |
|
1999 test(ifDescriptor[KIfcDesc_SettingOffset] == 0 && ifDescriptor[KIfcDesc_NumEndpointsOffset] == (*aIfPtr)->iInfoPtr->iTotalEndpointsUsed && |
|
2000 ifDescriptor[KIfcDesc_ClassOffset] == (*aIfPtr)->iInfoPtr->iClass.iClassNum && |
|
2001 ifDescriptor[KIfcDesc_SubClassOffset] == (*aIfPtr)->iInfoPtr->iClass.iSubClassNum && |
|
2002 ifDescriptor[KIfcDesc_ProtocolOffset] == (*aIfPtr)->iInfoPtr->iClass.iProtocolNum); |
|
2003 |
|
2004 if ((*aIfPtr)->iNumber != 0 && ifDescriptor[KIfcDesc_NumberOffset] != (*aIfPtr)->iNumber) |
|
2005 { |
|
2006 ifDescriptor[KIfcDesc_NumberOffset] = (*aIfPtr)->iNumber; |
|
2007 r = iPort[aPortNumber].SetInterfaceDescriptor(0, ifDescriptor); |
|
2008 test_KErrNone(r); |
|
2009 } |
|
2010 else |
|
2011 { |
|
2012 (*aIfPtr)->iNumber = ifDescriptor[KIfcDesc_NumberOffset]; |
|
2013 } |
|
2014 TUint8 interfaceNumber = (*aIfPtr)->iNumber; |
|
2015 TUSB_PRINT1 ("Interface Number %d",interfaceNumber); |
|
2016 OstTrace1 (TRACE_NORMAL, CACTIVECONTROL_SETUPTRANSFEREDINTERFACE_DUP01, "Interface Number %d",interfaceNumber); |
|
2017 |
|
2018 // Check all endpoint descriptors |
|
2019 TBuf8<KUsbDescSize_AudioEndpoint> epDescriptor; |
|
2020 for (TUint i = 0; i < (*aIfPtr)->iInfoPtr->iTotalEndpointsUsed; i++) |
|
2021 { |
|
2022 if (!gSkip) |
|
2023 { |
|
2024 TestEndpointDescriptor (&iPort[aPortNumber],0,i+1,(*aIfPtr)->iInfoPtr->iEndpointData[i]); |
|
2025 |
|
2026 } |
|
2027 |
|
2028 if (firstBulkOutEndpoint < 0 && ((*aIfPtr)->iInfoPtr->iEndpointData[i].iDir & KUsbEpDirOut) && |
|
2029 (*aIfPtr)->iInfoPtr->iEndpointData[i].iType == KUsbEpTypeBulk) |
|
2030 { |
|
2031 firstBulkOutEndpoint = i+1; |
|
2032 } |
|
2033 } |
|
2034 |
|
2035 TUSB_PRINT1 ("Interface number is %d",interfaceNumber); |
|
2036 OstTrace1 (TRACE_NORMAL, CACTIVECONTROL_SETUPTRANSFEREDINTERFACE_DUP02, "Interface number is %d",interfaceNumber); |
|
2037 (*aIfPtr)->iPortNumber = aPortNumber; |
|
2038 gInterfaceConfig [interfaceNumber] [0] = *aIfPtr; |
|
2039 |
|
2040 TInt alternateNumber = 1; |
|
2041 // check for any alternatate interfaces and set any that are found |
|
2042 * aIfPtr = (*aIfPtr)->iPtrNext; |
|
2043 if (* aIfPtr != NULL) |
|
2044 { |
|
2045 test(SupportsAlternateInterfaces()); |
|
2046 |
|
2047 IFConfigPtr ifPtr = *aIfPtr; |
|
2048 while (ifPtr != NULL) |
|
2049 { |
|
2050 if (ifPtr->iAlternateSetting) |
|
2051 { |
|
2052 ifc = *(ifPtr->iInfoPtr); |
|
2053 |
|
2054 r = iPort[aPortNumber].GetInterfaceDescriptor(alternateNumber, ifDescriptor); |
|
2055 test_KErrNone(r); |
|
2056 |
|
2057 // Check the interface descriptor |
|
2058 test(ifDescriptor[KIfcDesc_SettingOffset] == alternateNumber && ifDescriptor[KIfcDesc_NumEndpointsOffset] == (*aIfPtr)->iInfoPtr->iTotalEndpointsUsed && |
|
2059 ifDescriptor[KIfcDesc_ClassOffset] == (*aIfPtr)->iInfoPtr->iClass.iClassNum && |
|
2060 ifDescriptor[KIfcDesc_SubClassOffset] == (*aIfPtr)->iInfoPtr->iClass.iSubClassNum && |
|
2061 ifDescriptor[KIfcDesc_ProtocolOffset] == (*aIfPtr)->iInfoPtr->iClass.iProtocolNum); |
|
2062 |
|
2063 // Check all endpoint descriptors |
|
2064 for (TUint i = 0; i < ifPtr->iInfoPtr->iTotalEndpointsUsed; i++) |
|
2065 { |
|
2066 TInt desc_size; |
|
2067 r = iPort[aPortNumber].GetEndpointDescriptorSize(alternateNumber, i+1, desc_size); |
|
2068 test_KErrNone(r); |
|
2069 test_Equal(KUsbDescSize_Endpoint + (*aIfPtr)->iInfoPtr->iEndpointData[i].iExtra,static_cast<TUint>(desc_size)); |
|
2070 |
|
2071 r = iPort[aPortNumber].GetEndpointDescriptor(alternateNumber, i+1, epDescriptor); |
|
2072 test_KErrNone(r); |
|
2073 |
|
2074 test((((*aIfPtr)->iInfoPtr->iEndpointData[i].iDir & KUsbEpDirIn) && (epDescriptor[KEpDesc_AddressOffset] & 0x80) || |
|
2075 !((*aIfPtr)->iInfoPtr->iEndpointData[i].iDir & KUsbEpDirIn) && !(epDescriptor[KEpDesc_AddressOffset] & 0x80)) && |
|
2076 EpTypeMask2Value((*aIfPtr)->iInfoPtr->iEndpointData[i].iType) == (TUint)(epDescriptor[KEpDesc_AttributesOffset] & 0x03) && |
|
2077 (*aIfPtr)->iInfoPtr->iEndpointData[i].iInterval == epDescriptor[KEpDesc_IntervalOffset]); |
|
2078 |
|
2079 |
|
2080 if (!gSkip && (*aIfPtr)->iInfoPtr->iEndpointData[i].iExtra) |
|
2081 { |
|
2082 test.Next(_L("Extended Endpoint Descriptor Manipulation")); |
|
2083 TUint8 addr = 0x85; // bogus address |
|
2084 if (epDescriptor[KEpDesc_SynchAddressOffset] == addr) |
|
2085 addr++; |
|
2086 epDescriptor[KEpDesc_SynchAddressOffset] = addr; |
|
2087 r = iPort[aPortNumber].SetEndpointDescriptor(alternateNumber, i+1, epDescriptor); |
|
2088 test_KErrNone(r); |
|
2089 |
|
2090 TBuf8<KUsbDescSize_AudioEndpoint> descriptor2; |
|
2091 r = iPort[aPortNumber].GetEndpointDescriptor(alternateNumber, i+1, descriptor2); |
|
2092 test_KErrNone(r); |
|
2093 |
|
2094 test.Next(_L("Compare endpoint descriptor with value set")); |
|
2095 r = descriptor2.Compare(epDescriptor); |
|
2096 test_KErrNone(r); |
|
2097 } |
|
2098 } |
|
2099 |
|
2100 |
|
2101 // if no error move on to the next interface |
|
2102 ifPtr->iPortNumber = aPortNumber; |
|
2103 ifPtr->iNumber = interfaceNumber; |
|
2104 gInterfaceConfig [interfaceNumber] [alternateNumber] = ifPtr; |
|
2105 |
|
2106 alternateNumber++; |
|
2107 ifPtr = ifPtr->iPtrNext; |
|
2108 * aIfPtr = ifPtr; |
|
2109 } |
|
2110 else |
|
2111 { |
|
2112 ifPtr = NULL; |
|
2113 } |
|
2114 } |
|
2115 } |
|
2116 iNumInterfaceSettings[aPortNumber] = alternateNumber; |
|
2117 if (!gSkip) |
|
2118 { |
|
2119 TestInvalidSetInterface (&iPort[aPortNumber],iNumInterfaceSettings[aPortNumber]); |
|
2120 TestInvalidReleaseInterface (&iPort[aPortNumber],iNumInterfaceSettings[aPortNumber]); |
|
2121 |
|
2122 //TestDescriptorManipulation(iLddPtr->iHighSpeed,&iPort[aPortNumber],alternateNumber); |
|
2123 TestOtgExtensions(&iPort[aPortNumber]); |
|
2124 TestEndpoint0MaxPacketSizes(&iPort[aPortNumber]); |
|
2125 } |
|
2126 |
|
2127 test.End(); |
|
2128 } |
|
2129 |
|
2130 |
|
2131 void CActiveControl::ConstructLOnSharedLdd(const RMessagePtr2& aMsg) |
|
2132 { |
|
2133 // currently only support one interface with one alternate settings |
|
2134 test.Start (_L("ConstructLOnSharedLdd Configuration")); |
|
2135 |
|
2136 User::LeaveIfError(iPort[0].Open(aMsg, 0, EOwnerProcess)); |
|
2137 CleanupClosePushL(iPort[0]); |
|
2138 |
|
2139 RChunk* chunk; |
|
2140 //Get the Ldd's RChunk, but don't own it. |
|
2141 User::LeaveIfError(iPort[0].GetDataTransferChunk(chunk)); |
|
2142 User::LeaveIfError(chunk->Open(aMsg, 1, FALSE, EOwnerProcess)); |
|
2143 CleanupStack::Pop(); |
|
2144 |
|
2145 |
|
2146 TInt r; |
|
2147 |
|
2148 User::LeaveIfError(iFs.Connect()); |
|
2149 |
|
2150 test_Compare(iConfigFileName->Length(),!=,0); |
|
2151 |
|
2152 iTimer.CreateLocal(); |
|
2153 iPending = EPendingNone; |
|
2154 |
|
2155 test.Next (_L("Open configuration file")); |
|
2156 // set the session path to use the ROM if no drive specified |
|
2157 r=iFs.SetSessionPath(_L("Z:\\test\\")); |
|
2158 test_KErrNone(r); |
|
2159 |
|
2160 r = iConfigFile.Open(iFs, * iConfigFileName, EFileShareReadersOnly | EFileStreamText | EFileRead); |
|
2161 test_KErrNone(r); |
|
2162 TUSB_VERBOSE_PRINT1("Configuration file %s Opened successfully", iConfigFileName->PtrZ()); |
|
2163 if(gVerbose) |
|
2164 { |
|
2165 OstTraceExt1(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD, "Configuration file %s Opened successfully", *iConfigFileName); |
|
2166 } |
|
2167 |
|
2168 test.Next (_L("Process configuration file")); |
|
2169 test(ProcessConfigFile (iConfigFile,iConsole,&iLddPtr)); |
|
2170 |
|
2171 iConfigFile.Close(); |
|
2172 |
|
2173 test.Next (_L("LDD in configuration file")); |
|
2174 test_NotNull(iLddPtr); |
|
2175 |
|
2176 LDDConfigPtr lddPtr = iLddPtr; |
|
2177 TInt nextPort = 0; |
|
2178 while (lddPtr != NULL) |
|
2179 { |
|
2180 // Load logical driver (LDD) |
|
2181 // (There's no physical driver (PDD) with USB: it's a kernel extension DLL which |
|
2182 // was already loaded at boot time.) |
|
2183 test.Next (_L("Loading USB LDD")); |
|
2184 TUSB_VERBOSE_PRINT1("Loading USB LDD ",lddPtr->iName.PtrZ()); |
|
2185 if(gVerbose) |
|
2186 { |
|
2187 OstTraceExt1(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP01, "Loading USB LDD:%S ",lddPtr->iName); |
|
2188 } |
|
2189 r = User::LoadLogicalDevice(lddPtr->iName); |
|
2190 test(r == KErrNone || r == KErrAlreadyExists); |
|
2191 |
|
2192 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
|
2193 |
|
2194 test.Next (_L("Opening Channels")); |
|
2195 TUSB_VERBOSE_PRINT1("Successfully opened USB port %d", lddPtr->iNumChannels); |
|
2196 if(gVerbose) |
|
2197 { |
|
2198 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP02, "Successfully opened USB port %d", lddPtr->iNumChannels); |
|
2199 } |
|
2200 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
|
2201 { |
|
2202 test_Compare(lddPtr->iNumChannels,>,0); |
|
2203 |
|
2204 // Open USB channel |
|
2205 |
|
2206 TUSB_VERBOSE_PRINT("Successfully opened USB port"); |
|
2207 if(gVerbose) |
|
2208 { |
|
2209 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP03, "Successfully opened USB port"); |
|
2210 } |
|
2211 |
|
2212 // Query the USB device/Setup the USB interface |
|
2213 if (portNumber == nextPort) |
|
2214 { |
|
2215 // Change some descriptors to contain suitable values |
|
2216 SetupDescriptors(lddPtr, &iPort[portNumber]); |
|
2217 } |
|
2218 |
|
2219 if (portNumber == 0) |
|
2220 { |
|
2221 QueryUsbClientL(lddPtr, &iPort[portNumber]); |
|
2222 } |
|
2223 |
|
2224 test_NotNull(ifPtr); |
|
2225 |
|
2226 if (iSupportResourceAllocationV2) |
|
2227 { |
|
2228 PopulateInterfaceResourceAllocation(ifPtr, portNumber); |
|
2229 } |
|
2230 |
|
2231 IFConfigPtr defaultIfPtr = ifPtr; |
|
2232 SetupTransferedInterface(&ifPtr,portNumber); |
|
2233 |
|
2234 |
|
2235 if (!iSupportResourceAllocationV2) |
|
2236 { |
|
2237 // allocate endpoint DMA and double buffering for all endpoints on default interface when using resource allocation v1 api |
|
2238 for (TUint8 i = 1; i <= defaultIfPtr->iInfoPtr->iTotalEndpointsUsed; i++) |
|
2239 { |
|
2240 defaultIfPtr->iEpDMA[i-1] ? AllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i); |
|
2241 #ifndef USB_SC |
|
2242 defaultIfPtr->iEpDoubleBuff[i-1] ? AllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i); |
|
2243 #endif |
|
2244 } |
|
2245 } |
|
2246 } |
|
2247 |
|
2248 iTotalChannels += lddPtr->iNumChannels; |
|
2249 nextPort += lddPtr->iNumChannels; |
|
2250 lddPtr = lddPtr->iPtrNext; |
|
2251 } |
|
2252 |
|
2253 TUSB_VERBOSE_PRINT("All Interfaces and Alternate Settings successfully set up"); |
|
2254 if(gVerbose) |
|
2255 { |
|
2256 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP04, "All Interfaces and Alternate Settings successfully set up"); |
|
2257 } |
|
2258 |
|
2259 test.Next (_L("Start Idle Counter Thread")); |
|
2260 r = iIdleCounterThread.Create(_L("IdleCounter"), IdleCounterThread, KDefaultStackSize, KMinHeapSize, KMinHeapSize, NULL); |
|
2261 test_KErrNone(r); |
|
2262 iIdleCounterThread.Resume(); |
|
2263 // Allow some time for low-priority counter process |
|
2264 User::After(100000); // 0.1 second |
|
2265 r = iIdleCounterChunk.OpenGlobal(KTestIdleCounterChunkName, EFalse); |
|
2266 test_KErrNone(r); |
|
2267 iIdleCounter = (struct TTestIdleCounter*) iIdleCounterChunk.Base(); |
|
2268 test_NotNull(iIdleCounter); |
|
2269 // Allow some time for low-priority counter process |
|
2270 User::After(100000); // 0.1 second |
|
2271 TInt64 val1 = iIdleCounter->iCounter; |
|
2272 User::After(1000000); // 1 second |
|
2273 TInt64 val2 = iIdleCounter->iCounter; |
|
2274 TUSB_PRINT1("Idle Counter when test inactive: %Ldinc/ms", (val2 - val1) / 1000); |
|
2275 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP05, "Idle Counter when test inactive: %Ldinc/ms", (val2 - val1) / 1000); |
|
2276 |
|
2277 test.Next (_L("Enumeration...")); |
|
2278 r = ReEnumerate(); |
|
2279 test_KErrNone(r); |
|
2280 |
|
2281 TUSB_VERBOSE_PRINT("Device successfully re-enumerated\n"); |
|
2282 if(gVerbose) |
|
2283 { |
|
2284 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP06, "Device successfully re-enumerated\n"); |
|
2285 } |
|
2286 |
|
2287 |
|
2288 if (iLddPtr->iHighSpeed && !gSkip) |
|
2289 { |
|
2290 test.Next (_L("High Speed")); |
|
2291 test(iHighSpeed); |
|
2292 } |
|
2293 |
|
2294 test.Next (_L("Create Notifiers")); |
|
2295 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
|
2296 { |
|
2297 |
|
2298 // Create device state active object |
|
2299 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
|
2300 test_NotNull(iDeviceStateNotifier[portNumber]); |
|
2301 iDeviceStateNotifier[portNumber]->Activate(); |
|
2302 TUSB_VERBOSE_PRINT("Created device state notifier"); |
|
2303 if(gVerbose) |
|
2304 { |
|
2305 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP07, "Created device state notifier"); |
|
2306 } |
|
2307 |
|
2308 // Create endpoint stall status active object |
|
2309 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
|
2310 test_NotNull(iStallNotifier[portNumber]); |
|
2311 iStallNotifier[portNumber]->Activate(); |
|
2312 TUSB_VERBOSE_PRINT("Created stall notifier"); |
|
2313 if(gVerbose) |
|
2314 { |
|
2315 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP08, "Created stall notifier"); |
|
2316 } |
|
2317 |
|
2318 TestInvalidSetInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
|
2319 TestInvalidReleaseInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
|
2320 |
|
2321 } |
|
2322 |
|
2323 test.Next (_L("Endpoint Zero Max Packet Sizes")); |
|
2324 TUint ep0Size = iPort[0].EndpointZeroMaxPacketSizes(); |
|
2325 switch (ep0Size) |
|
2326 { |
|
2327 case KUsbEpSize8 : |
|
2328 iEp0PacketSize = 8; |
|
2329 break; |
|
2330 |
|
2331 case KUsbEpSize16 : |
|
2332 iEp0PacketSize = 16; |
|
2333 break; |
|
2334 |
|
2335 case KUsbEpSize32 : |
|
2336 iEp0PacketSize = 32; |
|
2337 break; |
|
2338 |
|
2339 case KUsbEpSize64 : |
|
2340 iEp0PacketSize = 64; |
|
2341 break; |
|
2342 |
|
2343 default: |
|
2344 iEp0PacketSize = 0; |
|
2345 break; |
|
2346 } |
|
2347 test_Compare(iEp0PacketSize,>,0); |
|
2348 |
|
2349 test.Next (_L("Set Device Control")); |
|
2350 r = iPort[0].SetDeviceControl(); |
|
2351 test_KErrNone(r); |
|
2352 |
|
2353 #ifdef USB_SC |
|
2354 r = iPort[0].OpenEndpoint(iEp0Buf,0); |
|
2355 test_KErrNone(r); |
|
2356 #endif |
|
2357 |
|
2358 test.End(); |
|
2359 RequestEp0ControlPacket(); |
|
2360 } |
|
2361 |
|
2362 #endif |
1717 // -eof- |
2363 // -eof- |