kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1232.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
252:0a40b8675b23 253:d37db4dcc88d
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19 #include "PBASE-T_USBDI-1232.h"
    19 #include "PBASE-T_USBDI-1232.h"
    20 #include <d32usbc.h>
    20 #include <d32usbc.h>
    21 #include "testdebug.h"
    21 #include "testdebug.h"
    22 #include "modelleddevices.h"
    22 #include "modelleddevices.h"
    23 #include "TestPolicy.h"
    23 #include "TestPolicy.h"
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "PBASE-T_USBDI-1232Traces.h"
       
    27 #endif
    24 
    28 
    25 namespace NUnitTesting_USBDI
    29 namespace NUnitTesting_USBDI
    26 	{
    30 	{
    27 
    31 
    28 	_LIT(KTestCaseId,"PBASE-T_USBDI-1232");
    32 	_LIT(KTestCaseId,"PBASE-T_USBDI-1232");
    44 		{
    48 		{
    45 		}
    49 		}
    46 
    50 
    47 	void CUT_PBASE_T_USBDI_1232::ConstructL()
    51 	void CUT_PBASE_T_USBDI_1232::ConstructL()
    48 		{
    52 		{
    49 		RDebug::Printf("====> Constructor entry priority = %d", RThread().Priority());
    53 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_CUT_PBASE_T_USBDI_1232, "====> Constructor entry priority = %d", RThread().Priority());
    50 
    54 
    51 		// Collect existing thread priority (to reinstate later)
    55 		// Collect existing thread priority (to reinstate later)
    52 		iPriority = RThread().Priority();
    56 		iPriority = RThread().Priority();
    53 
    57 
    54 		iTestDevice = new RUsbDeviceA(this);
    58 		iTestDevice = new RUsbDeviceA(this);
    55 		BaseConstructL();
    59 		BaseConstructL();
    56 		}
    60 		}
    57 
    61 
    58 	CUT_PBASE_T_USBDI_1232::~CUT_PBASE_T_USBDI_1232()
    62 	CUT_PBASE_T_USBDI_1232::~CUT_PBASE_T_USBDI_1232()
    59 		{
    63 		{
    60 		LOG_FUNC
    64 
    61 
    65 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232, "====> Destructor entry priority = %d", RThread().Priority());
    62 		RDebug::Printf("====> Destructor entry priority = %d", RThread().Priority());
       
    63 
    66 
    64 		// Reinstate original priority
    67 		// Reinstate original priority
    65 
    68 
    66 		RThread().SetPriority(iPriority);
    69 		RThread().SetPriority(iPriority);
    67 
    70 
    87 		delete iTestDevice;
    90 		delete iTestDevice;
    88 		}
    91 		}
    89 
    92 
    90 	void CUT_PBASE_T_USBDI_1232::ExecuteHostTestCaseL()
    93 	void CUT_PBASE_T_USBDI_1232::ExecuteHostTestCaseL()
    91 		{
    94 		{
    92 		LOG_FUNC
    95 
    93 
    96 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP01, "====> ExecuteHostTestCaseL entry priority = %d",
    94 		RDebug::Printf("====> ExecuteHostTestCaseL entry priority = %d",
       
    95 				RThread().Priority());
    97 				RThread().Priority());
    96 
    98 
    97 		// Bump thread priority for this test only
    99 		// Bump thread priority for this test only
    98 
   100 
    99 		RThread().SetPriority(EPriorityAbsoluteHigh);
   101 		RThread().SetPriority(EPriorityAbsoluteHigh);
   100 		RDebug::Printf("Thread priority raised %d->%d", iPriority, RThread().Priority());
   102 		OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP02, "Thread priority raised %d->%d", iPriority, RThread().Priority());
   101 
   103 
   102 		iCaseStep = EInProcess;
   104 		iCaseStep = EInProcess;
   103 		iActorFDF = CActorFDF::NewL(*this);
   105 		iActorFDF = CActorFDF::NewL(*this);
   104 		iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
   106 		iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
   105 		iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_1232::Interface0ResumedL,this));
   107 		iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_1232::Interface0ResumedL,this));
   112 		TimeoutIn(30);
   114 		TimeoutIn(30);
   113 		}
   115 		}
   114 
   116 
   115 	void CUT_PBASE_T_USBDI_1232::ExecuteDeviceTestCaseL()
   117 	void CUT_PBASE_T_USBDI_1232::ExecuteDeviceTestCaseL()
   116 		{
   118 		{
   117 		LOG_FUNC
       
   118 
   119 
   119 		// Construct the device for the test case
   120 		// Construct the device for the test case
   120 		iTestDevice->OpenL(TestCaseId());
   121 		iTestDevice->OpenL(TestCaseId());
   121 		iTestDevice->SubscribeToReports(iStatus);
   122 		iTestDevice->SubscribeToReports(iStatus);
   122 		SetActive();
   123 		SetActive();
   125 		iTestDevice->SoftwareConnect();
   126 		iTestDevice->SoftwareConnect();
   126 		}
   127 		}
   127 
   128 
   128 	void CUT_PBASE_T_USBDI_1232::HostDoCancel()
   129 	void CUT_PBASE_T_USBDI_1232::HostDoCancel()
   129 		{
   130 		{
   130 		LOG_FUNC
   131 
   131 
   132 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP03, "====> HostDoCancel entry priority = %d", RThread().Priority());
   132 		RDebug::Printf("====> HostDoCancel entry priority = %d", RThread().Priority());
       
   133 
   133 
   134 		// Cancel the timeout timer
   134 		// Cancel the timeout timer
   135 		CancelTimeout();
   135 		CancelTimeout();
   136 		}
   136 		}
   137 
   137 
   138 	void CUT_PBASE_T_USBDI_1232::DeviceDoCancel()
   138 	void CUT_PBASE_T_USBDI_1232::DeviceDoCancel()
   139 		{
   139 		{
   140 		LOG_FUNC
       
   141 
   140 
   142 		// Cancel the device	
   141 		// Cancel the device	
   143 		iTestDevice->CancelSubscriptionToReports();
   142 		iTestDevice->CancelSubscriptionToReports();
   144 		}
   143 		}
   145 
   144 
   146 	void CUT_PBASE_T_USBDI_1232::DeviceInsertedL(TUint aDeviceHandle)
   145 	void CUT_PBASE_T_USBDI_1232::DeviceInsertedL(TUint aDeviceHandle)
   147 		{
   146 		{
   148 		LOG_FUNC
   147 
   149 
   148 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP04, "====> DeviceInsertedL entry priority = %d", RThread().Priority());
   150 		RDebug::Printf("====> DeviceInsertedL entry priority = %d", RThread().Priority());
       
   151 
   149 
   152 		Cancel(); // Cancel the timer
   150 		Cancel(); // Cancel the timer
   153 		TInt err(KErrNone);
   151 		TInt err(KErrNone);
   154 		iDeviceHandle = aDeviceHandle;
   152 		iDeviceHandle = aDeviceHandle;
   155 		iActorFDF->Monitor();
   153 		iActorFDF->Monitor();
   177 			case EInProcess:
   175 			case EInProcess:
   178 				{
   176 				{
   179 				TUint32 token1(0);
   177 				TUint32 token1(0);
   180 				TUint32 token2(0);
   178 				TUint32 token2(0);
   181 
   179 
   182 				RDebug::Printf("Obtaining token for interface 0");
   180 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP05, "Obtaining token for interface 0");
   183 				err = testDevice.Device().GetTokenForInterface(0, token1);
   181 				err = testDevice.Device().GetTokenForInterface(0, token1);
   184 				if (err != KErrNone)
   182 				if (err != KErrNone)
   185 					{
   183 					{
   186 					RDebug::Printf(
   184 					RDebug::Printf(
   187 							"<Error %d> Token for interface 0 could not be retrieved",
   185 							"<Error %d> Token for interface 0 could not be retrieved",
   188 							err);
   186 							err);
   189 					return TestFailed(err);
   187 					return TestFailed(err);
   190 					}
   188 					}
   191 				RDebug::Printf("Token 1 (%d) retrieved", token1);
   189 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP06, "Token 1 (%d) retrieved", token1);
   192 				RDebug::Printf("Opening interface 0");
   190 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP07, "Opening interface 0");
   193 				err = iUsbInterface0.Open(token1); // Alternate interface setting 0
   191 				err = iUsbInterface0.Open(token1); // Alternate interface setting 0
   194 				if (err != KErrNone)
   192 				if (err != KErrNone)
   195 					{
   193 					{
   196 					RDebug::Printf(
   194 					RDebug::Printf(
   197 							"<Error %d> Interface 0 could not be opened", err);
   195 							"<Error %d> Interface 0 could not be opened", err);
   198 					return TestFailed(err);
   196 					return TestFailed(err);
   199 					}
   197 					}
   200 				RDebug::Printf("Interface 0 opened");
   198 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP08, "Interface 0 opened");
   201 
   199 
   202 				RDebug::Printf("Obtaining token for interface 1");
   200 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP09, "Obtaining token for interface 1");
   203 				err = testDevice.Device().GetTokenForInterface(1, token2);
   201 				err = testDevice.Device().GetTokenForInterface(1, token2);
   204 				if (err != KErrNone)
   202 				if (err != KErrNone)
   205 					{
   203 					{
   206 					RDebug::Printf(
   204 					RDebug::Printf(
   207 							"<Error %d> Token for interface 1 could not be retrieved",
   205 							"<Error %d> Token for interface 1 could not be retrieved",
   208 							err);
   206 							err);
   209 					return TestFailed(err);
   207 					return TestFailed(err);
   210 					}
   208 					}
   211 				RDebug::Printf("Opening interface 1");
   209 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP10, "Opening interface 1");
   212 				err = iUsbInterface1.Open(token2); // Alternate interface setting 0
   210 				err = iUsbInterface1.Open(token2); // Alternate interface setting 0
   213 				if (err != KErrNone)
   211 				if (err != KErrNone)
   214 					{
   212 					{
   215 					RDebug::Printf(
   213 					RDebug::Printf(
   216 							"<Error %d> Interface 1 could not be opened", err);
   214 							"<Error %d> Interface 1 could not be opened", err);
   217 					return TestFailed(err);
   215 					return TestFailed(err);
   218 					}
   216 					}
   219 				RDebug::Printf("Interface 1 opened");
   217 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP11, "Interface 1 opened");
   220 
   218 
   221 				// device go to suspend
   219 				// device go to suspend
   222 				// Suspend interface 0
   220 				// Suspend interface 0
   223 				RDebug::Printf("Suspending interface 0");
   221 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP12, "Suspending interface 0");
   224 				iInterface0Watcher->SuspendAndWatch();
   222 				iInterface0Watcher->SuspendAndWatch();
   225 
   223 
   226 				// Suspend interface 1
   224 				// Suspend interface 1
   227 				RDebug::Printf("Suspending interface 1");
   225 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP13, "Suspending interface 1");
   228 				iInterface1Watcher->SuspendAndWatch();
   226 				iInterface1Watcher->SuspendAndWatch();
   229 
   227 
   230 				iCaseStep = ESuspendWhenResuming;
   228 				iCaseStep = ESuspendWhenResuming;
   231 
   229 
   232 				TimeoutIn(10); // Give 10 seconds for device to suspend						
   230 				TimeoutIn(10); // Give 10 seconds for device to suspend						
   243 			}
   241 			}
   244 		}
   242 		}
   245 
   243 
   246 	TInt CUT_PBASE_T_USBDI_1232::Interface0ResumedL(TAny* aPtr)
   244 	TInt CUT_PBASE_T_USBDI_1232::Interface0ResumedL(TAny* aPtr)
   247 		{
   245 		{
   248 		LOG_CFUNC
   246 
   249 
   247 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP14, "====> Interface0ResumedL entry priority = %d", RThread().Priority());
   250 		RDebug::Printf("====> Interface0ResumedL entry priority = %d", RThread().Priority());
   248 
   251 
   249 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP15, " -Interface 0 resumed");
   252 		RDebug::Printf(" -Interface 0 resumed");
       
   253 		CUT_PBASE_T_USBDI_1232* self =
   250 		CUT_PBASE_T_USBDI_1232* self =
   254 				reinterpret_cast<CUT_PBASE_T_USBDI_1232*>(aPtr);
   251 				reinterpret_cast<CUT_PBASE_T_USBDI_1232*>(aPtr);
   255 		TInt completionCode = self->iInterface0Watcher->CompletionCode();
   252 		TInt completionCode = self->iInterface0Watcher->CompletionCode();
   256 		RDebug::Printf(" -watcher 0 iStatus=%d",completionCode);
   253 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP16, " -watcher 0 iStatus=%d",completionCode);
   257 
   254 
   258 		switch (self->iCaseStep)
   255 		switch (self->iCaseStep)
   259 			{	
   256 			{	
   260                 
   257                 
   261 			case EPassed:
   258 			case EPassed:
   262 				{
   259 				{
   263 				if (completionCode == KErrNone)
   260 				if (completionCode == KErrNone)
   264 					{
   261 					{
   265 					RDebug::Printf("Device resume successed,test passed!");
   262 					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP17, "Device resume successed,test passed!");
   266 					self->SendEp0Request(); // stop client site
   263 					self->SendEp0Request(); // stop client site
   267 					}
   264 					}
   268 				else
   265 				else
   269 					{
   266 					{
   270 					RDebug::Printf("Device resume failed, err = %d ",completionCode);
   267 					OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP18, "Device resume failed, err = %d ",completionCode);
   271 					self->iCaseStep = EFailed;
   268 					self->iCaseStep = EFailed;
   272 					self->SendEp0Request();
   269 					self->SendEp0Request();
   273 					}
   270 					}
   274 				}
   271 				}
   275 				break;
   272 				break;
   284 		return KErrNone;
   281 		return KErrNone;
   285 		}
   282 		}
   286 
   283 
   287 	TInt CUT_PBASE_T_USBDI_1232::Interface1ResumedL(TAny* aPtr)
   284 	TInt CUT_PBASE_T_USBDI_1232::Interface1ResumedL(TAny* aPtr)
   288 		{
   285 		{
   289 		LOG_CFUNC
   286 
   290 
   287 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP19, "====> Interface1ResumedL entry priority = %d", RThread().Priority());
   291 		RDebug::Printf("====> Interface1ResumedL entry priority = %d", RThread().Priority());
   288 
   292 
   289 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP20, "Interface 1 resumed");
   293 		RDebug::Printf("Interface 1 resumed");
       
   294 		CUT_PBASE_T_USBDI_1232* self =
   290 		CUT_PBASE_T_USBDI_1232* self =
   295 				reinterpret_cast<CUT_PBASE_T_USBDI_1232*>(aPtr);
   291 				reinterpret_cast<CUT_PBASE_T_USBDI_1232*>(aPtr);
   296 		RDebug::Printf("watcher 1 iStatus=%d", self->iInterface1Watcher->CompletionCode());
   292 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP21, "watcher 1 iStatus=%d", self->iInterface1Watcher->CompletionCode());
   297 		return KErrNone;
   293 		return KErrNone;
   298 		}
   294 		}
   299 
   295 
   300 	void CUT_PBASE_T_USBDI_1232::DeviceRemovedL(TUint aDeviceHandle)
   296 	void CUT_PBASE_T_USBDI_1232::DeviceRemovedL(TUint aDeviceHandle)
   301 		{
   297 		{
   302 		LOG_FUNC
       
   303 
   298 
   304 		// The test device should not be removed until the test case has passed
   299 		// The test device should not be removed until the test case has passed
   305 		// so this test case has not completed, and state this event as an error
   300 		// so this test case has not completed, and state this event as an error
   306 
   301 
   307 		TestFailed(KErrDisconnected);
   302 		TestFailed(KErrDisconnected);
   308 		}
   303 		}
   309 
   304 
   310 	void CUT_PBASE_T_USBDI_1232::BusErrorL(TInt aError)
   305 	void CUT_PBASE_T_USBDI_1232::BusErrorL(TInt aError)
   311 		{
   306 		{
   312 		LOG_FUNC
       
   313 
   307 
   314 		// This test case handles no failiures on the bus
   308 		// This test case handles no failiures on the bus
   315 
   309 
   316 		TestFailed(aError);
   310 		TestFailed(aError);
   317 		}
   311 		}
   318 
   312 
   319 	void CUT_PBASE_T_USBDI_1232::DeviceStateChangeL(
   313 	void CUT_PBASE_T_USBDI_1232::DeviceStateChangeL(
   320 			RUsbDevice::TDeviceState aPreviousState,
   314 			RUsbDevice::TDeviceState aPreviousState,
   321 			RUsbDevice::TDeviceState aNewState, TInt aCompletionCode)
   315 			RUsbDevice::TDeviceState aNewState, TInt aCompletionCode)
   322 		{
   316 		{
   323 		LOG_FUNC
       
   324 		Cancel();
   317 		Cancel();
   325 
   318 
   326 		// test RInterface , the  RUsbDevice notification logic not used . 
   319 		// test RInterface , the  RUsbDevice notification logic not used . 
   327 		RDebug::Printf(" -Device State change from err=%d",aCompletionCode);
   320 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP22, " -Device State change from err=%d",aCompletionCode);
   328 
   321 
   329 		switch (iCaseStep)
   322 		switch (iCaseStep)
   330 			{
   323 			{
   331 			case ESuspendWhenResuming:
   324 			case ESuspendWhenResuming:
   332 				if (aNewState == RUsbDevice::EDeviceSuspended)
   325 				if (aNewState == RUsbDevice::EDeviceSuspended)
   333 					{
   326 					{
   334 					RDebug::Printf("====> device has suspended!");
   327 					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP23, "====> device has suspended!");
   335                     
   328                     
   336 					SuspendWhenResuming();					
   329 					SuspendWhenResuming();					
   337 					}
   330 					}
   338 				break;
   331 				break;
   339 			case EValidSuspendWhenResuming:
   332 			case EValidSuspendWhenResuming:
   340 				if (aPreviousState == RUsbDevice::EDeviceSuspended&&aNewState
   333 				if (aPreviousState == RUsbDevice::EDeviceSuspended&&aNewState
   341 						== RUsbDevice::EDeviceSuspended)
   334 						== RUsbDevice::EDeviceSuspended)
   342 					{
   335 					{
   343 					RDebug::Printf("====> device suspended again,suspend while resuming succeed!");
   336 					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP24, "====> device suspended again,suspend while resuming succeed!");
   344 					iCaseStep = EPassed;
   337 					iCaseStep = EPassed;
   345 					iUsbInterface0.CancelPermitSuspend();
   338 					iUsbInterface0.CancelPermitSuspend();
   346 					}
   339 					}
   347 				else
   340 				else
   348 					{
   341 					{
   357 
   350 
   358 		}
   351 		}
   359 
   352 
   360 	void CUT_PBASE_T_USBDI_1232::Ep0TransferCompleteL(TInt aCompletionCode)
   353 	void CUT_PBASE_T_USBDI_1232::Ep0TransferCompleteL(TInt aCompletionCode)
   361 		{
   354 		{
   362 		LOG_FUNC
   355 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP25, "Ep0TransferCompleteL with aCompletionCode = %d",
   363 		RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",
       
   364 				aCompletionCode);
   356 				aCompletionCode);
   365 		switch (iCaseStep)
   357 		switch (iCaseStep)
   366 			{
   358 			{
   367 
   359 
   368 			default:
   360 			default:
   376 			}
   368 			}
   377 		}
   369 		}
   378 
   370 
   379 	void CUT_PBASE_T_USBDI_1232::HostRunL()
   371 	void CUT_PBASE_T_USBDI_1232::HostRunL()
   380 		{
   372 		{
   381 		LOG_FUNC
   373 
   382 
   374 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP26, "====> HostRunL entry priority = %d", RThread().Priority());
   383 		RDebug::Printf("====> HostRunL entry priority = %d", RThread().Priority());
       
   384 
   375 
   385 		// Obtain the completion code
   376 		// Obtain the completion code
   386 		TInt completionCode(iStatus.Int());
   377 		TInt completionCode(iStatus.Int());
   387 
   378 
   388 		if (completionCode == KErrNone)
   379 		if (completionCode == KErrNone)
   389 			{
   380 			{
   390 			// Action timeout
   381 			// Action timeout
   391 			RDebug::Printf("<Error> Action timeout");
   382 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP27, "<Error> Action timeout");
   392 			TestFailed(KErrTimedOut);
   383 			TestFailed(KErrTimedOut);
   393 			}
   384 			}
   394 		else
   385 		else
   395 			{
   386 			{
   396 			RDebug::Printf("<Error %d> Timeout timer could not complete",
   387 			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP28, "<Error %d> Timeout timer could not complete",
   397 					completionCode);
   388 					completionCode);
   398 			TestFailed(completionCode);
   389 			TestFailed(completionCode);
   399 			}
   390 			}
   400 		}
   391 		}
   401 
   392 
   402 	void CUT_PBASE_T_USBDI_1232::DeviceRunL()
   393 	void CUT_PBASE_T_USBDI_1232::DeviceRunL()
   403 		{
   394 		{
   404 		LOG_FUNC
       
   405 
   395 
   406 		// Disconnect the device
   396 		// Disconnect the device
   407 
   397 
   408 		iTestDevice->SoftwareDisconnect();
   398 		iTestDevice->SoftwareDisconnect();
   409 
   399 
   412 		TestPolicy().SignalTestComplete(iStatus.Int());
   402 		TestPolicy().SignalTestComplete(iStatus.Int());
   413 		}
   403 		}
   414 
   404 
   415 	void CUT_PBASE_T_USBDI_1232::SuspendWhenResuming()
   405 	void CUT_PBASE_T_USBDI_1232::SuspendWhenResuming()
   416 		{
   406 		{
   417 		RDebug::Printf("====> SuspendWhenResuming entry priority = %d",
   407 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP29, "====> SuspendWhenResuming entry priority = %d",
   418 				RThread().Priority());
   408 				RThread().Priority());
   419 
   409 
   420 		// Cancel suspend-in-progress
   410 		// Cancel suspend-in-progress
   421 		RDebug::Printf("Cancel Suspend interface 0");
   411 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP30, "Cancel Suspend interface 0");
   422 				
   412 				
   423 		iUsbInterface0.CancelPermitSuspend();
   413 		iUsbInterface0.CancelPermitSuspend();
   424 		
   414 		
   425 		// how to prove, see log? 
   415 		// how to prove, see log? 
   426 		// Suspend interface 0
   416 		// Suspend interface 0
   427 		RDebug::Printf("Suspending interface 0");
   417 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP31, "Suspending interface 0");
   428 		iInterface0Watcher->SuspendAndWatch();			
   418 		iInterface0Watcher->SuspendAndWatch();			
   429 
   419 
   430 		// Suspend interface 1
   420 		// Suspend interface 1
   431 		RDebug::Printf("Suspending interface 1");
   421 		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP32, "Suspending interface 1");
   432 		iInterface1Watcher->SuspendAndWatch();
   422 		iInterface1Watcher->SuspendAndWatch();
   433 
   423 
   434 		iCaseStep = EValidSuspendWhenResuming;
   424 		iCaseStep = EValidSuspendWhenResuming;
   435 
   425 
   436 		TimeoutIn(10); // Give 10 seconds for device to suspend	
   426 		TimeoutIn(10); // Give 10 seconds for device to suspend