usbmgmt/usbmgr/usbman/server/SRC/CUsbDummyClassController.cpp
changeset 29 59aa7d6e3e0f
parent 0 c9bc50fca66e
child 43 012cc2ee6408
child 48 21625e5de155
--- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbDummyClassController.cpp	Wed Jul 07 14:16:40 2010 +0800
+++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbDummyClassController.cpp	Wed Jul 07 15:08:54 2010 +0800
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -20,14 +20,16 @@
  @file
 */
 
-#include "CUsbDummyClassController.h"
 #include <usb_std.h>
-#include "inifile.h"
 #include <usb/usblogger.h>
+#include "CUsbDummyClassController.h"
+#include "inifile.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CUsbDummyClassControllerTraces.h"
+#endif
 
-#ifdef __FLOG_ACTIVE
-_LIT8(KLogComponent, "USBSVR");
-#endif
+
 
 _LIT(KDummyControllerPanic, "UsbDummyCC"); // must be <=16 chars
 // Panic codes
@@ -81,12 +83,13 @@
  * @return Ownership of a new CUsbDummyClassController object
  */
 	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_ENTRY );
 
 	CUsbDummyClassController* self = new(ELeave) CUsbDummyClassController(aOwner, aIndex);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_EXIT );
 	return self;
 	}
 
@@ -103,12 +106,13 @@
  * @return Ownership of a new CUsbDummyClassController object
  */
  	{
-	LOG_STATIC_FUNC_ENTRY
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_TINT_ENTRY );
 
  	CUsbDummyClassController* self = new(ELeave) CUsbDummyClassController(aOwner, aIndex, aPriority);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_NEWL_MUSBCLASSCONTROLLERNOTIFY_TUINT_TINT_EXIT );
 	return self;
  	}
  
@@ -149,7 +153,12 @@
  * Method to perform second phase construction.
  */
 	{
-	LEAVEIFERRORL(iTimer.CreateLocal());
+    TInt err = iTimer.CreateLocal();
+    if(err < 0)
+        {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_CONSTRUCTL, "CUsbDummyClassController::ConstructL; iTimer.CreateLocal() error, Leave error=%d", err );
+        User::Leave(err);
+        }
 	}
 
 CUsbDummyClassController::~CUsbDummyClassController()
@@ -174,18 +183,19 @@
  * @param aBehaviour The behaviour struct to read to.
  */
 	{
-	LOG_FUNC
-#ifdef __FLOG_ACTIVE
-	TBuf8<KMaxName> buf;
-	buf.Copy(aSection);
-	LOGTEXT2(_L8("\taSection = %S"), &buf);
-#endif // __FLOG_ACTIVE
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_ENTRY );
+#ifdef _DEBUG
+	OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR,
+	        "CUsbDummyClassController::GetBehaviour;aSection=%S", aSection );
+#endif//_DEBUG
 
 	TPtrC temp;
 	if ( !aIniFile.FindVar(aSection, KType(), temp) )
 		{
-		LOGTEXT2(_L8("\tPANICKING: can't find Type item in section %S"), &aSection);
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile);
+		OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP1, 
+		        "CUsbDummyClassController::GetBehaviour;PANICKING: can't find Type item in section %S", aSection );
+		OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP2, "CUsbDummyClassController::GetBehaviour; panic code=%d", EDummyPanicBadIniFile );
+		User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile );
 		}
 	if ( temp == KSync )
 		{
@@ -201,21 +211,28 @@
 		}
 	else
 		{
-		LOGTEXT3(_L8("\tPANICKING: bad Type value (%S) in section %S"), &temp, &aSection);
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile);
+		OstTraceExt2( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP3, 
+		        "CUsbDummyClassController::GetBehaviour;PANICKING: bad Type value (%S) in section %S", temp, aSection );
+		OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP4, "CUsbDummyClassController::GetBehaviour; panic code=%d", EDummyPanicBadIniFile );
+		User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile);
 		}
 	TInt delay;
 	if ( !aIniFile.FindVar(aSection, KTime(), delay) )
 		{
-		LOGTEXT2(_L8("\tPANICKING: can't find Time item in section %S"), &aSection);
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile);
+		OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP5, 
+		        "CUsbDummyClassController::GetBehaviour;PANICKING: can't find Time item in section %S", aSection );
+		OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP6, "CUsbDummyClassController::GetBehaviour;panic code=%d", EDummyPanicBadIniFile );
+		User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile);
 		}
 	aBehaviour.iDelay = delay;
 	if ( !aIniFile.FindVar(aSection, KError(), aBehaviour.iErrorCode) )
 		{
-		LOGTEXT2(_L8("\tPANICKING: can't find Error item in section %S"), &aSection);
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadIniFile);
+		OstTraceExt1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP7, 
+		        "CUsbDummyClassController::GetBehaviour;aSection=%S", aSection );
+		OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_DUP8, "CUsbDummyClassController::GetBehaviour;panic code=%d", EDummyPanicBadIniFile );
+		User::Panic(KDummyControllerPanic, EDummyPanicBadIniFile );
 		}
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_GETBEHAVIOUR_EXIT );
 	}
 
 void CUsbDummyClassController::DoGetConfigL()
