os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0498.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // @file PBASE-T_USBDI-0498.cpp
    15 // @internalComponent
    16 // 
    17 //
    18 
    19 #include "PBASE-T_USBDI-0498.h"
    20 #include "testpolicy.h"
    21 #include "modelleddevices.h"
    22 #include "testliterals.h"
    23 
    24 
    25  
    26 
    27 namespace NUnitTesting_USBDI
    28 	{
    29 const TInt KBulkMaxTransferSize = 40000;
    30 const TUint KHostNumWriteBytes1 = 32000;
    31 const TUint KHostNumWriteBytes2 = 32000;
    32 const TInt KDeviceNumReadBytes = 64000;
    33 const TInt KDeviceNumWriteBytes = 64000;
    34 const TUint KHostNumReadBytes1 = 32000;
    35 const TUint KHostNumReadBytes2 = 32001; //allow or ZLP
    36 
    37 
    38 //Make these single bit values ... 
    39 // ... so that their completion can be easily recorded in a bit mask!
    40 const TUint32 KIfc1BulkTransferInId1  = 1<<0;
    41 const TUint32 KIfc1BulkTransferInId2  = 1<<1;
    42 const TUint32 KIfc2BulkTransferInId1  = 1<<2;
    43 const TUint32 KIfc2BulkTransferInId2  = 1<<3;
    44 const TUint32 KIfc1BulkTransferInIdMask = KIfc1BulkTransferInId1 | KIfc1BulkTransferInId2; 
    45 const TUint32 KIfc2BulkTransferInIdMask = KIfc2BulkTransferInId1 | KIfc2BulkTransferInId2;
    46 const TUint32 KBulkTransferInIdMask = KIfc1BulkTransferInIdMask | KIfc2BulkTransferInIdMask;
    47 const TUint32 KIfc1BulkTransferOutId1 = 1<<4;
    48 const TUint32 KIfc1BulkTransferOutId2 = 1<<5;
    49 const TUint32 KIfc2BulkTransferOutId1 = 1<<6;
    50 const TUint32 KIfc2BulkTransferOutId2 = 1<<7;
    51 const TUint32 KIfc1BulkTransferOutIdMask = KIfc1BulkTransferOutId1 | KIfc1BulkTransferOutId2; 
    52 const TUint32 KIfc2BulkTransferOutIdMask = KIfc2BulkTransferOutId1 | KIfc2BulkTransferOutId2;
    53 const TUint32 KBulkTransferOutIdMask = KIfc1BulkTransferOutIdMask | KIfc2BulkTransferOutIdMask;
    54 const TUint32 KBulkTransferIdMask = KBulkTransferInIdMask | KBulkTransferOutIdMask;
    55 
    56 const TInt KUnexpectedTransferID = -101;
    57 const TInt KUndefinedStep	 = -102;
    58 
    59 const TInt KMaxTimeDiffPercentage = 25;
    60 
    61 
    62 
    63 _LIT(KTestCaseId,"PBASE-T_USBDI-0498");
    64 const TFunctorTestCase<CUT_PBASE_T_USBDI_0498,TBool> CUT_PBASE_T_USBDI_0498::iFunctor(KTestCaseId);	
    65 
    66 CUT_PBASE_T_USBDI_0498* CUT_PBASE_T_USBDI_0498::NewL(TBool aHostRole)
    67 	{
    68 	CUT_PBASE_T_USBDI_0498* self = new (ELeave) CUT_PBASE_T_USBDI_0498(aHostRole);
    69 	CleanupStack::PushL(self);
    70 	self->ConstructL();
    71 	CleanupStack::Pop(self);
    72 	return self;
    73 	}
    74 	
    75 
    76 CUT_PBASE_T_USBDI_0498::CUT_PBASE_T_USBDI_0498(TBool aHostRole)
    77 :	CBaseBulkTestCase(KTestCaseId,aHostRole),
    78 	iCaseStep(EInProgress),
    79 	iRequestDeviceValidationResultPtr(NULL,0)
    80 	{
    81 	} 
    82 
    83 
    84 void CUT_PBASE_T_USBDI_0498::ConstructL()
    85 	{
    86 	BaseBulkConstructL();
    87 
    88 	iInBuffer = HBufC8::NewL(KTestBufferLength);
    89 	RDebug::Printf("CUT_PBASE_T_USBDI_0491::ConstructL(): buffer created");
    90 	}
    91 
    92 
    93 CUT_PBASE_T_USBDI_0498::~CUT_PBASE_T_USBDI_0498()
    94 /**
    95 The transfer objects have test specific names - so perform transfer specific clean up here.
    96 */
    97 	{
    98 	LOG_FUNC
    99 	
   100 	Cancel();
   101 
   102 	//Do this before deleting the transfer objects
   103 	CloseInterfaceAndPipes();
   104 	
   105 	TUint8 count;
   106 	for(count=0;count<KNumOutTransfersPerInterface;count++)
   107 		{
   108 		delete iIfc1OutTransfer[count];
   109 		iIfc1OutTransfer[count] = NULL;
   110 		delete iIfc2OutTransfer[count];
   111 		iIfc2OutTransfer[count] = NULL;
   112 		}
   113 	for(count=0;count<KNumInTransfersPerInterface;count++)
   114 		{
   115 		delete iIfc1InTransfer[count];
   116 		iIfc1InTransfer[count] = NULL;
   117 		delete iIfc2InTransfer[count];
   118 		iIfc2InTransfer[count] = NULL;
   119 		}
   120 	}
   121 	
   122 	
   123 void CUT_PBASE_T_USBDI_0498::Ep0TransferCompleteL(TInt aCompletionCode)
   124 	{
   125 	LOG_FUNC
   126 	
   127 	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
   128 	
   129 	if(aCompletionCode != KErrNone)
   130 		{
   131 		if(iCaseStep == EFailed)
   132 			{// ignore error, nad catch the TestFailed method called further down.
   133 			RDebug::Printf("***Failure sending FAIL message to client on endpoint 0***");
   134 			}
   135 		else
   136 			{
   137 			TBuf<256> msg;
   138 			msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
   139 			RDebug::Print(msg);
   140 			iCaseStep = EFailed;
   141 			TTestCaseFailed request(aCompletionCode,msg);
   142 			iControlEp0->SendRequest(request,this);
   143 			return;
   144 			}
   145 		}
   146 	
   147 	switch(iCaseStep)
   148 		{
   149 		// Test case passed
   150 		case EPassed:
   151 			TestPassed();
   152 			break;
   153 		
   154 		// Test case failed	
   155 		case EFailed:
   156 			TestFailed(KErrCompletion);
   157 			break;
   158 		
   159 		case ERequestDeviceIFC1Read:
   160 			{
   161 			RDebug::Printf("Asking client for 'Read' on interface 2");
   162 			iCaseStep = ERequestDeviceIFC2Read;	
   163 			TEndpointReadRequest request(2,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number
   164 			iControlEp0->SendRequest(request,this);
   165 			}
   166 			break;
   167 			
   168 		case ERequestDeviceIFC2Read:
   169 			{
   170 			RDebug::Printf("Asking client to 'Write' on interface 1");
   171 			iCaseStep = ERequestDeviceIFC1Write;	
   172 			TEndpointPatternWriteRequest request(1,1,KLiteralFrench4(),KDeviceNumWriteBytes);
   173 			iControlEp0->SendRequest(request,this);
   174 			}
   175 			break;
   176 			
   177 		case ERequestDeviceIFC1Write:
   178 			{
   179 			RDebug::Printf("Asking client to 'Write' on interface 2");
   180 			iCaseStep = ERequestDeviceIFC2Write;	
   181 			TEndpointPatternWriteRequest request(2,1,KLiteralEnglish2(),KDeviceNumWriteBytes);
   182 			iControlEp0->SendRequest(request,this);
   183 			}
   184 			break;
   185 			
   186 		case ERequestDeviceIFC2Write:
   187 			{
   188 			RDebug::Printf("Try to perform ALL transfers on BOTH interfaces");
   189 	
   190 			iCaseStep = ETransfer;	
   191 	
   192 			iStartTime[0].HomeTime();
   193 			iStartTime[1].HomeTime();
   194 			iStartTime[2].HomeTime();
   195 			iStartTime[3].HomeTime();
   196 	
   197 			iIfc1OutTransfer[0]->TransferOut(KLiteralFrench4(), KHostNumWriteBytes1, EFalse);
   198 			iIfc1OutTransfer[1]->TransferOut(KLiteralFrench4(), KHostNumWriteBytes1, KHostNumWriteBytes2, EFalse);
   199 			iIfc2OutTransfer[0]->TransferOut(KLiteralEnglish2(), KHostNumWriteBytes1, EFalse);
   200 			iIfc2OutTransfer[1]->TransferOut(KLiteralEnglish2(), KHostNumWriteBytes1, KHostNumWriteBytes2, EFalse);
   201 	
   202 			iIfc1InTransfer[0]->TransferIn(KHostNumReadBytes1);
   203 			iIfc1InTransfer[1]->TransferIn(KHostNumReadBytes2);
   204 			iIfc2InTransfer[0]->TransferIn(KHostNumReadBytes1);
   205 			iIfc2InTransfer[1]->TransferIn(KHostNumReadBytes2);
   206 			}
   207 			break;
   208 			
   209 		case ERequestDeviceValidateIFC1:
   210 			{
   211 			iCaseStep = ERequestDeviceValidationResultIFC1;
   212 			RDebug::Printf("Interface 1: Request Client Validation Result");
   213 			iRequestDeviceValidationResultPtr.Set(iInBuffer->Des());
   214 			iRequestDeviceValidationResultPtr.Zero(); //reset
   215 			iRequestDeviceValidationResultPtr.SetLength(KPassFailStringLength);
   216 			TInterfaceGetPayloadRequest request(1,iRequestDeviceValidationResultPtr);
   217 			iControlEp0->SendRequest(request,this);
   218 			}
   219 			break;
   220 		
   221 		case ERequestDeviceValidationResultIFC1:
   222 			{
   223 			RDebug::Printf("Interface 1: Client Validation Result string ...");
   224 			RDebug::RawPrint(*iInBuffer);
   225 			RDebug::Printf("\n");
   226 			TPtr8 ptr(iInBuffer->Des());
   227 			if(ptr.Compare(KClientPassString) == 0)
   228 				{
   229 				RDebug::Printf("Client Validation Interface 1 Result is a PASS");
   230 				RDebug::Printf("Now performing Client Validation for Interface 2");
   231 				iCaseStep = ERequestDeviceValidateIFC2;
   232 				TEndpointStringValidationRequest request(2,1,KLiteralEnglish2(),KDeviceNumReadBytes);
   233 				iControlEp0->SendRequest(request,this);
   234 				}
   235 			else
   236 				{
   237 				TBuf<256> msg;
   238 				msg.Format(_L("<Error> Bulk data VALIDATION check was NOT successful"));
   239 				RDebug::Print(msg);
   240 				iCaseStep = EFailed;
   241 				TTestCaseFailed request(KErrCorrupt,msg);
   242 				iControlEp0->SendRequest(request,this);
   243 				}
   244 			}
   245 			break;
   246 			
   247 		case ERequestDeviceValidateIFC2:
   248 			{
   249 			iCaseStep = ERequestDeviceValidationResultIFC2;
   250 			RDebug::Printf("Interface 2: Request Client Validation Result");
   251 			iRequestDeviceValidationResultPtr.Set(iInBuffer->Des());
   252 			iRequestDeviceValidationResultPtr.Zero(); //reset
   253 			iRequestDeviceValidationResultPtr.SetLength(KPassFailStringLength);
   254 			TInterfaceGetPayloadRequest request(2,iRequestDeviceValidationResultPtr);
   255 			iControlEp0->SendRequest(request,this);
   256 			}
   257 			break;
   258 		
   259 		case ERequestDeviceValidationResultIFC2:
   260 			{
   261 			RDebug::Printf("Interface 1: Client Validation Result string ...");
   262 			RDebug::RawPrint(*iInBuffer);
   263 			RDebug::Printf("\n");
   264 			TPtr8 ptr(iInBuffer->Des());
   265 			if(ptr.Compare(KClientPassString) == 0)
   266 				{
   267 				RDebug::Printf("Client Validation Interface 2 Result is a PASS");
   268 				RDebug::Printf("This is the FINAL check - the whole test has a PASSED");
   269 				iCaseStep = EPassed;
   270 				TTestCasePassed request;
   271 				iControlEp0->SendRequest(request,this);
   272 				}
   273 			else
   274 				{
   275 				TBuf<256> msg;
   276 				msg.Format(_L("<Error> Bulk data VALIDATION check was NOT successful"));
   277 				RDebug::Print(msg);
   278 				iCaseStep = EFailed;
   279 				TTestCaseFailed request(KErrCorrupt,msg);
   280 				iControlEp0->SendRequest(request,this);
   281 				}
   282 			}
   283 			break;
   284 	
   285 		default:
   286 			RDebug::Printf("<Error> Unknown test step");
   287 			TestFailed(KErrUnknown);
   288 			break;
   289 		}
   290 	}
   291 	
   292 void CUT_PBASE_T_USBDI_0498::TransferCompleteL(TInt aTransferId,TInt aCompletionCode)
   293 	{
   294 	LOG_FUNC
   295 	Cancel();
   296 	
   297 	TInt err(KErrNone);
   298 	TBuf<256> msg;
   299 	RDebug::Printf("Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep);
   300 
   301 
   302 	switch(iCaseStep)
   303 		{
   304 		case ETransfer:
   305 			if(aCompletionCode != KErrNone)
   306 				{
   307 				iIfc1OutTransfer[0]->Cancel();
   308 				iIfc1OutTransfer[1]->Cancel();
   309 				iIfc2OutTransfer[0]->Cancel();
   310 				iIfc2OutTransfer[1]->Cancel();
   311 				iIfc1InTransfer[0]->Cancel();
   312 				iIfc1InTransfer[1]->Cancel();
   313 				iIfc2InTransfer[0]->Cancel();
   314 				iIfc2InTransfer[1]->Cancel();
   315 				err = KErrCorrupt;
   316 				msg.Format(_L("<Error %d> The transfer completed with an error."), aCompletionCode);
   317 				break; //switch(iCaseStep)
   318 				}
   319 	
   320 			switch(aTransferId)
   321 				{
   322 				case KIfc1BulkTransferOutId1:
   323 				case KIfc1BulkTransferOutId2:
   324 				case KIfc2BulkTransferOutId1:
   325 				case KIfc2BulkTransferOutId2:
   326 					iTransferComplete |= aTransferId;
   327 					RDebug::Printf("Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete);
   328 					break; //switch(aTransferId)
   329 
   330 				case KIfc1BulkTransferInId1:
   331 				case KIfc1BulkTransferInId2:
   332 				case KIfc2BulkTransferInId1:
   333 				case KIfc2BulkTransferInId2:
   334 					iTransferComplete |= aTransferId;
   335 					RDebug::Printf("Transfer OUT %d completed (Transfer Completion Aggregation Mask 0x%x)", aTransferId, iTransferComplete);
   336 					break; //switch(aTransferId)
   337 
   338 				default:
   339 					iTransferComplete = 0; //reset
   340 					err = KUnexpectedTransferID;
   341 					msg.Format(_L("<Error %d> Unexpected transfer ID, GOT %d, (wanted one of:- %d, %d, %d, %d, %d, %d, %d, or%d)"),
   342 							       err, aTransferId,
   343 							       KIfc1BulkTransferInId1, 
   344 							       KIfc1BulkTransferInId2, 
   345 							       KIfc2BulkTransferInId1, 
   346 							       KIfc2BulkTransferInId2, 
   347 							       KIfc1BulkTransferOutId1, 
   348 							       KIfc1BulkTransferOutId2, 
   349 							       KIfc2BulkTransferOutId1, 
   350 							       KIfc2BulkTransferOutId2
   351 							       );
   352 					break; //switch(aTransferId)
   353 				}
   354 			
   355 			// Transfer Out Response
   356 			if(err==KErrNone && iTimeElapsed[0] == 0 && (iTransferComplete & KIfc1BulkTransferOutIdMask) == KIfc1BulkTransferOutIdMask) 
   357 				//Record time elapsed for Interface 1 if not yet recorded.
   358 				{
   359 				RecordTime(0);
   360 				}
   361 			if(err==KErrNone && iTimeElapsed[1] == 0 && (iTransferComplete & KIfc2BulkTransferOutIdMask) == KIfc2BulkTransferOutIdMask)
   362 				//Record time elapsed for Interface 2 if not yet recorded.
   363 				{
   364 				RecordTime(1);
   365 				}
   366 			if(err==KErrNone && (iTransferComplete & KBulkTransferOutIdMask) == KBulkTransferOutIdMask)
   367 				{
   368 				RDebug::Printf("All OUT Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete);
   369 				//Leave validation to the point at which all transfers have completed.
   370 				}
   371 	
   372 			// Transfer In Response
   373 			if(err==KErrNone && iTimeElapsed[2] == 0 && (iTransferComplete & KIfc1BulkTransferInIdMask) == KIfc1BulkTransferInIdMask)
   374 				//Record time elapsed for Interface 1 if not yet recorded.
   375 				{
   376 				RecordTime(2);
   377 				}
   378 			if(err==KErrNone && iTimeElapsed[3] == 0 && (iTransferComplete & KIfc2BulkTransferInIdMask) == KIfc2BulkTransferInIdMask) 
   379 				//Record time elapsed for Interface 2 if not yet recorded.
   380 				{
   381 				RecordTime(3);
   382 				}
   383 			if(err==KErrNone && (iTransferComplete & KBulkTransferInIdMask) == KBulkTransferInIdMask)
   384 				{
   385 				// ok, compare data rcvd now
   386 				RDebug::Printf("All IN Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete);
   387 	
   388 				TPtrC8 data1(iIfc1InTransfer[0]->DataPolled());	
   389 				TPtrC8 data2(iIfc1InTransfer[1]->DataPolled());		
   390 				TPtrC8 data3(iIfc2InTransfer[0]->DataPolled());		
   391 				TPtrC8 data4(iIfc2InTransfer[1]->DataPolled());		
   392 				//Validate first transfer on Interface 1 for number of bytes originally written.
   393 				if(ValidateData(data1, KLiteralFrench4(), KHostNumWriteBytes1) == EFalse)
   394 					{
   395 					RDebug::Printf("Validation failure 1st transfer, Interface 1");
   396 					err = KErrCompletion; //indicates data validation failure
   397 					break; //switch(iCaseStep)
   398 					}
   399 
   400 				//Validate second transfer on Interface 1 for number of bytes originally written.
   401 				if(ValidateData(data2, KLiteralFrench4(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse)
   402 					{
   403 					RDebug::Printf("Validation failure 2nd transfer, Interface 1");
   404 					err = KErrCompletion; //indicates data validation failure
   405 					break; //switch(iCaseStep)
   406 					}
   407 				
   408 				//Validate first transfer on Interface 2 for number of bytes originally written.
   409 				if(ValidateData(data3, KLiteralEnglish2(), KHostNumWriteBytes1) == EFalse)
   410 					{
   411 					RDebug::Printf("Validation failure 1st transfer, Interface 2");
   412 					err = KErrCompletion; //indicates data validation failure
   413 					break; //switch(iCaseStep)
   414 					}
   415 				
   416 				//Validate second transfer on Interface 2 for number of bytes originally written.
   417 				if(ValidateData(data4, KLiteralEnglish2(), KHostNumWriteBytes1, KHostNumWriteBytes2) == EFalse)
   418 					{
   419 					RDebug::Printf("Validation failure 2nd transfer, Interface 2");
   420 					err = KErrCompletion; //indicates data validation failure
   421 					break; //switch(iCaseStep)
   422 					}
   423 				
   424 				// Comparison is a match
   425 				RDebug::Printf("Comparison for IN transfer is a match");
   426 				}
   427 			break; //switch(iCaseStep)
   428 
   429 		default:
   430 			err = KUndefinedStep;
   431 			msg.Format(_L("<Error %d> Undefined case step %d reached"),KUndefinedStep, iCaseStep);
   432 			break; //switch(iCaseStep)
   433 		}
   434 
   435 	if(err == KErrNone && iTransferComplete == KBulkTransferIdMask)
   436 	/*
   437 	Transfers all complete - now ask device to validate first interface's transfer OUT
   438 	*/
   439 		{
   440 		RDebug::Printf("Checking all times against each other");
   441 		err = CheckTimes(0, 1, KMaxTimeDiffPercentage);
   442 		err = err?err:CheckTimes(0, 2, KMaxTimeDiffPercentage);
   443 		err = err?err:CheckTimes(0, 3, KMaxTimeDiffPercentage);
   444 		err = err?err:CheckTimes(1, 2, KMaxTimeDiffPercentage);
   445 		err = err?err:CheckTimes(1, 3, KMaxTimeDiffPercentage);
   446 		err = err?err:CheckTimes(2, 3, KMaxTimeDiffPercentage);
   447 		ResetTimes(0);
   448 		ResetTimes(1);
   449 		ResetTimes(2);
   450 		ResetTimes(3);
   451 		
   452 		if(err==KErrNone)
   453 			{
   454 			RDebug::Printf("Asking client for 'Validate' data written on interface 1");
   455 			iCaseStep = ERequestDeviceValidateIFC1;
   456 			TEndpointStringValidationRequest request(1,1,KLiteralFrench4(),KDeviceNumReadBytes);
   457 			iControlEp0->SendRequest(request,this);
   458 			}
   459 		}
   460 
   461 	if(err == KErrCompletion)
   462 		//indicates data validation failure
   463 		{
   464 		msg.Format(_L("<Error %d> Bulk transfer IN data received does not match Bulk Transfer OUT data"), err);
   465 		}
   466 
   467 	if(err == KErrTooBig)
   468 		//indicates timing validation failure
   469 		{
   470 		msg.Format(_L("<Error %d> Timer comparison showed too great a difference in transfer times between the two interfaces"), err);
   471 		}
   472 	
   473 	if(err!=KErrNone)
   474 		{	
   475 		RDebug::Print(msg);
   476 		iCaseStep = EFailed;
   477 		TTestCaseFailed request(err,msg);
   478 		return iControlEp0->SendRequest(request,this);
   479 		}	
   480 	}
   481 	
   482 void CUT_PBASE_T_USBDI_0498::DeviceInsertedL(TUint aDeviceHandle)
   483 	{
   484 	LOG_FUNC
   485 	
   486 	Cancel();
   487 	RDebug::Printf("this - %08x", this);
   488 	
   489 	TBuf<256> msg;
   490 	TInt err = KErrNone;
   491 	if(BaseBulkDeviceInsertedL(aDeviceHandle, EFalse) == EDeviceConfigurationError)
   492 		// Prepare for response from control transfer to client
   493 		{
   494 		err = KErrGeneral;
   495 		msg.Format(_L("Base class DeviceInsertedL failed"));
   496 		}
   497 	else
   498 		{
   499 		if(SetUpInterfaceAndPipesL(aDeviceHandle, 2) == EDeviceConfigurationError)
   500 			// Prepare for response from control transfer to client
   501 			{
   502 			err = KErrGeneral;
   503 			msg.Format(_L("Base class SetUpInterfaceAndPipes for Interface 2 failed"));
   504 			}
   505 		else
   506 			{
   507 	
   508 			iIfc1InTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkMaxTransferSize,*this,KIfc1BulkTransferInId1);
   509 			iIfc1InTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkMaxTransferSize,*this,KIfc1BulkTransferInId2);
   510 			iIfc1OutTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkOut,iUsbInterface1,KBulkMaxTransferSize,*this,KIfc1BulkTransferOutId1);
   511 			iIfc1OutTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkOut,iUsbInterface1,KBulkMaxTransferSize,*this,KIfc1BulkTransferOutId2);
   512 
   513 			iIfc2InTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkIn,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferInId1);
   514 			iIfc2InTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkIn,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferInId2);
   515 			iIfc2OutTransfer[0] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId1);
   516 			iIfc2OutTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface2BulkOut1,iUsbInterface2,KBulkMaxTransferSize,*this,KIfc2BulkTransferOutId2);
   517 			
   518 			// Initialise the descriptors for transfer		
   519 			RDebug::Printf("Initialising the transfer descriptors - interface 1");
   520 			err = iUsbInterface1.InitialiseTransferDescriptors();
   521 			if(err != KErrNone)
   522 				{
   523 				msg.Format(_L("<Error %d> Unable to initialise transfer descriptors (Interface 1)"),err);
   524 				}
   525 			else
   526 				{
   527 				// Initialise the descriptors for transfer		
   528 				RDebug::Printf("Initialising the transfer descriptors (Interface 2)");
   529 				err = iUsbInterface2.InitialiseTransferDescriptors();
   530 				if(err != KErrNone)
   531 					{
   532 					msg.Format(_L("<Error %d> Unable to initialise transfer descriptors"),err);
   533 					}
   534 				}
   535 			}
   536 		}
   537 	if(err != KErrNone)
   538 		{
   539 		RDebug::Print(msg);
   540 		iCaseStep = EFailed;
   541 		TTestCaseFailed request(err,msg);
   542 		iControlEp0->SendRequest(request,this);
   543 		}
   544 	else
   545 		{
   546 		RDebug::Printf("Asking client for 'Read' on interface 1");
   547 		iCaseStep = ERequestDeviceIFC1Read;	
   548 		TEndpointReadRequest request(1,1,KDeviceNumReadBytes);// EP1 means endpoint index 1 not the actual endpoint number
   549 		iControlEp0->SendRequest(request,this);
   550 		}
   551 	}
   552 	
   553 	} //end namespace