175 aSrv.Close(); |
182 aSrv.Close(); |
176 return; |
183 return; |
177 } |
184 } |
178 #endif |
185 #endif |
179 TInt r; |
186 TInt r; |
180 |
187 |
181 User::LeaveIfError(iFs.Connect()); |
188 User::LeaveIfError(iFs.Connect()); |
182 |
189 |
183 test.Start (_L("Configuration")); |
190 test.Start (_L("Configuration")); |
184 |
191 |
185 test_Compare(iConfigFileName->Length(),!=,0); |
192 test_Compare(iConfigFileName->Length(),!=,0); |
186 |
193 |
187 iTimer.CreateLocal(); |
194 iTimer.CreateLocal(); |
188 iPending = EPendingNone; |
195 iPending = EPendingNone; |
189 |
196 |
190 test.Next (_L("Open configuration file")); |
197 test.Next (_L("Open configuration file")); |
191 // 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 |
192 r=iFs.SetSessionPath(_L("Z:\\test\\")); |
199 r=iFs.SetSessionPath(_L("Z:\\test\\")); |
193 test_KErrNone(r); |
200 test_KErrNone(r); |
194 |
201 |
195 r = iConfigFile.Open(iFs, * iConfigFileName, EFileShareReadersOnly | EFileStreamText | EFileRead); |
202 r = iConfigFile.Open(iFs, * iConfigFileName, EFileShareReadersOnly | EFileStreamText | EFileRead); |
196 test_KErrNone(r); |
203 test_KErrNone(r); |
197 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 } |
198 |
209 |
199 test.Next (_L("Process configuration file")); |
210 test.Next (_L("Process configuration file")); |
200 test(ProcessConfigFile (iConfigFile,iConsole,&iLddPtr)); |
211 test(ProcessConfigFile (iConfigFile,iConsole,&iLddPtr)); |
201 |
212 |
202 iConfigFile.Close(); |
213 iConfigFile.Close(); |
203 |
214 |
204 test.Next (_L("LDD in configuration file")); |
215 test.Next (_L("LDD in configuration file")); |
205 test_NotNull(iLddPtr); |
216 test_NotNull(iLddPtr); |
206 |
217 |
207 LDDConfigPtr lddPtr = iLddPtr; |
218 LDDConfigPtr lddPtr = iLddPtr; |
208 TInt nextPort = 0; |
219 TInt nextPort = 0; |
209 while (lddPtr != NULL) |
220 while (lddPtr != NULL) |
210 { |
221 { |
211 // Load logical driver (LDD) |
222 // Load logical driver (LDD) |
212 // (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 |
213 // was already loaded at boot time.) |
224 // was already loaded at boot time.) |
214 test.Next (_L("Loading USB LDD")); |
225 test.Next (_L("Loading USB LDD")); |
215 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 } |
216 r = User::LoadLogicalDevice(lddPtr->iName); |
231 r = User::LoadLogicalDevice(lddPtr->iName); |
217 test(r == KErrNone || r == KErrAlreadyExists); |
232 test(r == KErrNone || r == KErrAlreadyExists); |
218 |
233 |
219 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
234 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
220 |
235 |
221 test.Next (_L("Opening Channels")); |
236 test.Next (_L("Opening Channels")); |
222 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
237 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
223 { |
238 { |
224 test_Compare(lddPtr->iNumChannels,>,0); |
239 test_Compare(lddPtr->iNumChannels,>,0); |
225 |
240 |
226 // Open USB channel |
241 // Open USB channel |
227 r = iPort[portNumber].Open(0); |
242 r = iPort[portNumber].Open(0); |
228 test_KErrNone(r); |
243 test_KErrNone(r); |
229 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 } |
230 |
249 |
231 // Query the USB device/Setup the USB interface |
250 // Query the USB device/Setup the USB interface |
232 if (portNumber == nextPort) |
251 if (portNumber == nextPort) |
233 { |
252 { |
234 // Change some descriptors to contain suitable values |
253 // Change some descriptors to contain suitable values |
235 SetupDescriptors(lddPtr, &iPort[portNumber]); |
254 SetupDescriptors(lddPtr, &iPort[portNumber]); |
236 } |
255 } |
237 |
256 |
238 if (portNumber == 0) |
257 if (portNumber == 0) |
239 { |
258 { |
240 QueryUsbClientL(lddPtr, &iPort[portNumber]); |
259 QueryUsbClientL(lddPtr, &iPort[portNumber]); |
241 } |
260 } |
242 |
261 |
243 test_NotNull(ifPtr); |
262 test_NotNull(ifPtr); |
244 |
263 |
245 if (iSupportResourceAllocationV2) |
264 if (iSupportResourceAllocationV2) |
246 { |
265 { |
247 PopulateInterfaceResourceAllocation(ifPtr, portNumber); |
266 PopulateInterfaceResourceAllocation(ifPtr, portNumber); |
248 } |
267 } |
249 |
268 |
250 IFConfigPtr defaultIfPtr = ifPtr; |
269 IFConfigPtr defaultIfPtr = ifPtr; |
251 SetupInterface(&ifPtr,portNumber); |
270 SetupInterface(&ifPtr,portNumber); |
252 |
271 |
253 #ifdef USB_SC |
272 #ifdef USB_SC |
254 RChunk *tChunk = &gChunk; |
273 RChunk *tChunk = &gChunk; |
255 test_KErrNone(iPort[portNumber].FinalizeInterface(tChunk)); |
274 test_KErrNone(iPort[portNumber].FinalizeInterface(tChunk)); |
256 #endif |
275 #endif |
257 |
276 |
289 User::After(100000); // 0.1 second |
312 User::After(100000); // 0.1 second |
290 TInt64 val1 = iIdleCounter->iCounter; |
313 TInt64 val1 = iIdleCounter->iCounter; |
291 User::After(1000000); // 1 second |
314 User::After(1000000); // 1 second |
292 TInt64 val2 = iIdleCounter->iCounter; |
315 TInt64 val2 = iIdleCounter->iCounter; |
293 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); |
294 |
318 |
295 test.Next (_L("Enumeration...")); |
319 test.Next (_L("Enumeration...")); |
296 r = ReEnumerate(); |
320 r = ReEnumerate(); |
297 test_KErrNone(r); |
321 test_KErrNone(r); |
298 |
322 |
299 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 } |
300 |
328 |
301 |
329 |
302 if (iLddPtr->iHighSpeed && !gSkip) |
330 if (iLddPtr->iHighSpeed && !gSkip) |
303 { |
331 { |
304 test.Next (_L("High Speed")); |
332 test.Next (_L("High Speed")); |
305 test(iHighSpeed); |
333 test(iHighSpeed); |
306 } |
334 } |
307 |
335 |
308 test.Next (_L("Create Notifiers")); |
336 test.Next (_L("Create Notifiers")); |
309 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
337 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
310 { |
338 { |
311 |
339 |
312 // Create device state active object |
340 // Create device state active object |
313 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
341 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
314 test_NotNull(iDeviceStateNotifier[portNumber]); |
342 test_NotNull(iDeviceStateNotifier[portNumber]); |
315 iDeviceStateNotifier[portNumber]->Activate(); |
343 iDeviceStateNotifier[portNumber]->Activate(); |
316 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 } |
317 |
349 |
318 // Create endpoint stall status active object |
350 // Create endpoint stall status active object |
319 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
351 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
320 test_NotNull(iStallNotifier[portNumber]); |
352 test_NotNull(iStallNotifier[portNumber]); |
321 iStallNotifier[portNumber]->Activate(); |
353 iStallNotifier[portNumber]->Activate(); |
322 TUSB_VERBOSE_PRINT("Created stall notifier"); |
354 TUSB_VERBOSE_PRINT("Created stall notifier"); |
323 |
355 if(gVerbose) |
324 TestInvalidSetInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
356 { |
|
357 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTL_DUP07, "Created stall notifier"); |
|
358 } |
|
359 |
|
360 TestInvalidSetInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
325 TestInvalidReleaseInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
361 TestInvalidReleaseInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
326 |
362 |
327 } |
363 } |
328 |
364 |
329 test.Next (_L("Endpoint Zero Max Packet Sizes")); |
365 test.Next (_L("Endpoint Zero Max Packet Sizes")); |
330 TUint ep0Size = iPort[0].EndpointZeroMaxPacketSizes(); |
366 TUint ep0Size = iPort[0].EndpointZeroMaxPacketSizes(); |
331 switch (ep0Size) |
367 switch (ep0Size) |
332 { |
368 { |
333 case KUsbEpSize8 : |
369 case KUsbEpSize8 : |
334 iEp0PacketSize = 8; |
370 iEp0PacketSize = 8; |
335 break; |
371 break; |
336 |
372 |
337 case KUsbEpSize16 : |
373 case KUsbEpSize16 : |
338 iEp0PacketSize = 16; |
374 iEp0PacketSize = 16; |
339 break; |
375 break; |
340 |
376 |
341 case KUsbEpSize32 : |
377 case KUsbEpSize32 : |
373 LDDConfigPtr lddPtr = iLddPtr; |
409 LDDConfigPtr lddPtr = iLddPtr; |
374 TInt nextPort = 0; |
410 TInt nextPort = 0; |
375 while (lddPtr != NULL) |
411 while (lddPtr != NULL) |
376 { |
412 { |
377 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
413 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
378 |
414 |
379 test.Next (_L("Opening Channels")); |
415 test.Next (_L("Opening Channels")); |
380 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
416 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
381 { |
417 { |
382 // Open USB channel |
418 // Open USB channel |
383 r = iPort[portNumber].Open(0); |
419 r = iPort[portNumber].Open(0); |
384 test_KErrNone(r); |
420 test_KErrNone(r); |
385 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 } |
386 |
426 |
387 // Query the USB device/Setup the USB interface |
427 // Query the USB device/Setup the USB interface |
388 if (portNumber == nextPort) |
428 if (portNumber == nextPort) |
389 { |
429 { |
390 // Change some descriptors to contain suitable values |
430 // Change some descriptors to contain suitable values |
391 SetupDescriptors(lddPtr, &iPort[portNumber]); |
431 SetupDescriptors(lddPtr, &iPort[portNumber]); |
392 } |
432 } |
393 |
433 |
394 IFConfigPtr defaultIfPtr = ifPtr; |
434 IFConfigPtr defaultIfPtr = ifPtr; |
395 SetupInterface(&ifPtr,portNumber); |
435 SetupInterface(&ifPtr,portNumber); |
396 |
436 |
397 #ifdef USB_SC |
437 #ifdef USB_SC |
398 RChunk *tChunk = &gChunk; |
438 RChunk *tChunk = &gChunk; |
399 test_KErrNone(iPort[portNumber].FinalizeInterface(tChunk)); |
439 test_KErrNone(iPort[portNumber].FinalizeInterface(tChunk)); |
400 #endif |
440 #endif |
401 |
441 |
402 if (!iSupportResourceAllocationV2) |
442 if (!iSupportResourceAllocationV2) |
403 { |
443 { |
404 // 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 |
405 for (TUint8 i = 1; i <= defaultIfPtr->iInfoPtr->iTotalEndpointsUsed; i++) |
445 for (TUint8 i = 1; i <= defaultIfPtr->iInfoPtr->iTotalEndpointsUsed; i++) |
406 { |
446 { |
407 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); |
408 #ifndef USB_SC |
448 #ifndef USB_SC |
409 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); |
410 #endif |
450 #endif |
411 } |
451 } |
412 } |
452 } |
413 } |
453 } |
414 |
454 |
415 nextPort += lddPtr->iNumChannels; |
455 nextPort += lddPtr->iNumChannels; |
416 lddPtr = lddPtr->iPtrNext; |
456 lddPtr = lddPtr->iPtrNext; |
417 } |
457 } |
418 |
458 |
419 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 } |
420 |
464 |
421 test.Next (_L("Enumeration...")); |
465 test.Next (_L("Enumeration...")); |
422 r = ReEnumerate(); |
466 r = ReEnumerate(); |
423 test_KErrNone(r); |
467 test_KErrNone(r); |
424 |
468 |
425 TUSB_VERBOSE_PRINT("Device successfully re-enumerated\n"); |
469 TUSB_VERBOSE_PRINT("Device successfully re-enumerated\n"); |
426 |
470 if(gVerbose) |
|
471 { |
|
472 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_RECONNECT_DUP02, "Device successfully re-enumerated\n"); |
|
473 } |
|
474 |
427 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
475 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
428 { |
476 { |
429 // Create device state active object |
477 // Create device state active object |
430 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
478 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
431 test_NotNull(iDeviceStateNotifier[portNumber]); |
479 test_NotNull(iDeviceStateNotifier[portNumber]); |
432 iDeviceStateNotifier[portNumber]->Activate(); |
480 iDeviceStateNotifier[portNumber]->Activate(); |
433 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 } |
434 |
486 |
435 // Create endpoint stall status active object |
487 // Create endpoint stall status active object |
436 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
488 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
437 test_NotNull(iStallNotifier[portNumber]); |
489 test_NotNull(iStallNotifier[portNumber]); |
438 iStallNotifier[portNumber]->Activate(); |
490 iStallNotifier[portNumber]->Activate(); |
439 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 } |
440 |
496 |
441 if (portNumber == 0) |
497 if (portNumber == 0) |
442 { |
498 { |
443 test.Next (_L("Set Device Control")); |
499 test.Next (_L("Set Device Control")); |
444 r = iPort[portNumber].SetDeviceControl(); |
500 r = iPort[portNumber].SetDeviceControl(); |
777 } |
852 } |
778 |
853 |
779 void CActiveControl::RunL() |
854 void CActiveControl::RunL() |
780 { |
855 { |
781 TInt r = KErrNone; |
856 TInt r = KErrNone; |
782 |
857 |
783 TUSB_VERBOSE_PRINT("CActiveControl::RunL()"); |
858 TUSB_VERBOSE_PRINT("CActiveControl::RunL()"); |
784 |
859 if(gVerbose) |
|
860 { |
|
861 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_RUNL, "CActiveControl::RunL()"); |
|
862 } |
|
863 |
785 switch (iPending) |
864 switch (iPending) |
786 { |
865 { |
787 case EPendingNone : |
866 case EPendingNone : |
788 break; |
867 break; |
789 |
868 |
790 case EPendingEp0Read : |
869 case EPendingEp0Read : |
791 iPending = EPendingNone; |
870 iPending = EPendingNone; |
792 if (iStatus != KErrNone) |
871 if (iStatus != KErrNone) |
793 { |
872 { |
794 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()); |
795 test(EFalse); |
875 test(EFalse); |
796 } |
876 } |
797 #ifdef USB_SC |
877 #ifdef USB_SC |
798 // 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 |
799 // 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 |
800 RequestEp0ControlPacket(); |
880 RequestEp0ControlPacket(); |
801 #else |
881 #else |
802 if (ProcessEp0ControlPacket() == KErrCompletion) |
882 if (ProcessEp0ControlPacket() == KErrCompletion) |
803 RequestEp0ControlPacket(); |
883 RequestEp0ControlPacket(); |
804 #endif |
884 #endif |
805 break; |
885 break; |
806 |
886 |
807 case EPendingTimer : |
887 case EPendingTimer : |
808 iPending = EPendingNone; |
888 iPending = EPendingNone; |
809 if (iStatus != KErrNone) |
889 if (iStatus != KErrNone) |
810 { |
890 { |
811 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()); |
812 test(EFalse); |
893 test(EFalse); |
813 } |
894 } |
814 r = iPort[0].DeviceConnectToHost(); |
895 r = iPort[0].DeviceConnectToHost(); |
815 test_KErrNone (r); |
896 test_KErrNone (r); |
816 |
897 |
817 test.End(); |
898 test.End(); |
818 |
899 |
819 RequestEp0ControlPacket(); |
900 RequestEp0ControlPacket(); |
820 break; |
901 break; |
821 |
902 |
822 case EPendingEject : |
903 case EPendingEject : |
823 iPending = EPendingNone; |
904 iPending = EPendingNone; |
824 if (iStatus != KErrNone) |
905 if (iStatus != KErrNone) |
825 { |
906 { |
826 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()); |
827 test(EFalse); |
909 test(EFalse); |
828 } |
910 } |
829 StopMassStorage(&iPort[0]); |
911 StopMassStorage(&iPort[0]); |
830 #ifdef USB_SC |
912 #ifdef USB_SC |
831 iEp0Buf.Close(); |
913 iEp0Buf.Close(); |
832 #endif |
914 #endif |
833 ReConnect(); |
915 ReConnect(); |
834 |
916 |
835 RequestEp0ControlPacket(); |
917 RequestEp0ControlPacket(); |
836 break; |
918 break; |
837 |
919 |
838 case EPendingCancel : |
920 case EPendingCancel : |
839 iPending = EPendingNone; |
921 iPending = EPendingNone; |
840 if (iStatus != KErrNone && iStatus != KErrCancel) |
922 if (iStatus != KErrNone && iStatus != KErrCancel) |
841 { |
923 { |
842 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()); |
843 test(EFalse); |
926 test(EFalse); |
844 } |
927 } |
845 } |
928 } |
846 |
929 |
847 } |
930 } |
848 |
931 |
849 TInt CActiveControl::ProcessEp0ControlPacket() |
932 TInt CActiveControl::ProcessEp0ControlPacket() |
850 { |
933 { |
851 TUint16 value = *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wValueOffset]); |
934 TUint16 value = *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wValueOffset]); |
852 TUint16 index = *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wIndexOffset]); |
935 TUint16 index = *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wIndexOffset]); |
853 TUint16 length= *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wLengthOffset]); |
936 TUint16 length= *reinterpret_cast<TUint16*>(&iEp0SetUpPacket[KUsb_Ep0wLengthOffset]); |
854 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 } |
855 TRequestStatus ep0Status; |
942 TRequestStatus ep0Status; |
856 TUint8 host_ver_major; |
943 TUint8 host_ver_major; |
857 TUint8 host_ver_minor; |
944 TUint8 host_ver_minor; |
858 TUint8 host_ver_micro; |
945 TUint8 host_ver_micro; |
859 TUint8 usbio_ver_major; |
946 TUint8 usbio_ver_major; |
871 |
958 |
872 if (((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_DestMask) == KUsbRequestType_DestDevice) && |
959 if (((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_DestMask) == KUsbRequestType_DestDevice) && |
873 ((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_TypeMask) == KUsbRequestType_TypeClass)) |
960 ((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_TypeMask) == KUsbRequestType_TypeClass)) |
874 { |
961 { |
875 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 } |
876 if ((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_DirMask) == KUsbRequestType_DirToDev) |
967 if ((iEp0SetUpPacket[KUsb_Ep0RequestTypeOffset] & KUsbRequestType_DirMask) == KUsbRequestType_DirToDev) |
877 { |
968 { |
878 iEp0DataBuffer.SetLength(0); |
969 iEp0DataBuffer.SetLength(0); |
879 while (iEp0DataBuffer.Length() < length) |
970 while (iEp0DataBuffer.Length() < length) |
880 { |
971 { |
881 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 } |
882 #ifdef USB_SC |
977 #ifdef USB_SC |
883 r = iEp0Buf.GetBuffer (iEp0Packet,iEp0Size,iEp0Zlp,ep0Status); |
978 r = iEp0Buf.GetBuffer (iEp0Packet,iEp0Size,iEp0Zlp,ep0Status); |
884 test_Value(r, r == KErrNone || r == KErrCompletion || (r == KErrAlternateSettingChanged)); |
979 test_Value(r, r == KErrNone || r == KErrCompletion || (r == KErrAlternateSettingChanged)); |
885 while (r == KErrNone) |
980 while (r == KErrNone) |
886 { |
981 { |
887 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 } |
888 User::WaitForRequest(ep0Status); |
987 User::WaitForRequest(ep0Status); |
889 test_KErrNone(ep0Status.Int()); |
988 test_KErrNone(ep0Status.Int()); |
890 r = iEp0Buf.GetBuffer (iEp0Packet,iEp0Size,iEp0Zlp,ep0Status); |
989 r = iEp0Buf.GetBuffer (iEp0Packet,iEp0Size,iEp0Zlp,ep0Status); |
891 test_Value(r, r == KErrNone || r == KErrCompletion || (r == KErrAlternateSettingChanged)); |
990 test_Value(r, r == KErrNone || r == KErrCompletion || (r == KErrAlternateSettingChanged)); |
892 } |
991 } |
893 TUSB_VERBOSE_PRINT1("Ep0 data packet - size %d",iEp0Size); |
992 TUSB_VERBOSE_PRINT1("Ep0 data packet - size %d",iEp0Size); |
894 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); |
895 #else |
998 #else |
896 TUint16 packetLength = Min(length-iEp0DataBuffer.Length(),iEp0PacketSize); |
999 TUint16 packetLength = Min(length-iEp0DataBuffer.Length(),iEp0PacketSize); |
897 iPort[0].ReadPacket(ep0Status, EEndpoint0, ep0DataPacket, packetLength); |
1000 iPort[0].ReadPacket(ep0Status, EEndpoint0, ep0DataPacket, packetLength); |
898 User::WaitForRequest(ep0Status); |
1001 User::WaitForRequest(ep0Status); |
899 if (ep0Status == KErrNone) |
1002 if (ep0Status == KErrNone) |
900 { |
1003 { |
901 iEp0DataBuffer.Append(ep0DataPacket); |
1004 iEp0DataBuffer.Append(ep0DataPacket); |
902 } |
1005 } |
903 else |
1006 else |
904 { |
1007 { |
905 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()); |
906 test(EFalse); |
1010 test(EFalse); |
907 return KErrNone; |
1011 return KErrNone; |
908 } |
1012 } |
909 #endif |
1013 #endif |
910 } |
1014 } |
911 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 } |
912 sendStatus = ETrue; |
1020 sendStatus = ETrue; |
913 switch (iEp0SetUpPacket[KUsb_Ep0RequestOffset]) |
1021 switch (iEp0SetUpPacket[KUsb_Ep0RequestOffset]) |
914 { |
1022 { |
915 case EStop : |
1023 case EStop : |
916 // send this now as the port will be disconnected |
1024 // send this now as the port will be disconnected |
917 sendStatus = EFalse; |
1025 sendStatus = EFalse; |
918 r = iPort[0].SendEp0StatusPacket(); |
1026 r = iPort[0].SendEp0StatusPacket(); |
919 test_KErrNone(r); |
1027 test_KErrNone(r); |
920 |
1028 |
921 if (value && firstBulkOutEndpoint > 0) |
1029 if (value && firstBulkOutEndpoint > 0) |
922 { |
1030 { |
923 PrintHostLog(); |
1031 PrintHostLog(); |
924 } |
1032 } |
925 |
1033 |
926 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
1034 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
927 { |
1035 { |
928 // base class cancel -> calls our DoCancel |
1036 // base class cancel -> calls our DoCancel |
929 delete iDeviceStateNotifier[portNumber]; |
1037 delete iDeviceStateNotifier[portNumber]; |
930 delete iStallNotifier[portNumber]; |
1038 delete iStallNotifier[portNumber]; |
932 { |
1040 { |
933 r = iPort[portNumber].RemoveStringDescriptor(stridx1); |
1041 r = iPort[portNumber].RemoveStringDescriptor(stridx1); |
934 if (r != KErrNone) |
1042 if (r != KErrNone) |
935 { |
1043 { |
936 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); |
937 } |
1046 } |
938 r = iPort[portNumber].RemoveStringDescriptor(stridx2); |
1047 r = iPort[portNumber].RemoveStringDescriptor(stridx2); |
939 if (r != KErrNone) |
1048 if (r != KErrNone) |
940 { |
1049 { |
941 TUSB_PRINT1("Error %d on string removal", r); |
1050 TUSB_PRINT1("Error %d on string removal", r); |
942 } |
1051 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP08, "Error %d on string removal", r); |
|
1052 } |
943 } |
1053 } |
944 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 } |
945 #ifdef USB_SC |
1059 #ifdef USB_SC |
946 RChunk* commChunk; |
1060 RChunk* commChunk; |
947 User::LeaveIfError(iPort[portNumber].GetDataTransferChunk(commChunk)); |
1061 User::LeaveIfError(iPort[portNumber].GetDataTransferChunk(commChunk)); |
948 commChunk->Close(); |
1062 commChunk->Close(); |
949 #endif |
1063 #endif |
950 |
|
951 iPort[portNumber].Close(); // close USB channel |
1064 iPort[portNumber].Close(); // close USB channel |
952 } |
1065 } |
953 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 } |
954 iIdleCounter->iCommand = ETestIdleCounterClose; |
1071 iIdleCounter->iCommand = ETestIdleCounterClose; |
955 iIdleCounterChunk.Close(); |
1072 iIdleCounterChunk.Close(); |
956 // Allow time for low-priority thread to close |
1073 // Allow time for low-priority thread to close |
957 User::After(100000); |
1074 User::After(100000); |
958 iIdleCounterThread.Close(); |
1075 iIdleCounterThread.Close(); |
959 |
1076 |
960 CActiveScheduler::Stop(); |
1077 CActiveScheduler::Stop(); |
961 break; |
1078 break; |
962 |
1079 |
963 case EVersion : |
1080 case EVersion : |
964 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"); |
965 host_ver_major = iEp0DataBuffer[0]; |
1083 host_ver_major = iEp0DataBuffer[0]; |
966 host_ver_minor = iEp0DataBuffer[1]; |
1084 host_ver_minor = iEp0DataBuffer[1]; |
967 host_ver_micro = iEp0DataBuffer[2]; |
1085 host_ver_micro = iEp0DataBuffer[2]; |
968 usbio_ver_major = iEp0DataBuffer[3]; |
1086 usbio_ver_major = iEp0DataBuffer[3]; |
969 usbio_ver_minor = iEp0DataBuffer[4]; |
1087 usbio_ver_minor = iEp0DataBuffer[4]; |
970 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", |
971 host_ver_major, host_ver_minor, host_ver_micro, |
1089 host_ver_major, host_ver_minor, host_ver_micro, |
972 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); |
973 if (host_ver_major < KHostVersionMajor) |
1094 if (host_ver_major < KHostVersionMajor) |
974 { |
1095 { |
975 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); |
976 User::Leave(-1); |
1098 User::Leave(-1); |
977 return KErrNone; |
1099 return KErrNone; |
978 } |
1100 } |
979 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
1101 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
980 // 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 '<'). |
981 else if ((host_ver_minor <= KHostVersionMinor) && |
1103 else if ((host_ver_minor <= KHostVersionMinor) && |
982 !(host_ver_minor == KHostVersionMinor)) |
1104 !(host_ver_minor == KHostVersionMinor)) |
983 { |
1105 { |
984 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", |
985 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); |
986 test(EFalse); |
1110 test(EFalse); |
987 return KErrNone; |
1111 return KErrNone; |
988 } |
1112 } |
989 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
1113 // Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without |
990 // 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 '<'). |
991 else if ((host_ver_micro <= KHostVersionMicro) && |
1115 else if ((host_ver_micro <= KHostVersionMicro) && |
992 !(host_ver_micro == KHostVersionMicro)) |
1116 !(host_ver_micro == KHostVersionMicro)) |
993 { |
1117 { |
994 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", |
995 KHostVersionMajor, KHostVersionMinor, KHostVersionMicro); |
1121 KHostVersionMajor, KHostVersionMinor, KHostVersionMicro); |
996 test(EFalse); |
1122 test(EFalse); |
997 return KErrNone; |
1123 return KErrNone; |
998 } |
1124 } |
999 break; |
1125 break; |
1000 |
1126 |
1001 case ETestParam : |
1127 case ETestParam : |
1002 tpPtr = (TestParamPtr)(&iEp0DataBuffer[0]); |
1128 tpPtr = (TestParamPtr)(&iEp0DataBuffer[0]); |
1003 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 } |
1004 if (index >= KMaxConcurrentTests) |
1134 if (index >= KMaxConcurrentTests) |
1005 { |
1135 { |
1006 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); |
1007 test(EFalse); |
1138 test(EFalse); |
1008 return KErrNone; |
1139 return KErrNone; |
1009 } |
1140 } |
1010 // Create Reader/Writer active object |
1141 // Create Reader/Writer active object |
1011 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); |
1012 if (!pActiveRW) |
1143 if (!pActiveRW) |
1013 { |
1144 { |
1014 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"); |
1015 test(EFalse); |
1147 test(EFalse); |
1016 return KErrNone; |
1148 return KErrNone; |
1017 } |
1149 } |
1018 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 } |
1019 pActiveRW->SetTestParams(tpPtr); |
1155 pActiveRW->SetTestParams(tpPtr); |
1020 switch (value) |
1156 switch (value) |
1021 { |
1157 { |
1022 case 'X' : |
1158 case 'X' : |
1023 test.Start (_L("Xml")); |
1159 test.Start (_L("Xml")); |
1024 break; |
1160 break; |
1025 |
1161 |
1026 case 'L' : |
1162 case 'L' : |
1027 test.Start (_L("Loop")); |
1163 test.Start (_L("Loop")); |
1028 pActiveRW->SetTransferMode(ELoop); |
1164 pActiveRW->SetTransferMode(ELoop); |
1029 gAltSettingOnNotify = ETrue; |
1165 gAltSettingOnNotify = ETrue; |
1030 if (tpPtr->settingRepeat && !firstSettingThread) |
1166 if (tpPtr->settingRepeat && !firstSettingThread) |
1031 { |
1167 { |
1032 pActiveRW->Suspend(ESuspend); |
1168 pActiveRW->Suspend(ESuspend); |
1033 } |
1169 } |
1034 else |
1170 else |
1035 { |
1171 { |
1036 pActiveRW->StartOrSuspend(); |
1172 pActiveRW->StartOrSuspend(); |
1037 } |
1173 } |
1038 break; |
1174 break; |
1039 |
1175 |
1040 case 'C' : |
1176 case 'C' : |
1041 test.Start (_L("Compare")); |
1177 test.Start (_L("Compare")); |
1042 pActiveRW->SetTransferMode(ELoopComp); |
1178 pActiveRW->SetTransferMode(ELoopComp); |
1043 gAltSettingOnNotify = ETrue; |
1179 gAltSettingOnNotify = ETrue; |
1044 if (tpPtr->settingRepeat && !firstSettingThread) |
1180 if (tpPtr->settingRepeat && !firstSettingThread) |
1045 { |
1181 { |
1046 pActiveRW->Suspend(ESuspend); |
1182 pActiveRW->Suspend(ESuspend); |
1047 } |
1183 } |
1048 else |
1184 else |
1049 { |
1185 { |
1050 pActiveRW->StartOrSuspend(); |
1186 pActiveRW->StartOrSuspend(); |
1051 } |
1187 } |
1052 break; |
1188 break; |
1053 |
1189 |
1054 case 'S' : |
1190 case 'S' : |
1055 test.Start (_L("Stream")); |
1191 test.Start (_L("Stream")); |
1056 if (tpPtr->outPipe > KMaxEndpointsPerClient) |
1192 if (tpPtr->outPipe > KMaxEndpointsPerClient) |
1057 { |
1193 { |
1058 pActiveRW->SetTransferMode(ETransmitOnly); |
1194 pActiveRW->SetTransferMode(ETransmitOnly); |
1059 gAltSettingOnNotify = ETrue; |
1195 gAltSettingOnNotify = ETrue; |
1060 if (tpPtr->settingRepeat && !firstSettingThread) |
1196 if (tpPtr->settingRepeat && !firstSettingThread) |
1061 { |
1197 { |
1062 pActiveRW->Suspend(ESuspend); |
1198 pActiveRW->Suspend(ESuspend); |
1063 } |
1199 } |
1064 else |
1200 else |
1065 { |
1201 { |
1066 pActiveRW->StartOrSuspend(); |
1202 pActiveRW->StartOrSuspend(); |
1067 } |
1203 } |
1068 } |
1204 } |
1069 else |
1205 else |
1070 { |
1206 { |
1071 pActiveRW->SetTransferMode(EReceiveOnly); |
1207 pActiveRW->SetTransferMode(EReceiveOnly); |
1072 gAltSettingOnNotify = ETrue; |
1208 gAltSettingOnNotify = ETrue; |
1073 if (tpPtr->settingRepeat && !firstSettingThread) |
1209 if (tpPtr->settingRepeat && !firstSettingThread) |
1074 { |
1210 { |
1075 pActiveRW->Suspend(ESuspend); |
1211 pActiveRW->Suspend(ESuspend); |
1076 } |
1212 } |
1077 else |
1213 else |
1078 { |
1214 { |
1079 pActiveRW->StartOrSuspend(); |
1215 pActiveRW->StartOrSuspend(); |
1080 } |
1216 } |
1081 } |
1217 } |
1082 break; |
1218 break; |
1083 |
1219 |
1084 case 'F' : |
1220 case 'F' : |
1085 test.Start (_L("File")); |
1221 test.Start (_L("File")); |
1086 // send this now as the file setup takes a long time |
1222 // send this now as the file setup takes a long time |
1087 sendStatus = EFalse; |
1223 sendStatus = EFalse; |
1088 r = iPort[0].SendEp0StatusPacket(); |
1224 r = iPort[0].SendEp0StatusPacket(); |
1089 test_KErrNone(r); |
1225 test_KErrNone(r); |
1090 if (tpPtr->outPipe > KMaxEndpointsPerClient) |
1226 if (tpPtr->outPipe > KMaxEndpointsPerClient) |
1091 { |
1227 { |
1092 pActiveRW->SetTransferMode(ETransmitOnly); |
1228 pActiveRW->SetTransferMode(ETransmitOnly); |
1093 TInt maxFileSize = tpPtr->maxSize * tpPtr->repeat; |
1229 TInt maxFileSize = tpPtr->maxSize * tpPtr->repeat; |
1094 pActiveRW->ReadFromDisk((TChar)tpPtr->minSize,maxFileSize); |
1230 pActiveRW->ReadFromDisk((TChar)tpPtr->minSize,maxFileSize); |
1095 gAltSettingOnNotify = ETrue; |
1231 gAltSettingOnNotify = ETrue; |
1096 if (tpPtr->settingRepeat && !firstSettingThread) |
1232 if (tpPtr->settingRepeat && !firstSettingThread) |
1097 { |
1233 { |
1098 pActiveRW->Suspend(ESuspend); |
1234 pActiveRW->Suspend(ESuspend); |
1099 } |
1235 } |
1100 else |
1236 else |
1101 { |
1237 { |
1102 pActiveRW->StartOrSuspend(); |
1238 pActiveRW->StartOrSuspend(); |
1103 } |
1239 } |
1104 } |
1240 } |
1105 else |
1241 else |
1106 { |
1242 { |
1107 pActiveRW->SetTransferMode(EReceiveOnly); |
1243 pActiveRW->SetTransferMode(EReceiveOnly); |
1108 pActiveRW->WriteToDisk((TChar)tpPtr->minSize); |
1244 pActiveRW->WriteToDisk((TChar)tpPtr->minSize); |
1109 gAltSettingOnNotify = ETrue; |
1245 gAltSettingOnNotify = ETrue; |
1110 if (tpPtr->settingRepeat && !firstSettingThread) |
1246 if (tpPtr->settingRepeat && !firstSettingThread) |
1111 { |
1247 { |
1112 pActiveRW->Suspend(ESuspend); |
1248 pActiveRW->Suspend(ESuspend); |
1113 } |
1249 } |
1114 else |
1250 else |
1115 { |
1251 { |
1116 pActiveRW->StartOrSuspend(); |
1252 pActiveRW->StartOrSuspend(); |
1117 } |
1253 } |
1118 } |
1254 } |
1119 break; |
1255 break; |
1120 |
1256 |
1121 default : |
1257 default : |
1122 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); |
1123 test(EFalse); |
1260 test(EFalse); |
1124 } |
1261 } |
1125 |
1262 |
1126 gRW[index] = pActiveRW; |
1263 gRW[index] = pActiveRW; |
1127 break; |
1264 break; |
1128 |
1265 |
1129 case ETestResult : |
1266 case ETestResult : |
1130 TUSB_VERBOSE_PRINT2 ("Test index %d complete - value %d",index,value); |
1267 TUSB_VERBOSE_PRINT2 ("Test index %d complete - value %d",index,value); |
1131 // 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 |
1132 if (!value) |
1273 if (!value) |
1133 { |
1274 { |
1134 sendStatus = EFalse; |
1275 sendStatus = EFalse; |
1135 r = iPort[0].SendEp0StatusPacket(); |
1276 r = iPort[0].SendEp0StatusPacket(); |
1136 } |
1277 } |
1137 if (index < KMaxConcurrentTests) |
1278 if (index < KMaxConcurrentTests) |
1138 { |
1279 { |
1139 if (gRW[index] != NULL) |
1280 if (gRW[index] != NULL) |
1140 { |
1281 { |
1164 break; |
1307 break; |
1165 |
1308 |
1166 case ETestConnect : |
1309 case ETestConnect : |
1167 test.Start (_L("Connect")); |
1310 test.Start (_L("Connect")); |
1168 sendStatus = EFalse; |
1311 sendStatus = EFalse; |
1169 r = iPort[0].SendEp0StatusPacket(); |
1312 r = iPort[0].SendEp0StatusPacket(); |
1170 if (iSoftwareConnect) |
1313 if (iSoftwareConnect) |
1171 { |
1314 { |
1172 r = iPort[0].DeviceDisconnectFromHost(); |
1315 r = iPort[0].DeviceDisconnectFromHost(); |
1173 test_KErrNone (r); |
1316 test_KErrNone (r); |
1174 |
1317 |
1175 TUint32 waitTime = (TUint32)value * 1000; |
1318 TUint32 waitTime = (TUint32)value * 1000; |
1176 if (waitTime == 0) |
1319 if (waitTime == 0) |
1177 { |
1320 { |
1178 waitTime = 5000; // default to 5 milliseconds |
1321 waitTime = 5000; // default to 5 milliseconds |
1179 } |
1322 } |
1180 iTimer.After(iStatus,waitTime); |
1323 iTimer.After(iStatus,waitTime); |
1181 iPending = EPendingTimer; |
1324 iPending = EPendingTimer; |
1182 |
1325 |
1183 SetActive(); |
1326 SetActive(); |
1184 } |
1327 } |
1185 else |
1328 else |
1186 { |
1329 { |
1187 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"); |
1188 iConsole->Printf(_L("disconnect/reconnect\n")); |
1332 iConsole->Printf(_L("disconnect/reconnect\n")); |
|
1333 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP25, "disconnect/reconnect\n"); |
1189 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"); |
1190 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... "); |
1191 test.End (); |
1338 test.End (); |
1192 } |
1339 } |
1193 break; |
1340 break; |
1194 |
1341 |
1195 case ETestDisconnect : |
1342 case ETestDisconnect : |
1196 test.Start (_L("Disconnect")); |
1343 test.Start (_L("Disconnect")); |
1197 // send this now as the port will be disconnected |
1344 // send this now as the port will be disconnected |
1198 sendStatus = EFalse; |
1345 sendStatus = EFalse; |
1199 r = iPort[0].SendEp0StatusPacket(); |
1346 r = iPort[0].SendEp0StatusPacket(); |
1200 if (iSoftwareConnect) |
1347 if (iSoftwareConnect) |
1201 { |
1348 { |
1202 r = iPort[0].DeviceDisconnectFromHost(); |
1349 r = iPort[0].DeviceDisconnectFromHost(); |
1203 test_KErrNone (r); |
1350 test_KErrNone (r); |
1204 } |
1351 } |
1205 else |
1352 else |
1206 { |
1353 { |
1207 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"); |
1208 iConsole->Printf(_L("disconnect/reconnect\n")); |
1356 iConsole->Printf(_L("disconnect/reconnect\n")); |
|
1357 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP29, "disconnect/reconnect\n"); |
1209 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"); |
1210 iConsole->Printf(_L("the USB cable NOW... ")); |
1360 iConsole->Printf(_L("the USB cable NOW... ")); |
1211 } |
1361 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP31, "the USB cable NOW... "); |
|
1362 } |
1212 |
1363 |
1213 test.End (); |
1364 test.End (); |
1214 break; |
1365 break; |
1215 |
1366 |
1216 case ETestMassStorage : |
1367 case ETestMassStorage : |
1217 test.Start (_L("Select Mass Storage")); |
1368 test.Start (_L("Select Mass Storage")); |
1218 |
1369 |
1219 // send this now as the port will be disconnected |
1370 // send this now as the port will be disconnected |
1220 sendStatus = EFalse; |
1371 sendStatus = EFalse; |
1221 r = iPort[0].SendEp0StatusPacket(); |
1372 r = iPort[0].SendEp0StatusPacket(); |
1222 test_KErrNone(r); |
1373 test_KErrNone(r); |
1223 |
1374 |
1224 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
1375 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
1225 { |
1376 { |
1226 delete iDeviceStateNotifier[portNumber]; |
1377 delete iDeviceStateNotifier[portNumber]; |
1227 delete iStallNotifier[portNumber]; |
1378 delete iStallNotifier[portNumber]; |
1228 if (portNumber == 0) |
1379 if (portNumber == 0) |
1229 { |
1380 { |
1230 r = iPort[portNumber].RemoveStringDescriptor(stridx1); |
1381 r = iPort[portNumber].RemoveStringDescriptor(stridx1); |
1231 if (r != KErrNone) |
1382 if (r != KErrNone) |
1232 { |
1383 { |
1233 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); |
1234 } |
1386 } |
1235 r = iPort[portNumber].RemoveStringDescriptor(stridx2); |
1387 r = iPort[portNumber].RemoveStringDescriptor(stridx2); |
1236 if (r != KErrNone) |
1388 if (r != KErrNone) |
1237 { |
1389 { |
1238 TUSB_PRINT1("Error %d on string removal", r); |
1390 TUSB_PRINT1("Error %d on string removal", r); |
1239 } |
1391 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_PROCESSEP0CONTROLPACKET_DUP33, "Error %d on string removal", r); |
|
1392 } |
1240 } |
1393 } |
1241 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 } |
1242 #ifdef USB_SC |
1399 #ifdef USB_SC |
1243 RChunk* commChunk; |
1400 RChunk* commChunk; |
1244 User::LeaveIfError(iPort[portNumber].GetDataTransferChunk(commChunk)); |
1401 User::LeaveIfError(iPort[portNumber].GetDataTransferChunk(commChunk)); |
1245 commChunk->Close(); |
1402 commChunk->Close(); |
1246 TUSB_PRINT("commChunk->Close"); |
1403 #endif |
1247 #endif |
|
1248 iPort[portNumber].Close(); // close USB channel |
1404 iPort[portNumber].Close(); // close USB channel |
1249 } |
1405 } |
1250 |
1406 |
1251 r = iPort[0].Open(0); |
1407 r = iPort[0].Open(0); |
1252 test_KErrNone(r); |
1408 test_KErrNone(r); |
1253 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 } |
1254 |
1414 |
1255 SetupDescriptors(iLddPtr, &iPort[0],value); |
1415 SetupDescriptors(iLddPtr, &iPort[0],value); |
1256 StartMassStorage(&iPort[0]); |
1416 StartMassStorage(&iPort[0]); |
1257 |
1417 |
1258 test.Next (_L("Enumeration...")); |
1418 test.Next (_L("Enumeration...")); |
1259 r = ReEnumerate(); |
1419 r = ReEnumerate(); |
1260 test_KErrNone(r); |
1420 test_KErrNone(r); |
1261 |
1421 |
1262 |
1422 |
1263 test.End (); |
1423 test.End (); |
1264 break; |
1424 break; |
1392 // that prevents the readZlp flag from being set |
1560 // that prevents the readZlp flag from being set |
1393 // test_Value(r, (r == KErrNone) || (r == KErrCompletion) || (r == KErrEof)); |
1561 // test_Value(r, (r == KErrNone) || (r == KErrCompletion) || (r == KErrEof)); |
1394 if (r == KErrCompletion) |
1562 if (r == KErrCompletion) |
1395 { |
1563 { |
1396 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 } |
1397 scCharPtr = (TUint8 *)scReadData; |
1569 scCharPtr = (TUint8 *)scReadData; |
1398 // Print the host log file |
1570 // Print the host log file |
1399 for (TUint i = 0; i < readSize; i++) |
1571 for (TUint i = 0; i < readSize; i++) |
1400 { |
1572 { |
1401 if (* scCharPtr == '\r') |
1573 if (* scCharPtr == '\r') |
1402 { |
1574 { |
1403 lineBuf[j++] = '\0'; |
1575 lineBuf[j++] = '\0'; |
1404 RDebug::Print (_L("%s"),lineBuf); |
1576 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP02, "%S",*lineBuf); |
1405 j = 0; |
1577 j = 0; |
1406 } |
1578 } |
1407 else |
1579 else |
1408 { |
1580 { |
1409 if (* scCharPtr != '\n') |
1581 if (* scCharPtr != '\n') |
1410 { |
1582 { |
1411 lineBuf[j++] = * scCharPtr; |
1583 lineBuf[j++] = * scCharPtr; |
1412 } |
1584 } |
1413 } |
1585 } |
1414 scCharPtr++; |
1586 scCharPtr++; |
1415 } |
1587 } |
1416 } |
1588 } |
1417 if (r == KErrNone) |
1589 if (r == KErrNone) |
1418 { |
1590 { |
1419 User::WaitForRequest(status); |
1591 User::WaitForRequest(status); |
1420 test_KErrNone(status.Int()); |
1592 test_KErrNone(status.Int()); |
1421 } |
1593 } |
1422 } |
1594 } |
1423 while (r >= KErrNone && !readZlp); |
1595 while (r >= KErrNone && !readZlp); |
1424 #else |
1596 #else |
1425 TPtr8 readBuf((TUint8 *)User::Alloc(KHostLogFileSize),KHostLogFileSize,KHostLogFileSize); |
1597 TPtr8 readBuf((TUint8 *)User::Alloc(KHostLogFileSize),KHostLogFileSize,KHostLogFileSize); |
1426 iPort[0].ReadUntilShort(status, (TEndpointNumber)firstBulkOutEndpoint, readBuf); |
1598 iPort[0].ReadUntilShort(status, (TEndpointNumber)firstBulkOutEndpoint, readBuf); |
1427 User::WaitForRequest(status); |
1599 User::WaitForRequest(status); |
1428 test_KErrNone(status.Int()); |
1600 test_KErrNone(status.Int()); |
1429 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 } |
1430 for (TUint i = 0; i < readBuf.Length(); i++) |
1606 for (TUint i = 0; i < readBuf.Length(); i++) |
1431 { |
1607 { |
1432 if (readBuf[i] == '\r') |
1608 if (readBuf[i] == '\r') |
1433 { |
1609 { |
1434 lineBuf[j++] = '\0'; |
1610 lineBuf[j++] = '\0'; |
1435 RDebug::Print (_L("%s"),lineBuf); |
1611 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP04, "%s",*lineBuf); |
1436 j = 0; |
1612 j = 0; |
1437 } |
1613 } |
1438 else |
1614 else |
1439 { |
1615 { |
1440 if (readBuf[i] != '\n') |
1616 if (readBuf[i] != '\n') |
1441 { |
1617 { |
1442 lineBuf[j++] = readBuf[i]; |
1618 lineBuf[j++] = readBuf[i]; |
1443 } |
1619 } |
1444 } |
1620 } |
1445 } |
1621 } |
1446 User::Free ((TAny *)readBuf.Ptr()); |
1622 User::Free ((TAny *)readBuf.Ptr()); |
1447 #endif |
1623 #endif |
1448 } |
1624 } |
1449 |
1625 |
1450 void CActiveControl::QueryUsbClientL(LDDConfigPtr aLddPtr, RDEVCLIENT* aPort) |
1626 void CActiveControl::QueryUsbClientL(LDDConfigPtr aLddPtr, RDEVCLIENT* aPort) |
1451 { |
1627 { |
1452 // Get device/endpoint capabilities |
1628 // Get device/endpoint capabilities |
1453 // |
1629 // |
1454 // A TPckg, or TPckBuf was not used in the following, because |
1630 // A TPckg, or TPckBuf was not used in the following, because |
1472 // TPtr8 databuf(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
1648 // TPtr8 databuf(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
1473 // |
1649 // |
1474 |
1650 |
1475 // Device |
1651 // Device |
1476 // === Device Descriptor |
1652 // === Device Descriptor |
1477 |
1653 |
1478 test.Start(_L("Query device and Endpoint Capabilities")); |
1654 test.Start(_L("Query device and Endpoint Capabilities")); |
1479 |
1655 |
1480 |
1656 |
1481 TUsbDeviceCaps d_caps; |
1657 TUsbDeviceCaps d_caps; |
1482 TInt r = aPort->DeviceCaps(d_caps); |
1658 TInt r = aPort->DeviceCaps(d_caps); |
1483 test_KErrNone(r); |
1659 test_KErrNone(r); |
1484 |
1660 |
1485 const TInt n = d_caps().iTotalEndpoints; |
1661 const TInt n = d_caps().iTotalEndpoints; |
1486 |
1662 |
1487 TUSB_PRINT("### USB device capabilities:"); |
1663 TUSB_PRINT("### USB device capabilities:"); |
|
1664 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL, "### USB device capabilities:"); |
1488 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); |
1489 TUSB_PRINT1("Supports Software-Connect: %s", |
1667 TUSB_PRINT1("Supports Software-Connect: %s", |
1490 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")); |
1491 TUSB_PRINT1("Device is Self-Powered: %s", |
1671 TUSB_PRINT1("Device is Self-Powered: %s", |
1492 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")); |
1493 TUSB_PRINT1("Supports Remote-Wakeup: %s", |
1675 TUSB_PRINT1("Supports Remote-Wakeup: %s", |
1494 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")); |
1495 TUSB_PRINT1("Supports High-speed: %s", |
1679 TUSB_PRINT1("Supports High-speed: %s", |
1496 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")); |
1497 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", |
1498 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? |
1687 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? |
1499 _S("yes") : _S("no")); |
1688 _L("yes") : _L("no")); |
1500 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", |
1501 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ? |
1693 (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ? |
1502 _S("yes") : _S("no")); |
1694 _L("yes") : _L("no")); |
1503 TUSB_PRINT(""); |
1695 TUSB_PRINT(""); |
|
1696 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP08, ""); |
1504 |
1697 |
1505 iSoftwareConnect = d_caps().iConnect; // we need to remember this |
1698 iSoftwareConnect = d_caps().iConnect; // we need to remember this |
1506 test_Equal(aLddPtr->iSoftConnect,iSoftwareConnect); |
1699 test_Equal(aLddPtr->iSoftConnect,iSoftwareConnect); |
1507 |
1700 |
1508 iSupportResourceAllocationV2 = ((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0); |
1701 iSupportResourceAllocationV2 = ((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0); |
1509 |
1702 |
1510 // only check capabilities if set; therefore allowing them to be disabled |
1703 // only check capabilities if set; therefore allowing them to be disabled |
1511 if (aLddPtr->iSelfPower) |
1704 if (aLddPtr->iSelfPower) |
1512 { |
1705 { |
1513 test(d_caps().iSelfPowered); |
1706 test(d_caps().iSelfPowered); |
1514 } |
1707 } |
1515 |
1708 |
1516 // only check capabilities if set; therefore allowing them to be disabled |
1709 // only check capabilities if set; therefore allowing them to be disabled |
1517 if (aLddPtr->iRemoteWakeup) |
1710 if (aLddPtr->iRemoteWakeup) |
1518 { |
1711 { |
1519 test(d_caps().iRemoteWakeup); |
1712 test(d_caps().iRemoteWakeup); |
1520 } |
1713 } |
1521 |
1714 |
1522 test_Equal(d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower,aLddPtr->iFeatures); |
1715 test_Equal(d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower,aLddPtr->iFeatures); |
1523 |
1716 |
1524 // only check capability if set; therefore allowing it to be disabled |
1717 // only check capability if set; therefore allowing it to be disabled |
1525 if (aLddPtr->iHighSpeed) |
1718 if (aLddPtr->iHighSpeed) |
1526 { |
1719 { |
1527 test(d_caps().iHighSpeed); |
1720 test(d_caps().iHighSpeed); |
1528 } |
1721 } |
1529 |
1722 |
1530 test_Equal(aLddPtr->iNumEndpoints,n); |
1723 test_Equal(aLddPtr->iNumEndpoints,n); |
1531 |
1724 |
1532 // Endpoints |
1725 // Endpoints |
1533 TUsbcEndpointData data[KUsbcMaxEndpoints]; |
1726 TUsbcEndpointData data[KUsbcMaxEndpoints]; |
1534 TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
1727 TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data)); |
1535 r = aPort->EndpointCaps(dataptr); |
1728 r = aPort->EndpointCaps(dataptr); |
1536 test_KErrNone(r); |
1729 test_KErrNone(r); |
1537 |
1730 |
1538 TUSB_PRINT("### USB device endpoint capabilities:"); |
1731 TUSB_PRINT("### USB device endpoint capabilities:"); |
|
1732 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP09, "### USB device endpoint capabilities:"); |
1539 for (TInt i = 0; i < n; i++) |
1733 for (TInt i = 0; i < n; i++) |
1540 { |
1734 { |
1541 const TUsbcEndpointCaps* caps = &data[i].iCaps; |
1735 const TUsbcEndpointCaps* caps = &data[i].iCaps; |
1542 |
1736 |
1543 |
1737 |
1544 TBuf<40> sizeStr(_S("unknown")); |
1738 TBuf<40> sizeStr(_S("unknown")); |
1545 if (caps->iSizes == KUsbEpNotAvailable) |
1739 if (caps->iSizes == KUsbEpNotAvailable) |
1546 { |
1740 { |
1547 sizeStr = _S("Not Available"); |
1741 sizeStr = _S("Not Available"); |
1548 } |
1742 } |
1549 else |
1743 else |
1550 { |
1744 { |
1551 sizeStr.SetLength(0); |
1745 sizeStr.SetLength(0); |
1552 if (caps->iSizes & KUsbEpSizeCont) |
1746 if (caps->iSizes & KUsbEpSizeCont) |
1553 sizeStr.Append(_S(" Continuous"),11); |
1747 sizeStr.Append(_S(" Continuous"),11); |
1582 if (caps->iTypesAndDir & KUsbEpTypeBulk) |
1776 if (caps->iTypesAndDir & KUsbEpTypeBulk) |
1583 typeStr.Append(_S("Bulk "),5); |
1777 typeStr.Append(_S("Bulk "),5); |
1584 if (caps->iTypesAndDir & KUsbEpTypeInterrupt) |
1778 if (caps->iTypesAndDir & KUsbEpTypeInterrupt) |
1585 typeStr.Append(_S("Interrupt "),10); |
1779 typeStr.Append(_S("Interrupt "),10); |
1586 if (caps->iTypesAndDir & KUsbEpTypeIsochronous) |
1780 if (caps->iTypesAndDir & KUsbEpTypeIsochronous) |
1587 typeStr.Append(_S("Isochronous"),11); |
1781 typeStr.Append(_S("Isochronous"),11); |
1588 } |
1782 } |
1589 |
1783 |
1590 TBuf<20> directionStr(_S("unknown")); |
1784 TBuf<20> directionStr(_S("unknown")); |
1591 |
1785 |
1592 if (caps->iTypesAndDir & KUsbEpDirIn) |
1786 if (caps->iTypesAndDir & KUsbEpDirIn) |
1593 directionStr = _S("In"); |
1787 directionStr = _S("In"); |
1594 if (caps->iTypesAndDir & KUsbEpDirOut) |
1788 if (caps->iTypesAndDir & KUsbEpDirOut) |
1595 directionStr = _S("Out"); |
1789 directionStr = _S("Out"); |
1596 if (caps->iTypesAndDir & KUsbEpDirBidirect) |
1790 if (caps->iTypesAndDir & KUsbEpDirBidirect) |
1597 directionStr = _S("Both"); |
1791 directionStr = _S("Both"); |
1598 |
1792 |
1599 TUSB_PRINT4("Endpoint:%d Sizes =%s Type = %s - %s", |
1793 TUSB_PRINT4("Endpoint:%d Sizes =%s Type = %s - %s", |
1600 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); |
1601 } |
1797 } |
1602 TUSB_PRINT(""); |
1798 TUSB_PRINT(""); |
|
1799 OstTrace0(TRACE_NORMAL, CACTIVECONTROL_QUERYUSBCLIENTL_DUP11, ""); |
1603 |
1800 |
1604 test.End(); |
1801 test.End(); |
1605 |
1802 |
1606 } |
1803 } |
1607 |
1804 |
1608 |
1805 |
1609 void CActiveControl::AllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1806 void CActiveControl::AllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1610 { |
1807 { |
1611 TBool res = EFalse; |
1808 TBool res = EFalse; |
1612 |
1809 |
1613 TInt r = aPort->AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
1810 TInt r = aPort->AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
1614 if (r == KErrNone) |
1811 if (r == KErrNone) |
1615 RDebug::Print(_L("DMA allocation on endpoint %d: KErrNone"), aEndpoint); |
1812 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA, "DMA allocation on endpoint %d: KErrNone", aEndpoint); |
1616 else if (r == KErrInUse) |
1813 else if (r == KErrInUse) |
1617 RDebug::Print(_L("DMA allocation on endpoint %d: KErrInUse"), aEndpoint); |
1814 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA_DUP01, "DMA allocation on endpoint %d: KErrInUse", aEndpoint); |
1618 else if (r == KErrNotSupported) |
1815 else if (r == KErrNotSupported) |
1619 RDebug::Print(_L("DMA allocation on endpoint %d: KErrNotSupported"), aEndpoint); |
1816 OstTrace1(TRACE_NORMAL, CACTIVECONTROL_ALLOCATEENDPOINTDMA_DUP02, "DMA allocation on endpoint %d: KErrNotSupported", aEndpoint); |
1620 else |
1817 else |
1621 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", |
1622 aEndpoint, r); |
1847 aEndpoint, r); |
1623 #ifdef USB_SC |
1848 #ifdef USB_SC |
1624 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1849 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1625 #else |
1850 #else |
1626 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1851 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
1627 #endif |
1852 #endif |
1628 |
1853 |
1629 TUSB_PRINT2("DMA on endpoint %d %s\n", |
1854 TUSB_PRINT2("DMA on endpoint %d %s\n", |
1630 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1855 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
1631 |
1856 OstTraceExt2(TRACE_NORMAL, CACTIVECONTROL_DEALLOCATEENDPOINTDMA_DUP03, "DMA on endpoint %d %s\n", |
1632 if ((r == KErrNone) && !res) |
1857 aEndpoint, res ? _L("allocated") : _L("not allocated")); |
1633 RDebug::Print(_L("(Allocation success but negative query result: contradiction!)\n")); |
|
1634 else if ((r != KErrNone) && res) |
|
1635 RDebug::Print(_L("(Allocation failure but positive query result: contradiction!)\n")); |
|
1636 } |
|
1637 |
|
1638 |
|
1639 void CActiveControl::DeAllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
|
1640 { |
|
1641 TBool res = FALSE; |
|
1642 TInt r = aPort->DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA); |
|
1643 if (r == KErrNone) |
|
1644 RDebug::Print(_L("DMA deallocation on endpoint %d: KErrNone"), aEndpoint); |
|
1645 else if (r == KErrNotSupported) |
|
1646 RDebug::Print(_L("DMA deallocation on endpoint %d: KErrNotSupported"), aEndpoint); |
|
1647 else |
|
1648 RDebug::Print(_L("DMA deallocation on endpoint %d: unexpected return value %d"), |
|
1649 aEndpoint, r); |
|
1650 #ifdef USB_SC |
|
1651 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
|
1652 #else |
|
1653 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA); |
|
1654 #endif |
|
1655 |
|
1656 TUSB_PRINT2("DMA on endpoint %d %s\n", |
|
1657 aEndpoint, res ? _S("allocated") : _S("not allocated")); |
|
1658 } |
1858 } |
1659 |
1859 |
1660 #ifndef USB_SC |
1860 #ifndef USB_SC |
1661 void CActiveControl::AllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1861 void CActiveControl::AllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1662 { |
1862 { |
1663 TBool res = FALSE; |
1863 TBool res = FALSE; |
1664 TInt r = aPort->AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1864 TInt r = aPort->AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1665 if (r == KErrNone) |
1865 if (r == KErrNone) |
1666 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); |
1667 else if (r == KErrInUse) |
1867 else if (r == KErrInUse) |
1668 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); |
1669 else if (r == KErrNotSupported) |
1869 else if (r == KErrNotSupported) |
1670 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); |
1671 else |
1871 else |
1672 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", |
1673 aEndpoint, r); |
1873 aEndpoint, r); |
1674 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1874 res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1675 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1875 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1676 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")); |
1677 |
1879 |
1678 if ((r == KErrNone) && !res) |
1880 if ((r == KErrNone) && !res) |
1679 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"); |
1680 else if ((r != KErrNone) && res) |
1882 else if ((r != KErrNone) && res) |
1681 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"); |
1682 } |
1884 } |
1683 |
1885 |
1684 |
1886 |
1685 void CActiveControl::DeAllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1887 void CActiveControl::DeAllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint) |
1686 { |
1888 { |
1687 TInt r = aPort->DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1889 TInt r = aPort->DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1688 if (r == KErrNone) |
1890 if (r == KErrNone) |
1689 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); |
1690 else if (r == KErrNotSupported) |
1892 else if (r == KErrNotSupported) |
1691 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); |
1692 else |
1894 else |
1693 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", |
1694 aEndpoint, r); |
1896 aEndpoint, r); |
1695 TBool res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1897 TBool res = aPort->QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering); |
1696 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1898 TUSB_PRINT2("Double Buffering on endpoint %d %s\n", |
1697 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")); |
1698 } |
1902 } |
1699 |
1903 |
1700 #endif |
1904 #endif |
1701 |
1905 |
1702 TInt CActiveControl::ReEnumerate() |
1906 TInt CActiveControl::ReEnumerate() |
1732 ((device_state == EUsbcDeviceStateDefault) ? _S("Default") : |
1943 ((device_state == EUsbcDeviceStateDefault) ? _S("Default") : |
1733 ((device_state == EUsbcDeviceStateAddress) ? _S("Address") : |
1944 ((device_state == EUsbcDeviceStateAddress) ? _S("Address") : |
1734 ((device_state == EUsbcDeviceStateConfigured) ? _S("Configured") : |
1945 ((device_state == EUsbcDeviceStateConfigured) ? _S("Configured") : |
1735 ((device_state == EUsbcDeviceStateSuspended) ? _S("Suspended") : |
1946 ((device_state == EUsbcDeviceStateSuspended) ? _S("Suspended") : |
1736 _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")))))))); |
1737 } |
1957 } |
1738 |
1958 |
1739 // Check the speed of the established physical USB connection |
1959 // Check the speed of the established physical USB connection |
1740 iHighSpeed = iPort[0].CurrentlyUsingHighSpeed(); |
1960 iHighSpeed = iPort[0].CurrentlyUsingHighSpeed(); |
1741 if (iHighSpeed) |
1961 if (iHighSpeed) |
1742 { |
1962 { |
1743 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"); |
1744 } |
1965 } |
1745 else |
1966 else |
1746 { |
1967 { |
1747 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"); |
1748 } |
1970 } |
1749 |
1971 |
1750 return KErrNone; |
1972 return KErrNone; |
1751 } |
1973 } |
1752 |
1974 |
1753 |
1975 |
1754 #ifdef USB_SC |
1976 #ifdef USB_SC |
1755 |
1977 |
1756 void CActiveControl::SetupTransferedInterface(IFConfigPtr* aIfPtr, TInt aPortNumber) |
1978 void CActiveControl::SetupTransferedInterface(IFConfigPtr* aIfPtr, TInt aPortNumber) |
1757 { |
1979 { |
1758 TInt r; |
1980 TInt r; |
1759 TUSB_VERBOSE_PRINT1("SetupTransferedInterface %d", aPortNumber); |
1981 TUSB_VERBOSE_PRINT1("SetupTransferedInterface %d", aPortNumber); |
|
1982 if(gVerbose) |
|
1983 { |
|
1984 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_SETUPTRANSFEREDINTERFACE, "SetupTransferedInterface %d", aPortNumber); |
|
1985 } |
1760 test.Start (_L("Setup Transfered Interface ")); |
1986 test.Start (_L("Setup Transfered Interface ")); |
1761 |
1987 |
1762 #ifdef USB_SC |
1988 #ifdef USB_SC |
1763 TUsbcScInterfaceInfoBuf ifc = *((*aIfPtr)->iInfoPtr); |
1989 TUsbcScInterfaceInfoBuf ifc = *((*aIfPtr)->iInfoPtr); |
1764 #else |
1990 #else |
1765 TUsbcInterfaceInfoBuf ifc = *((*aIfPtr)->iInfoPtr); |
1991 TUsbcInterfaceInfoBuf ifc = *((*aIfPtr)->iInfoPtr); |
1766 #endif |
1992 #endif |
1767 |
1993 |
1768 TBuf8<KUsbDescSize_Interface> ifDescriptor; |
1994 TBuf8<KUsbDescSize_Interface> ifDescriptor; |
1769 r = iPort[aPortNumber].GetInterfaceDescriptor(0, ifDescriptor); |
1995 r = iPort[aPortNumber].GetInterfaceDescriptor(0, ifDescriptor); |
1770 test_KErrNone(r); |
1996 test_KErrNone(r); |
1771 |
1997 |
1772 // Check the interface descriptor |
1998 // Check the interface descriptor |
1886 } |
2114 } |
1887 } |
2115 } |
1888 iNumInterfaceSettings[aPortNumber] = alternateNumber; |
2116 iNumInterfaceSettings[aPortNumber] = alternateNumber; |
1889 if (!gSkip) |
2117 if (!gSkip) |
1890 { |
2118 { |
1891 TestInvalidSetInterface (&iPort[aPortNumber],iNumInterfaceSettings[aPortNumber]); |
2119 TestInvalidSetInterface (&iPort[aPortNumber],iNumInterfaceSettings[aPortNumber]); |
1892 TestInvalidReleaseInterface (&iPort[aPortNumber],iNumInterfaceSettings[aPortNumber]); |
2120 TestInvalidReleaseInterface (&iPort[aPortNumber],iNumInterfaceSettings[aPortNumber]); |
1893 |
2121 |
1894 //TestDescriptorManipulation(iLddPtr->iHighSpeed,&iPort[aPortNumber],alternateNumber); |
2122 //TestDescriptorManipulation(iLddPtr->iHighSpeed,&iPort[aPortNumber],alternateNumber); |
1895 TestOtgExtensions(&iPort[aPortNumber]); |
2123 TestOtgExtensions(&iPort[aPortNumber]); |
1896 TestEndpoint0MaxPacketSizes(&iPort[aPortNumber]); |
2124 TestEndpoint0MaxPacketSizes(&iPort[aPortNumber]); |
1897 } |
2125 } |
1898 |
2126 |
1899 test.End(); |
2127 test.End(); |
1900 } |
2128 } |
1901 |
2129 |
1902 |
2130 |
1903 void CActiveControl::ConstructLOnSharedLdd(const RMessagePtr2& aMsg) |
2131 void CActiveControl::ConstructLOnSharedLdd(const RMessagePtr2& aMsg) |
1904 { |
2132 { |
1905 // currently only support one interface with one alternate settings |
2133 // currently only support one interface with one alternate settings |
1906 test.Start (_L("ConstructLOnSharedLdd Configuration")); |
2134 test.Start (_L("ConstructLOnSharedLdd Configuration")); |
1907 |
2135 |
1908 User::LeaveIfError(iPort[0].Open(aMsg, 0, EOwnerProcess)); |
2136 User::LeaveIfError(iPort[0].Open(aMsg, 0, EOwnerProcess)); |
1909 CleanupClosePushL(iPort[0]); |
2137 CleanupClosePushL(iPort[0]); |
1910 |
2138 |
1911 RChunk* chunk; |
2139 RChunk* chunk; |
1912 //Get the Ldd's RChunk, but don't own it. |
2140 //Get the Ldd's RChunk, but don't own it. |
1913 User::LeaveIfError(iPort[0].GetDataTransferChunk(chunk)); |
2141 User::LeaveIfError(iPort[0].GetDataTransferChunk(chunk)); |
1914 User::LeaveIfError(chunk->Open(aMsg, 1, FALSE, EOwnerProcess)); |
2142 User::LeaveIfError(chunk->Open(aMsg, 1, FALSE, EOwnerProcess)); |
1915 CleanupStack::Pop(); |
2143 CleanupStack::Pop(); |
1916 |
2144 |
1917 |
2145 |
1918 TInt r; |
2146 TInt r; |
1919 |
2147 |
1920 User::LeaveIfError(iFs.Connect()); |
2148 User::LeaveIfError(iFs.Connect()); |
1921 |
2149 |
1922 test_Compare(iConfigFileName->Length(),!=,0); |
2150 test_Compare(iConfigFileName->Length(),!=,0); |
1923 |
2151 |
1924 iTimer.CreateLocal(); |
2152 iTimer.CreateLocal(); |
1925 iPending = EPendingNone; |
2153 iPending = EPendingNone; |
1926 |
2154 |
1927 test.Next (_L("Open configuration file")); |
2155 test.Next (_L("Open configuration file")); |
1928 // set the session path to use the ROM if no drive specified |
2156 // set the session path to use the ROM if no drive specified |
1929 r=iFs.SetSessionPath(_L("Z:\\test\\")); |
2157 r=iFs.SetSessionPath(_L("Z:\\test\\")); |
1930 test_KErrNone(r); |
2158 test_KErrNone(r); |
1931 |
2159 |
1932 r = iConfigFile.Open(iFs, * iConfigFileName, EFileShareReadersOnly | EFileStreamText | EFileRead); |
2160 r = iConfigFile.Open(iFs, * iConfigFileName, EFileShareReadersOnly | EFileStreamText | EFileRead); |
1933 test_KErrNone(r); |
2161 test_KErrNone(r); |
1934 TUSB_VERBOSE_PRINT1("Configuration file %s Opened successfully", iConfigFileName->PtrZ()); |
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 } |
1935 |
2167 |
1936 test.Next (_L("Process configuration file")); |
2168 test.Next (_L("Process configuration file")); |
1937 test(ProcessConfigFile (iConfigFile,iConsole,&iLddPtr)); |
2169 test(ProcessConfigFile (iConfigFile,iConsole,&iLddPtr)); |
1938 |
2170 |
1939 iConfigFile.Close(); |
2171 iConfigFile.Close(); |
1940 |
2172 |
1941 test.Next (_L("LDD in configuration file")); |
2173 test.Next (_L("LDD in configuration file")); |
1942 test_NotNull(iLddPtr); |
2174 test_NotNull(iLddPtr); |
1943 |
2175 |
1944 LDDConfigPtr lddPtr = iLddPtr; |
2176 LDDConfigPtr lddPtr = iLddPtr; |
1945 TInt nextPort = 0; |
2177 TInt nextPort = 0; |
1946 while (lddPtr != NULL) |
2178 while (lddPtr != NULL) |
1947 { |
2179 { |
1948 // Load logical driver (LDD) |
2180 // Load logical driver (LDD) |
1949 // (There's no physical driver (PDD) with USB: it's a kernel extension DLL which |
2181 // (There's no physical driver (PDD) with USB: it's a kernel extension DLL which |
1950 // was already loaded at boot time.) |
2182 // was already loaded at boot time.) |
1951 test.Next (_L("Loading USB LDD")); |
2183 test.Next (_L("Loading USB LDD")); |
1952 TUSB_VERBOSE_PRINT1("Loading USB LDD ",lddPtr->iName.PtrZ()); |
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 } |
1953 r = User::LoadLogicalDevice(lddPtr->iName); |
2189 r = User::LoadLogicalDevice(lddPtr->iName); |
1954 test(r == KErrNone || r == KErrAlreadyExists); |
2190 test(r == KErrNone || r == KErrAlreadyExists); |
1955 |
2191 |
1956 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
2192 IFConfigPtr ifPtr = lddPtr->iIFPtr; |
1957 |
2193 |
1958 test.Next (_L("Opening Channels")); |
2194 test.Next (_L("Opening Channels")); |
1959 TUSB_VERBOSE_PRINT1("Successfully opened USB port %d", lddPtr->iNumChannels); |
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 } |
1960 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
2200 for (TInt portNumber = nextPort; portNumber < nextPort+lddPtr->iNumChannels; portNumber++) |
1961 { |
2201 { |
1962 test_Compare(lddPtr->iNumChannels,>,0); |
2202 test_Compare(lddPtr->iNumChannels,>,0); |
1963 |
2203 |
1964 // Open USB channel |
2204 // Open USB channel |
1965 |
2205 |
1966 TUSB_VERBOSE_PRINT("Successfully opened USB port"); |
2206 TUSB_VERBOSE_PRINT("Successfully opened USB port"); |
|
2207 if(gVerbose) |
|
2208 { |
|
2209 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP03, "Successfully opened USB port"); |
|
2210 } |
1967 |
2211 |
1968 // Query the USB device/Setup the USB interface |
2212 // Query the USB device/Setup the USB interface |
1969 if (portNumber == nextPort) |
2213 if (portNumber == nextPort) |
1970 { |
2214 { |
1971 // Change some descriptors to contain suitable values |
2215 // Change some descriptors to contain suitable values |
1972 SetupDescriptors(lddPtr, &iPort[portNumber]); |
2216 SetupDescriptors(lddPtr, &iPort[portNumber]); |
1973 } |
2217 } |
1974 |
2218 |
1975 if (portNumber == 0) |
2219 if (portNumber == 0) |
1976 { |
2220 { |
1977 QueryUsbClientL(lddPtr, &iPort[portNumber]); |
2221 QueryUsbClientL(lddPtr, &iPort[portNumber]); |
1978 } |
2222 } |
1979 |
2223 |
1980 test_NotNull(ifPtr); |
2224 test_NotNull(ifPtr); |
1981 |
2225 |
1982 if (iSupportResourceAllocationV2) |
2226 if (iSupportResourceAllocationV2) |
1983 { |
2227 { |
1984 PopulateInterfaceResourceAllocation(ifPtr, portNumber); |
2228 PopulateInterfaceResourceAllocation(ifPtr, portNumber); |
1985 } |
2229 } |
1986 |
2230 |
1987 IFConfigPtr defaultIfPtr = ifPtr; |
2231 IFConfigPtr defaultIfPtr = ifPtr; |
1988 SetupTransferedInterface(&ifPtr,portNumber); |
2232 SetupTransferedInterface(&ifPtr,portNumber); |
1989 |
2233 |
1990 |
2234 |
1991 if (!iSupportResourceAllocationV2) |
2235 if (!iSupportResourceAllocationV2) |
1992 { |
2236 { |
1993 // allocate endpoint DMA and double buffering for all endpoints on default interface when using resource allocation v1 api |
2237 // allocate endpoint DMA and double buffering for all endpoints on default interface when using resource allocation v1 api |
1994 for (TUint8 i = 1; i <= defaultIfPtr->iInfoPtr->iTotalEndpointsUsed; i++) |
2238 for (TUint8 i = 1; i <= defaultIfPtr->iInfoPtr->iTotalEndpointsUsed; i++) |
1995 { |
2239 { |
1996 defaultIfPtr->iEpDMA[i-1] ? AllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i); |
2240 defaultIfPtr->iEpDMA[i-1] ? AllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateEndpointDMA(&iPort[portNumber],(TENDPOINTNUMBER)i); |
1997 #ifndef USB_SC |
2241 #ifndef USB_SC |
1998 defaultIfPtr->iEpDoubleBuff[i-1] ? AllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i); |
2242 defaultIfPtr->iEpDoubleBuff[i-1] ? AllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i) : DeAllocateDoubleBuffering(&iPort[portNumber],(TENDPOINTNUMBER)i); |
1999 #endif |
2243 #endif |
2000 } |
2244 } |
2001 } |
2245 } |
2002 } |
2246 } |
2003 |
2247 |
2004 iTotalChannels += lddPtr->iNumChannels; |
2248 iTotalChannels += lddPtr->iNumChannels; |
2005 nextPort += lddPtr->iNumChannels; |
2249 nextPort += lddPtr->iNumChannels; |
2006 lddPtr = lddPtr->iPtrNext; |
2250 lddPtr = lddPtr->iPtrNext; |
2007 } |
2251 } |
2008 |
2252 |
2009 TUSB_VERBOSE_PRINT("All Interfaces and Alternate Settings successfully set up"); |
2253 TUSB_VERBOSE_PRINT("All Interfaces and Alternate Settings successfully set up"); |
2010 |
2254 if(gVerbose) |
|
2255 { |
|
2256 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP04, "All Interfaces and Alternate Settings successfully set up"); |
|
2257 } |
|
2258 |
2011 test.Next (_L("Start Idle Counter Thread")); |
2259 test.Next (_L("Start Idle Counter Thread")); |
2012 r = iIdleCounterThread.Create(_L("IdleCounter"), IdleCounterThread, KDefaultStackSize, KMinHeapSize, KMinHeapSize, NULL); |
2260 r = iIdleCounterThread.Create(_L("IdleCounter"), IdleCounterThread, KDefaultStackSize, KMinHeapSize, KMinHeapSize, NULL); |
2013 test_KErrNone(r); |
2261 test_KErrNone(r); |
2014 iIdleCounterThread.Resume(); |
2262 iIdleCounterThread.Resume(); |
2015 // Allow some time for low-priority counter process |
2263 // Allow some time for low-priority counter process |
2022 User::After(100000); // 0.1 second |
2270 User::After(100000); // 0.1 second |
2023 TInt64 val1 = iIdleCounter->iCounter; |
2271 TInt64 val1 = iIdleCounter->iCounter; |
2024 User::After(1000000); // 1 second |
2272 User::After(1000000); // 1 second |
2025 TInt64 val2 = iIdleCounter->iCounter; |
2273 TInt64 val2 = iIdleCounter->iCounter; |
2026 TUSB_PRINT1("Idle Counter when test inactive: %Ldinc/ms", (val2 - val1) / 1000); |
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); |
2027 |
2276 |
2028 test.Next (_L("Enumeration...")); |
2277 test.Next (_L("Enumeration...")); |
2029 r = ReEnumerate(); |
2278 r = ReEnumerate(); |
2030 test_KErrNone(r); |
2279 test_KErrNone(r); |
2031 |
2280 |
2032 TUSB_VERBOSE_PRINT("Device successfully re-enumerated\n"); |
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 } |
2033 |
2286 |
2034 |
2287 |
2035 if (iLddPtr->iHighSpeed && !gSkip) |
2288 if (iLddPtr->iHighSpeed && !gSkip) |
2036 { |
2289 { |
2037 test.Next (_L("High Speed")); |
2290 test.Next (_L("High Speed")); |
2038 test(iHighSpeed); |
2291 test(iHighSpeed); |
2039 } |
2292 } |
2040 |
2293 |
2041 test.Next (_L("Create Notifiers")); |
2294 test.Next (_L("Create Notifiers")); |
2042 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
2295 for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) |
2043 { |
2296 { |
2044 |
2297 |
2045 // Create device state active object |
2298 // Create device state active object |
2046 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
2299 iDeviceStateNotifier[portNumber] = CActiveDeviceStateNotifier::NewL(iConsole, &iPort[portNumber], portNumber); |
2047 test_NotNull(iDeviceStateNotifier[portNumber]); |
2300 test_NotNull(iDeviceStateNotifier[portNumber]); |
2048 iDeviceStateNotifier[portNumber]->Activate(); |
2301 iDeviceStateNotifier[portNumber]->Activate(); |
2049 TUSB_VERBOSE_PRINT("Created device state notifier"); |
2302 TUSB_VERBOSE_PRINT("Created device state notifier"); |
|
2303 if(gVerbose) |
|
2304 { |
|
2305 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP07, "Created device state notifier"); |
|
2306 } |
2050 |
2307 |
2051 // Create endpoint stall status active object |
2308 // Create endpoint stall status active object |
2052 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
2309 iStallNotifier[portNumber] = CActiveStallNotifier::NewL(iConsole, &iPort[portNumber]); |
2053 test_NotNull(iStallNotifier[portNumber]); |
2310 test_NotNull(iStallNotifier[portNumber]); |
2054 iStallNotifier[portNumber]->Activate(); |
2311 iStallNotifier[portNumber]->Activate(); |
2055 TUSB_VERBOSE_PRINT("Created stall notifier"); |
2312 TUSB_VERBOSE_PRINT("Created stall notifier"); |
2056 |
2313 if(gVerbose) |
2057 TestInvalidSetInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
2314 { |
|
2315 OstTrace0(TRACE_VERBOSE, CACTIVECONTROL_CONSTRUCTLONSHAREDLDD_DUP08, "Created stall notifier"); |
|
2316 } |
|
2317 |
|
2318 TestInvalidSetInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
2058 TestInvalidReleaseInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
2319 TestInvalidReleaseInterface (&iPort[portNumber],iNumInterfaceSettings[portNumber]); |
2059 |
2320 |
2060 } |
2321 } |
2061 |
2322 |
2062 test.Next (_L("Endpoint Zero Max Packet Sizes")); |
2323 test.Next (_L("Endpoint Zero Max Packet Sizes")); |
2063 TUint ep0Size = iPort[0].EndpointZeroMaxPacketSizes(); |
2324 TUint ep0Size = iPort[0].EndpointZeroMaxPacketSizes(); |
2064 switch (ep0Size) |
2325 switch (ep0Size) |
2065 { |
2326 { |
2066 case KUsbEpSize8 : |
2327 case KUsbEpSize8 : |
2067 iEp0PacketSize = 8; |
2328 iEp0PacketSize = 8; |
2068 break; |
2329 break; |
2069 |
2330 |
2070 case KUsbEpSize16 : |
2331 case KUsbEpSize16 : |
2071 iEp0PacketSize = 16; |
2332 iEp0PacketSize = 16; |
2072 break; |
2333 break; |
2073 |
2334 |
2074 case KUsbEpSize32 : |
2335 case KUsbEpSize32 : |