kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0473.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0473.cpp	Tue Aug 24 14:42:58 2010 +0100
+++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0473.cpp	Tue Aug 24 14:49:21 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -21,6 +21,10 @@
 #include "testdebug.h"
 #include "modelleddevices.h"
 #include "TestPolicy.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "PBASE-T_USBDI-0473Traces.h"
+#endif
 
 namespace NUnitTesting_USBDI
 	{
@@ -30,10 +34,12 @@
 
 CUT_PBASE_T_USBDI_0473* CUT_PBASE_T_USBDI_0473::NewL(TBool aHostRole)
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_NEWL_ENTRY, aHostRole );
 	CUT_PBASE_T_USBDI_0473* self = new (ELeave) CUT_PBASE_T_USBDI_0473(aHostRole);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_NEWL_EXIT, ( TUint )( self ) );
 	return self; 
 	}
 	   
@@ -44,19 +50,23 @@
 	iSuspendedI1(EFalse),
 	iDeviceNotificationPending(ETrue)
 	{
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_ENTRY, this );
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_EXIT, this );
 	} 
 
 
 void CUT_PBASE_T_USBDI_0473::ConstructL()
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CONSTRUCTL_ENTRY, this );
 	iTestDevice = new RUsbDeviceA(this);
 	BaseConstructL();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_CONSTRUCTL_EXIT, this );
 	}
 
 
 CUT_PBASE_T_USBDI_0473::~CUT_PBASE_T_USBDI_0473()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_ENTRY_DUP01, this );
 	
 	// Cancel any async operations
 	
@@ -78,12 +88,13 @@
 		iTestDevice->Close();
 		}		
 	delete iTestDevice;
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_CUT_PBASE_T_USBDI_0473_EXIT_DUP01, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_0473::ExecuteHostTestCaseL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_EXECUTEHOSTTESTCASEL_ENTRY, this );
 	iCaseStep = EStepSuspend;
 	iActorFDF = CActorFDF::NewL(*this);
 	iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
@@ -95,11 +106,12 @@
 
 	// Start the connection timeout	
 	TimeoutIn(30);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_EXECUTEHOSTTESTCASEL_EXIT, this );
 	}
 
 void CUT_PBASE_T_USBDI_0473::ExecuteDeviceTestCaseL()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_EXECUTEDEVICETESTCASEL_ENTRY, this );
 
 	// Construct the device for the test case
 	iTestDevice->OpenL(TestCaseId());
@@ -108,29 +120,32 @@
 
 	// Connect the test device	
 	iTestDevice->SoftwareConnect();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_EXECUTEDEVICETESTCASEL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0473::HostDoCancel()
 	{
-	LOG_FUNC
+    OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_HOSTDOCANCEL_ENTRY, this );
 
 	// Cancel the timeout timer
 	CancelTimeout();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_HOSTDOCANCEL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_0473::DeviceDoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_DEVICEDOCANCEL_ENTRY, this );
 	
 	// Cancel the device	
 	iTestDevice->CancelSubscriptionToReports();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEDOCANCEL_EXIT, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0473::DeviceInsertedL(TUint aDeviceHandle)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_ENTRY, this );
 
 	Cancel(); // Cancel the timer
 	TInt err(KErrNone);
@@ -143,11 +158,12 @@
 		{
 		// Incorrect device for this test case
 
-		RDebug::Printf("<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
-			KErrNotFound,&testDevice.SerialNumber(),&TestCaseId());
+		OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
+			KErrNotFound,testDevice.SerialNumber(),TestCaseId());
 
 		// Start the connection timeout again
 		TimeoutIn(30);
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_EXIT, this );
 		return;
 		}	
 	// Check tree now	
@@ -161,61 +177,61 @@
 			TUint32 token1(0);
 			TUint32 token2(0);
 	
