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