@@ -223,7 +240,7 @@
  * Reads the config from the ini file.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_ENTRY );
 
 	CIniFile* iniFile = CIniFile::NewL(_L("dummy.ini"));
 	CleanupStack::PushL(iniFile);
@@ -237,6 +254,7 @@
 	GetBehaviour(*iniFile, section, iShutdownBehaviour);
 
 	CleanupStack::PopAndDestroy(iniFile);
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_DOGETCONFIGL_EXIT );
 	}
 
 void CUsbDummyClassController::GetConfig()
@@ -247,7 +265,7 @@
  * the user to figure out what's gone wrong.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_GETCONFIG_ENTRY );
 
 	// Always use dummy.ini. The entity setting up the test is responsible for 
 	// copying the correct file to c:\\dummy.ini. The first found 
@@ -255,16 +273,25 @@
 	TRAPD(err, DoGetConfigL());
 	if ( err != KErrNone )
 		{
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicUnhandledError);
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP7, "CUsbDummyClassController::GetConfig;panic code=%d", EDummyPanicUnhandledError );
+		User::Panic(KDummyControllerPanic, EDummyPanicUnhandledError);
 		}
 	
-	LOGTEXT2(_L8("\tLogging dummy class controller behaviour for instance %d"), iIndex);
-	LOGTEXT2(_L8("\tiStartupBehaviour.iSynchronicity = %d"), iStartupBehaviour.iSynchronicity);
-	LOGTEXT2(_L8("\tiStartupBehaviour.iDelay = %d"), iStartupBehaviour.iDelay.Int());
-	LOGTEXT2(_L8("\tiStartupBehaviour.iErrorCode = %d"), iStartupBehaviour.iErrorCode);
-	LOGTEXT2(_L8("\tiShutdownBehaviour.iSynchronicity = %d"), iShutdownBehaviour.iSynchronicity);
-	LOGTEXT2(_L8("\tiShutdownBehaviour.iDelay = %d"), iShutdownBehaviour.iDelay.Int());
-	LOGTEXT2(_L8("\tiShutdownBehaviour.iErrorCode = %d"), iShutdownBehaviour.iErrorCode);
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG, 
+	        "CUsbDummyClassController::GetConfig; Logging dummy class controller behaviour for instance %d", iIndex );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP1, 
+	        "CUsbDummyClassController::GetConfig;iStartupBehaviour.iSynchronicity=%d", iStartupBehaviour.iSynchronicity );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP2, 
+	        "CUsbDummyClassController::GetConfig;iStartupBehaviour.iDelay.Int()=%d", iStartupBehaviour.iDelay.Int() );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP3, 
+	        "CUsbDummyClassController::GetConfig;iStartupBehaviour.iErrorCode=%d", iStartupBehaviour.iErrorCode );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP4, 
+	        "CUsbDummyClassController::GetConfig;iShutdownBehaviour.iSynchronicity=%d", iShutdownBehaviour.iSynchronicity );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP5, 
+	        "CUsbDummyClassController::GetConfig;iShutdownBehaviour.iDelay.Int()=%d", iShutdownBehaviour.iDelay.Int() );
+	OstTrace1( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_GETCONFIG_DUP6, 
+	        "CUsbDummyClassController::GetConfig;iShutdownBehaviour.iErrorCode=%d", iShutdownBehaviour.iErrorCode );
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_GETCONFIG_EXIT );
 	}
 
 void CUsbDummyClassController::Start(TRequestStatus& aStatus)
@@ -274,11 +301,16 @@
  * @param aStatus Will be completed with success or failure.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_START_ENTRY );
+	
+	//Start() should only be called if the CC is idle or started	
 	
-	//Start() should only be called if the CC is idle or started		
-	__ASSERT_DEBUG((iState == EUsbServiceIdle || iState == EUsbServiceStarted), 
-							_USB_PANIC(KDummyControllerPanic, EDummyPanicBadApiCallStart) );
+	if(!(iState == EUsbServiceIdle || iState == EUsbServiceStarted))
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicBadApiCallStart );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadApiCallStart) );
+	    }
 
 	// Get config from ini file. Note that can't be done once in ConstructL 
 	// because then, in the case of a CC which doesn't Stop, we'd never be 
@@ -286,8 +318,12 @@
 	GetConfig();
 
 	// NB We enforce that the device doesn't re-post requests on us.