-			RDebug::Printf("Obtaining token for interface 0");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP01, "Obtaining token for interface 0");
 			err = testDevice.Device().GetTokenForInterface(0,token1);
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Token for interface 0 could not be retrieved",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP02, "<Error %d> Token for interface 0 could not be retrieved",err);
 				return TestFailed(err);
 				}
-			RDebug::Printf("Token 1 (%d) retrieved",token1);
-			RDebug::Printf("Opening interface 0");
+			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP03, "Token 1 (%d) retrieved",token1);
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP04, "Opening interface 0");
 			err = iUsbInterface0.Open(token1); // Alternate interface setting 0
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Interface 0 could not be opened",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP05, "<Error %d> Interface 0 could not be opened",err);
 				return TestFailed(err);
 				}
-			RDebug::Printf("Interface 0 opened");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP06, "Interface 0 opened");
 		
 																
-			RDebug::Printf("Obtaining token for interface 1");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP07, "Obtaining token for interface 1");
 			err = testDevice.Device().GetTokenForInterface(1,token2);
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Token for interface 1 could not be retrieved",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP08, "<Error %d> Token for interface 1 could not be retrieved",err);
 				return TestFailed(err);			
 				}	
-			RDebug::Printf("Opening interface 1");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP09, "Opening interface 1");
 			err = iUsbInterface1.Open(token2); // Alternate interface setting 0
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Interface 1 could not be opened",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP10, "<Error %d> Interface 1 could not be opened",err);
 				return TestFailed(err);
 				}
-			RDebug::Printf("Interface 1 opened");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP11, "Interface 1 opened");
 	
 			// close it
 			iUsbInterface1.Close();		
-			RDebug::Printf("Interface 1 closed");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP12, "Interface 1 closed");
 	
 			//re-open now
 			err = iUsbInterface1.Open(token2); // Alternate interface setting 0
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Interface 1 could not be re-opened",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP13, "<Error %d> Interface 1 could not be re-opened",err);
 				return TestFailed(err);
 				}
-			RDebug::Printf("Interface 1 re-opened");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP14, "Interface 1 re-opened");
 			
 			
 			// Suspend interface 0
-			RDebug::Printf("Suspending interface 0");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP15, "Suspending interface 0");
 			iInterface0Watcher->SuspendAndWatch();
 			iSuspendedI0 = ETrue;
 			
 			// Suspend interface 1
-			RDebug::Printf("Suspending interface 1");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_DUP16, "Suspending interface 1");
 			iInterface1Watcher->SuspendAndWatch();
 			iSuspendedI1 = ETrue;
 			
@@ -228,15 +244,16 @@
 			TestFailed(KErrCorrupt);
 			break;
 		}	
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEINSERTEDL_EXIT_DUP01, this );
 	}
 
 
 TInt CUT_PBASE_T_USBDI_0473::Interface0ResumedL(TAny* aPtr)
 	{
-	LOG_CFUNC
-	RDebug::Printf("Interface 0 resumed");
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_INTERFACE0RESUMEDL_ENTRY, 0 );
+	OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE0RESUMEDL, "Interface 0 resumed");
 	CUT_PBASE_T_USBDI_0473* self = reinterpret_cast<CUT_PBASE_T_USBDI_0473*>(aPtr);
-	RDebug::Printf("watcher 0 iStatus=%d",self->iInterface0Watcher->CompletionCode());
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE0RESUMEDL_DUP01, "watcher 0 iStatus=%d",self->iInterface0Watcher->CompletionCode());
 	self->iSuspendedI0 = EFalse;
 	return self->CheckForAllResumedNotificationsAndContinueFSM();
 	}
@@ -244,10 +261,10 @@
 	
 TInt CUT_PBASE_T_USBDI_0473::Interface1ResumedL(TAny* aPtr)
 	{
-	LOG_CFUNC
-	RDebug::Printf("Interface 1 resumed");
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_INTERFACE1RESUMEDL_ENTRY, 0 );
+	OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE1RESUMEDL, "Interface 1 resumed");
 	CUT_PBASE_T_USBDI_0473* self = reinterpret_cast<CUT_PBASE_T_USBDI_0473*>(aPtr);
-	RDebug::Printf("watcher 1 iStatus=%d",self->iInterface1Watcher->CompletionCode());
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_INTERFACE1RESUMEDL_DUP01, "watcher 1 iStatus=%d",self->iInterface1Watcher->CompletionCode());
 	self->iSuspendedI1 = EFalse;
 	return self->CheckForAllResumedNotificationsAndContinueFSM();
 	}
@@ -255,39 +272,41 @@
 	
 void CUT_PBASE_T_USBDI_0473::DeviceRemovedL(TUint aDeviceHandle)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_DEVICEREMOVEDL_ENTRY, this );
 
 	// The test device should not be removed until the test case has passed
 	// so this test case has not completed, and state this event as an error
 
 	TestFailed(KErrDisconnected);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICEREMOVEDL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0473::BusErrorL(TInt aError)
 	{
-	LOG_FUNC
+    OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_BUSERRORL_ENTRY, this );
 
 	// This test case handles no failiures on the bus
 
 	TestFailed(aError);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_BUSERRORL_EXIT, this );
 	}
 
 TInt CUT_PBASE_T_USBDI_0473::CheckForAllResumedNotificationsAndContinueFSM()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM_ENTRY, this );
 	TBool readyToContinueFSM= ETrue;
 	if( iInterface0Watcher->IsActive()
 	||  iInterface0Watcher->iStatus == KRequestPending)
 		{
-		RDebug::Printf("Interface 0 watcher still pending");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM, "Interface 0 watcher still pending");
 		readyToContinueFSM= EFalse;
 		}
 
 	if( iInterface1Watcher->IsActive()
 	||  iInterface1Watcher->iStatus == KRequestPending)
 		{
-		RDebug::Printf("Interface 1 watcher still pending");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM_DUP01, "Interface 1 watcher still pending");
 		readyToContinueFSM= EFalse;
 		}
 
@@ -302,25 +321,28 @@
 		}
 	else
 		{
+		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CHECKFORALLRESUMEDNOTIFICATIONSANDCONTINUEFSM_EXIT, this, KErrNone );
 		return KErrNone;
 		}
 	}
 
 TInt CUT_PBASE_T_USBDI_0473::ContinueFSMAfterAllResumedNotifications()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_ENTRY, this );
 	iDeviceNotificationPending= ETrue;
 	if(iSuspendedI0)
 		{
-		RDebug::Printf("<Error %d> Interface 0 still suspended",KErrCompletion);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS, "<Error %d> Interface 0 still suspended",KErrCompletion);
 		TestFailed(KErrCompletion);
+		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT, this, KErrCompletion );
 		return KErrCompletion;
 		}
 
 	if(iSuspendedI1)
 		{
-		RDebug::Printf("<Error %d> Interface 1 still suspended",KErrCompletion);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP01, "<Error %d> Interface 1 still suspended",KErrCompletion);
 		TestFailed(KErrCompletion);
+		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP01, this, KErrCompletion );
 		return KErrCompletion;
 		}
 
@@ -333,14 +355,14 @@
 			
 			if(err != KErrNone)
 				{
-				RDebug::Printf("<Error %d> Unable to permit remote device wakeup",err);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP02, "<Error %d> Unable to permit remote device wakeup",err);
 				iCaseStep = EFailed;
 				TTestCaseFailed request(err,_L8("Unable to permit remote device wakeup"));
 				iControlEp0->SendRequest(request,this);
 				}
 			else
 				{
-				RDebug::Printf("Device is resumed, send request to client: Remote wake up in 6 secs");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP03, "Device is resumed, send request to client: Remote wake up in 6 secs");
 				
 				TRemoteWakeupRequest request(6);
 				iControlEp0->SendRequest(request,this);			