-	__ASSERT_DEBUG(!iReportStatus, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice));
+	if(iReportStatus)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START_DUP1, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicOutstandingRequestFromDevice );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice));
+	    }
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
 	
@@ -304,7 +340,13 @@
 
 	case EAsynchronous:
 		iTimer.After(iStatus, iStartupBehaviour.iDelay);
-		__ASSERT_DEBUG(!IsActive(), _USB_PANIC(KDummyControllerPanic, EDummyPanicAlreadyActive));		
+#ifdef _DEBUG
+		if(IsActive())
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START_DUP2, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicAlreadyActive );
+            User::Panic(KDummyControllerPanic, EDummyPanicAlreadyActive);
+		    }
+#endif
 		SetActive();
 		break;
 
@@ -313,9 +355,11 @@
 		break;
 
 	default:
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity);
+	    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_START_DUP3, "CUsbDummyClassController::Start;panic code=%d", EDummyPanicBadSynchronicity );
+	    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity);
 		break;
 		}
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_START_EXIT );
 	}
 
 void CUsbDummyClassController::Stop(TRequestStatus& aStatus)
@@ -325,11 +369,15 @@
  * @param aStatus Will be completed with success or failure.
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_STOP_ENTRY );
 		
 	//Stop() should only be called if the CC is Started or Idle
-	__ASSERT_DEBUG((iState == EUsbServiceStarted || iState == EUsbServiceIdle), 
-				_USB_PANIC(KDummyControllerPanic, EDummyPanicBadApiCallStop));
+	if(!(iState == EUsbServiceStarted || iState == EUsbServiceIdle))
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicBadApiCallStop );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadApiCallStop));
+	    }
 	
 	// Get config from ini file. Note that can't be done once in ConstructL 
 	// because then, in the case of a CC which doesn't Stop, we'd never be 
@@ -337,8 +385,12 @@
 	GetConfig();
 
 	// NB We enforce that the device doesn't re-post requests on us.
-	__ASSERT_DEBUG(!iReportStatus, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice));
+	if(iReportStatus)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP_DUP1, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicOutstandingRequestFromDevice );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicOutstandingRequestFromDevice));
+	    }
 	aStatus = KRequestPending;
 	iReportStatus = &aStatus;
 
@@ -355,7 +407,13 @@
 
 	case EAsynchronous:
 		iTimer.After(iStatus, iShutdownBehaviour.iDelay);
-    	__ASSERT_DEBUG(!IsActive(), _USB_PANIC(KDummyControllerPanic, EDummyPanicAlreadyActive));		
+#ifdef _DEBUG
+    	if(IsActive())
+    	    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP_DUP2, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicAlreadyActive );
+            User::Panic(KDummyControllerPanic, EDummyPanicAlreadyActive);
+    	    }
+#endif
 		SetActive();
 		break;
 
@@ -364,9 +422,11 @@
 		break;
 
 	default:
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity);
+	    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_STOP_DUP3, "CUsbDummyClassController::Stop;panic code=%d", EDummyPanicBadSynchronicity );
+	    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity);
 		break;
 		}
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_STOP_EXIT );
 	}
 
 void CUsbDummyClassController::GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const
@@ -385,8 +445,9 @@
  * Standard active object RunL. 
  */
 	{
-	LOGTEXT3(_L8(">>CUsbDummyClassController::RunL [iStatus=%d,iState=%d]"),
-			iStatus.Int(), iState);
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_RUNL_ENTRY );
+	OstTraceExt2( TRACE_NORMAL, CUSBDUMMYCLASSCONTROLLER_RUNL, "CUsbDummyClassController::RunL;iStatus.Int()=%d;iState=%d", iStatus.Int(), iState );
+
 
 	if ( iStatus != KErrNone )
 		{
@@ -394,18 +455,27 @@
 		// there's no point trying to code round them. This is part of the 
 		// test framework and if it's failing we want to alert the user 
 		// without faffing around. (It invalidates the test.)
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicUnhandledError);
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP1, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicUnhandledError );
+        User::Panic(KDummyControllerPanic, EDummyPanicUnhandledError);
 		}								  
 