@@ -355,11 +377,11 @@
 				{
 				// Now suspend the device again after resumption from remote wakeup
 			
-				RDebug::Printf("Suspending interface 0");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP04, "Suspending interface 0");
 				iInterface0Watcher->SuspendAndWatch();
 				iSuspendedI0 = ETrue;
 				
-				RDebug::Printf("Suspending interface 1");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP05, "Suspending interface 1");
 				iInterface1Watcher->SuspendAndWatch();
 				iSuspendedI1 = ETrue;
 				
@@ -367,28 +389,31 @@
 				}
 			else
 				{
-				RDebug::Printf("<Error %d> Device is still suspended",KErrCompletion);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP06, "<Error %d> Device is still suspended",KErrCompletion);
 				TestFailed(KErrCompletion);
+				OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP02, this, KErrCompletion );
 				return KErrCompletion;
 				}
 			}
 			break;
 
 		default:
-			RDebug::Printf("CUT_PBASE_T_USBDI_0473::ContinueFSMAfterAllResumedNotifications: Invalid state %d", iCaseStep);
+			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_DUP07, "CUT_PBASE_T_USBDI_0473::ContinueFSMAfterAllResumedNotifications: Invalid state %d", iCaseStep);
 			TestFailed(KErrCompletion);
+			OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP03, this, KErrCompletion );
 			return KErrCompletion;
 		}
 
+	OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0473_CONTINUEFSMAFTERALLRESUMEDNOTIFICATIONS_EXIT_DUP04, this, KErrNone );
 	return KErrNone;
 	}
 
 void CUT_PBASE_T_USBDI_0473::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_ENTRY, this );
 	Cancel();
 	
-	RDebug::Printf("Device State change from %d to %d err=%d",aPreviousState,aNewState,aCompletionCode);
+	OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL, "Device State change from %d to %d err=%d",aPreviousState,aNewState,aCompletionCode);
 
 	switch(iCaseStep)
 		{
@@ -401,13 +426,13 @@
 				{
 				// Device state is suspended now resume it by resuming one of the interfaces
 				
-				RDebug::Printf("Device is suspended now resume device by resuming one of the interfaces");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP01, "Device is suspended now resume device by resuming one of the interfaces");
 				iUsbInterface0.CancelPermitSuspend();
 				iCaseStep = EValidateResumptionAfterInterfaceSuspension;
 				}
 			else
 				{
-				RDebug::Printf("<Error %d> State was not suspended",KErrCompletion);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP02, "<Error %d> State was not suspended",KErrCompletion);
 				
 				// Since the device is not suspended, send test case failed to the device
 	
@@ -430,7 +455,7 @@
 				}
 			else
 				{
-				RDebug::Printf("<Error %d> Device is still suspended",KErrCompletion);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP03, "<Error %d> Device is still suspended",KErrCompletion);
 				return TestFailed(KErrCompletion);
 				}
 			}
@@ -443,7 +468,7 @@
 				{
 				// Now awaiting a remote wake up state change notification
 				
-				RDebug::Printf("Now awaiting a remote wake up state change notification");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP04, "Now awaiting a remote wake up state change notification");
 				
 				CancelTimeout();
 				iTimer.After(iStatus,10000000); // Give 10 seconds for device to signal remote wake-up
@@ -452,7 +477,7 @@
 				}
 			else
 				{
-				RDebug::Printf("<Error %d> State was not suspended",KErrCompletion);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP05, "<Error %d> State was not suspended",KErrCompletion);
 				
 				// Since the device is not suspended, send test case failed to the device
 	
@@ -466,7 +491,7 @@
 		// This step should never be reached as ep0 complete traps this step, but if it does test fails.
 		case ESuspendForRemoteWakeup:
 			{
-			RDebug::Printf("Resumed before suspended");	    
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP06, "Resumed before suspended");
 		    iCaseStep = EFailed;
 		    TTestCaseFailed request(KErrCompletion,_L8("State was not suspended"));
 		    iControlEp0->SendRequest(request,this);
@@ -492,15 +517,15 @@
 				// Device is now suspended, now activate the device again to send test case
 				// completed request to device
 	
-				RDebug::Printf("Device is now suspended, now activate the device again to send test case completed request to device");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP07, "Device is now suspended, now activate the device again to send test case completed request to device");
 	
 				CUsbTestDevice& testDevice = iActorFDF->DeviceL(iDeviceHandle);
 	
-				RDebug::Printf("Resuming at device level");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP08, "Resuming at device level");
 				TInt err(testDevice.Device().Resume());
 				if(err != KErrNone)
 					{
-					RDebug::Printf("<Error %d> Unable to suspend the device",err);
+					OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP09, "<Error %d> Unable to suspend the device",err);
 					iCaseStep = EFailed;
 					TTestCaseFailed request(err,_L8("Unable to suspend the device"));
 					iControlEp0->SendRequest(request,this);
@@ -510,7 +535,7 @@
 				}
 			else
 				{
-				RDebug::Printf("<Error %d> State was not suspended",KErrCompletion);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP10, "<Error %d> State was not suspended",KErrCompletion);
 				
 				// Since the device is not suspended, send test case failed to the device
 	
@@ -527,13 +552,13 @@
 			{
 			if(aNewState == RUsbDevice::EDeviceActive)
 				{
-				RDebug::Printf("Device is active again, test case passed");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP11, "Device is active again, test case passed");
 				TTestCasePassed request;
 				iControlEp0->SendRequest(request,this);
 				}
 			else
 				{
-				RDebug::Printf("<Error %d> Device is still suspended",KErrCompletion);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_DUP12, "<Error %d> Device is still suspended",KErrCompletion);
 				return TestFailed(KErrCompletion);
 				}
 			}
@@ -542,27 +567,28 @@
 		default:
 			break;
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICESTATECHANGEL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_0473::Ep0TransferCompleteL(TInt aCompletionCode)
 	{
-	LOG_FUNC
-	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_ENTRY, this );
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
 	switch(iCaseStep)
 		{
 		case ESuspendForRemoteWakeup:
 			{
 			// Suspend device again so a remote wakeup can be achieved
-			RDebug::Printf("Suspend device again so a remote wakeup can be achieved");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_DUP01, "Suspend device again so a remote wakeup can be achieved");
 	
 			// Suspend interface 0
-			RDebug::Printf("Suspending interface 0");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_DUP02, "Suspending interface 0");
 			iInterface0Watcher->SuspendAndWatch();
 			iSuspendedI0 = ETrue;
 			
 			// Suspend interface 1
-			RDebug::Printf("Suspending interface 1");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_DUP03, "Suspending interface 1");
 			iInterface1Watcher->SuspendAndWatch();
 			iSuspendedI1 = ETrue;
 			
@@ -584,12 +610,13 @@
 			TestPassed();
 			break;
 			}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_EP0TRANSFERCOMPLETEL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_0473::HostRunL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_HOSTRUNL_ENTRY, this );
 	
 	// Obtain the completion code
 	TInt completionCode(iStatus.Int());
@@ -597,20 +624,21 @@
 	if(completionCode == KErrNone)
 		{
 		// Action timeout
-		RDebug::Printf("<Error> Action timeout");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_HOSTRUNL, "<Error> Action timeout");
 		TestFailed(KErrTimedOut);
 		}
 	else
 		{
-		RDebug::Printf("<Error %d> Timeout timer could not complete",completionCode);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0473_HOSTRUNL_DUP01, "<Error %d> Timeout timer could not complete",completionCode);
 		TestFailed(completionCode);
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_HOSTRUNL_EXIT, this );
 	}
 	
 
 void CUT_PBASE_T_USBDI_0473::DeviceRunL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0473_DEVICERUNL_ENTRY, this );
 	
 	// Disconnect the device
 	
@@ -619,6 +647,7 @@
 	// Complete the test case request
 	
 	TestPolicy().SignalTestComplete(iStatus.Int());
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0473_DEVICERUNL_EXIT, this );
 	}