-	__ASSERT_DEBUG(iReportStatus, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState));
+	if(!iReportStatus)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP2, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadState );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadState));
+	    }
 
 	switch ( iState )
 		{
 	case EUsbServiceStarting:
 		// Completion of asynchronous startup...
-		__ASSERT_DEBUG(iStartupBehaviour.iSynchronicity == EAsynchronous, 
-			_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		if(iStartupBehaviour.iSynchronicity != EAsynchronous)
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP3, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadSynchronicity );
+            __ASSERT_DEBUG(EFalse, 
+                    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		    }
 		iState = EUsbServiceStarted;
 		User::RequestComplete(iReportStatus, iStartupBehaviour.iErrorCode);
 		iReportStatus = NULL;
@@ -413,8 +483,12 @@
 
 	case EUsbServiceStopping:
 		// Completion of asynchronous shutdown...
-		__ASSERT_DEBUG(iShutdownBehaviour.iSynchronicity == EAsynchronous, 
-			_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		if(iShutdownBehaviour.iSynchronicity != EAsynchronous)
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP4, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadSynchronicity );
+            __ASSERT_DEBUG(EFalse, 
+                    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		    }
 		iState = EUsbServiceIdle;
 		User::RequestComplete(iReportStatus, iShutdownBehaviour.iErrorCode);
 		iReportStatus = NULL;
@@ -423,11 +497,12 @@
 	case EUsbServiceIdle:
 	case EUsbServiceStarted:
 	default:
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState);
+	    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNL_DUP5, "CUsbDummyClassController::RunL;panic code=%d", EDummyPanicBadState );
+	    User::Panic(KDummyControllerPanic, EDummyPanicBadState);
 		break;
 		}
 
-	LOGTEXT(_L8("<<CUsbDummyClassController::RunL"));
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_RUNL_EXIT );
 	}
 
 void CUsbDummyClassController::DoCancel()
@@ -435,7 +510,7 @@
  * Standard active object cancellation function. 
  */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry0( CUSBDUMMYCLASSCONTROLLER_DOCANCEL_ENTRY );
 
 	// Note that CActive::Cancel does not call DoCancel unless we are active. 
 	// Therefore we are at this point active. Therefore, we should have 
@@ -451,8 +526,13 @@
 	// the middle of a Start, then immediately issue another Start.
 	
 	// Cancel our own asynchronous operation.
-	__ASSERT_DEBUG(iTimer.Handle(), 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState));
+#ifdef _DEBUG
+	if(!iTimer.Handle())
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadState ); 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadState);
+	    }
+#endif
 	iTimer.Cancel();
 
 	// Update our iState. If we're starting, then roll back to idle. If we're 
@@ -460,29 +540,43 @@
 	switch ( iState )
 		{
 	case EUsbServiceStarting:
-		__ASSERT_DEBUG(iStartupBehaviour.iSynchronicity == EAsynchronous, 
-			_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		if(iStartupBehaviour.iSynchronicity != EAsynchronous)
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP1, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadSynchronicity );
+            __ASSERT_DEBUG(EFalse, 
+                    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		    }
 		iState = EUsbServiceIdle;
 		break;
 
 	case EUsbServiceStopping:
-		__ASSERT_DEBUG(iShutdownBehaviour.iSynchronicity == EAsynchronous, 
-			_USB_PANIC(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		if(iShutdownBehaviour.iSynchronicity != EAsynchronous)
+		    {
+            OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP2, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadSynchronicity );
+            __ASSERT_DEBUG(EFalse, 
+                    User::Panic(KDummyControllerPanic, EDummyPanicBadSynchronicity));
+		    }
 		iState = EUsbServiceStarted;
 		break;
 
 	case EUsbServiceIdle:
 	case EUsbServiceStarted:
 	default:
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState);
+	    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP3, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadState );
+	    User::Panic(KDummyControllerPanic, EDummyPanicBadState);
 		break;
 		}
 
-	// Complete the client's request.	
-	__ASSERT_DEBUG(iReportStatus, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState));
+	// Complete the client's request.
+	if(!iReportStatus)
+	    {
+        OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_DOCANCEL_DUP4, "CUsbDummyClassController::DoCancel;panic code=%d", EDummyPanicBadState );
+        __ASSERT_DEBUG(EFalse, 
+                User::Panic(KDummyControllerPanic, EDummyPanicBadState));
+	    }
 	User::RequestComplete(iReportStatus, KErrCancel); 
 	iReportStatus = NULL;
+	OstTraceFunctionExit0( CUSBDUMMYCLASSCONTROLLER_DOCANCEL_EXIT );
 	}
 
 TInt CUsbDummyClassController::RunError(TInt /*aError*/)
@@ -493,8 +587,9 @@
  * should never be called as there is another mechanism for catching errors.
  */
 	{
-	__ASSERT_DEBUG(EFalse, 
-		_USB_PANIC(KDummyControllerPanic, EDummyPanicBadState));
+    OstTrace1( TRACE_FATAL, CUSBDUMMYCLASSCONTROLLER_RUNERROR, "CUsbDummyClassController::RunError;panic code=%d", EDummyPanicBadState );
+    __ASSERT_DEBUG(EFalse,
+            User::Panic(KDummyControllerPanic, EDummyPanicBadState));
 	return KErrNone;
 	}