usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/src/msfdc.cpp
branchRCL_3
changeset 43 012cc2ee6408
parent 42 f92a4f87e424
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/src/msfdc.cpp	Tue Aug 31 17:01:47 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msfdc/src/msfdc.cpp	Wed Sep 01 12:35:00 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 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"
@@ -26,12 +26,10 @@
 #include <usbhost/internal/fdcpluginobserver.h>
 #include <d32usbdi.h>
 #include <d32usbdescriptors.h>
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "msfdcTraces.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "MsFdc");
 #endif
-
-
 /**
   NewL function of CMsFdc, allocate the memory that needed for instantiating this object.
  
@@ -41,13 +39,12 @@
  */
 CMsFdc* CMsFdc::NewL(MFdcPluginObserver& aObserver)
 	{
-	OstTraceFunctionEntry0( CMSFDC_NEWL_ENTRY );
-	
+	LOG_STATIC_FUNC_ENTRY
+
 	CMsFdc* self = new(ELeave) CMsFdc(aObserver);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
-	OstTraceFunctionExit0( CMSFDC_NEWL_EXIT );
 	return self;
 	} 
 
@@ -56,11 +53,13 @@
  */
 CMsFdc::~CMsFdc()
 	{
-	OstTraceFunctionEntry0( CMSFDC_CMSFDC_DES_ENTRY );
+	LOG_FUNC
+	
 	iMsmmSession.Disconnect();
-	OstTrace0( TRACE_NORMAL, CMSFDC_CMSFDC, "Disconnected to MSMM OK" );
-
-	OstTraceFunctionExit0( CMSFDC_CMSFDC_DES_EXIT );
+	LOGTEXT(_L("Disconnected to MSMM OK"));
+#ifdef __FLOG_ACTIVE
+	CUsbLog::Close();
+#endif
 	}
 /**
   Constructor of CMsFdc.
@@ -74,22 +73,23 @@
  */
 void CMsFdc::ConstructL()
 	{
-	OstTraceFunctionEntry0( CMSFDC_CONSTRUCTL_ENTRY );
+
+#ifdef __FLOG_ACTIVE
+	CUsbLog::Connect();
+#endif
+	LOG_FUNC
 	
 	//Set up the connection with mount manager
 	TInt error = iMsmmSession.Connect();
 	if ( error )
 		{
-        OstTrace1( TRACE_NORMAL, CMSFDC_CONSTRUCTL, 
-                "Failed to connect to MSMM %d",error );
-        User::Leave(error);
+		LOGTEXT2(_L("Failed to connect to MSMM %d"),error);
+		User::Leave(error);
 		}
 	else
 		{
-        OstTrace0( TRACE_NORMAL, CMSFDC_CONSTRUCTL_DUP1, 
-                "Connected to MSMM OK" );
- 		}
-	OstTraceFunctionExit0( CMSFDC_CONSTRUCTL_EXIT );
+		LOGTEXT(_L("Connected to MSMM OK"));
+		}
 	}
 /**
   Get called when FDF is trying to load the driver for Mass Storage Device. 
@@ -106,23 +106,17 @@
 		const TUsbDeviceDescriptor& aDeviceDescriptor,
 		const TUsbConfigurationDescriptor& aConfigurationDescriptor)
 	{
-	OstTraceFunctionEntry0( CMSFDC_MFI1NEWFUNCTION_ENTRY );
-	 
-	// this is the evidence that the message got through.
-	OstTrace1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION, 
-	        "***** Mass Storage FD notified of device (ID %d) attachment!", aDeviceId );	
+	LOG_FUNC // this is the evidence that the message got through.
+	LOGTEXT2(_L8("\t***** Mass Storage FD notified of device (ID %d) attachment!"), aDeviceId);
+	
 
 	// Mass Storage FDC only claims one interface.
-	OstTrace1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP1, 
-	            "***** Mass Storage FD interface to request token is %d", aInterfaces[0] );    
+	LOGTEXT2(_L8("\t***** Mass Storage FD interface to request token is %d"), aInterfaces[0]);
 	TUint32 token = Observer().TokenForInterface(aInterfaces[0]);
-	OstTrace1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP2, 
-	        "***** Mass Storage FD tokenInterface  %d", token );
+	LOGTEXT2(_L8("\t***** Mass Storage FD tokenInterface  %d"), token);
 	if (token == 0)
 		{
-        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP3, 
-	            "***** Mass Storage FDC device containing this function is removed." );
-		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT );
+		LOGTEXT(_L8("\t***** Mass Storage FDC device containing this function is removed."));
 		return KErrGeneral;
 		}
 
@@ -132,9 +126,7 @@
 
 	if (error)
 		{
-        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP4, 
-	                "***** Mass Storage FDC getting language array failed" );
-		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP1 );
+		LOGTEXT(_L8("\t***** Mass Storage FDC getting language array failed"));
 		return error;
 		}
 	
@@ -142,9 +134,7 @@
 	TRAP(error, data = new (ELeave) TUSBMSDeviceDescription);
 	if (error)
 		{
-        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP5, 
-	                    "***** Mass Storage FDC Memory allocation Failed" );
-		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP2 );
+		LOGTEXT(_L8("\t***** Mass Storage FDC Memory allocation Failed"));		
 		return error;
 		}
 
@@ -154,33 +144,27 @@
 	
 	if (error)
 		{
-        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP6, 
-                    "***** Mass Storage FDC getting Serial Number Failed" );
+		LOGTEXT(_L8("\t***** Mass Storage FDC getting Serial Number failed"));
 		delete data;
-		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP3 );
 		return error;
 		}
 	else
 		{
-        OstTraceExt1( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP7, 
-	                    "***** Mass Storage FDC Serial String is %S", data->iSerialNumber );
-	    }
+		LOGTEXT2(_L("\t***** Mass Storage FDC Serial String is %S"), &data->iSerialNumber);
+		}
 	//Get Product string descriptor
 	error = Observer().GetProductStringDescriptor(aDeviceId, defaultlangid, data->iProductString);
 	
 
 	if (error)
 		{
-        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP8, 
-	                    "***** Mass Storage FDC getting Product string Failed" );
-	    delete data;
-		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP4 );
+		LOGTEXT(_L8("\t***** Mass Storage FDC getting Product string failed"));
+		delete data;
 		return error;
 		}
 	else
 		{
-        OstTraceExt1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP9, 
-	                        "***** Mass Storage FDC Product String is %S", data->iProductString );
+		LOGTEXT2(_L("\t***** Mass Storage FDC Product String is %S"), &data->iProductString);
 		}
 
 	//Get Manufacturer string descriptor
@@ -189,16 +173,14 @@
 	
 	if (error)
 		{
-        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP10, 
-                    "***** Mass Storage FDC getting Manufacturer string Failed" );
+		LOGTEXT(_L8("\t***** Mass Storage FDC getting Manufacturer string failed"));
 		delete data;
-		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP5 );
 		return error;
 		}
 	else
 		{
-        OstTraceExt1( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP11, 
-	                            "***** Mass Storage FDC Manufacturer String is %S", data->iManufacturerString );
+		LOGTEXT2(_L("\t***** Mass Storage FDC Manufacturer String is %S"), 
+				&data->iManufacturerString);		
 		}	
 	
 	/************************Remote Wakeup Attribute acquiring***********************/
@@ -210,32 +192,26 @@
     error = interface_ep0.Open(token);
     if (error)
     	{
-        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP12, 
-                        "***** Mass Storage FDC Open interface handle Failed" );
-    	delete data;
-		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP6 );
+		LOGTEXT(_L8("\t***** Mass Storage FDC Open interface handle failed"));
+		delete data;
 		return error;
     	}
     else
     	{
-        OstTrace0( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP13, 
-                         "***** Mass Storage FDC Open interface handle OK" );
+		LOGTEXT(_L8("\t***** Mass Storage FDC Open interface handle OK"));
     	}
 
     error = interface_ep0.GetInterfaceDescriptor(ifDescriptor);
-	interface_ep0.Close();
     if (error)
     	{
-        OstTrace0( TRACE_ERROR, CMSFDC_MFI1NEWFUNCTION_DUP14, 
-                        "***** Mass Storage FDC get interface descriptor Failed" );
+		LOGTEXT(_L8("\t***** Mass Storage FDC get interface descriptor failed"));
+		interface_ep0.Close();
 		delete data;
-		OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP7 );
 		return error;
     	}
     else
     	{
-        OstTrace0( TRACE_NORMAL, CMSFDC_MFI1NEWFUNCTION_DUP15, 
-                         "***** Mass Storage FDC get interface descriptor OK" );
+		LOGTEXT(_L8("\t***** Mass Storage FDC get interface descriptor OK"));
     	}
 	
 	/*********************************************************************************/
@@ -261,8 +237,8 @@
 	
 	error = iMsmmSession.AddFunction(*data, aInterfaces[0], token);
 	
+	interface_ep0.Close();
 	delete data;
-	OstTraceFunctionExit0( CMSFDC_MFI1NEWFUNCTION_EXIT_DUP8 );
 	return error;
 	}
 /**
@@ -272,13 +248,10 @@
  */
 void CMsFdc::Mfi1DeviceDetached(TUint aDeviceId)
 	{
-	OstTraceFunctionEntry0( CMSFDC_MFI1DEVICEDETACHED_ENTRY );
-    // this is the evidence that the message got through.
-	OstTrace1( TRACE_NORMAL, CMSFDC_MFI1DEVICEDETACHED, 
-	        "***** Mass Storage FD notified of device (ID %d) detachment!", aDeviceId );
+	LOG_FUNC // this is the evidence that the message got through.
+	LOGTEXT2(_L8("\t***** Mass Storage FD notified of device (ID %d) detachment!"), aDeviceId);
 	iMsmmSession.RemoveDevice(aDeviceId);
 
-	OstTraceFunctionExit0( CMSFDC_MFI1DEVICEDETACHED_EXIT );
 	}
 
 /**
@@ -289,9 +262,10 @@
  */
 TAny* CMsFdc::GetInterface(TUid aUid)
 	{
-	OstTraceFunctionEntry0( CMSFDC_GETINTERFACE_ENTRY );
-	OstTrace1( TRACE_NORMAL, CMSFDC_GETINTERFACE, "aUid = 0x%08x", aUid.iUid );
-	
+	LOG_LINE
+	LOG_FUNC;
+	LOGTEXT2(_L8("\taUid = 0x%08x"), aUid);
+
 	TAny* ret = NULL;
 	if ( aUid == TUid::Uid(KFdcInterfaceV1) )
 		{
@@ -299,9 +273,8 @@
 			static_cast<MFdcInterfaceV1*>(this)
 			);
 		}
-	OstTrace1( TRACE_NORMAL, CMSFDC_GETINTERFACE_DUP1, 
-        "ret = [0x%08x]", ret );
-	OstTraceFunctionExit0( CMSFDC_GETINTERFACE_EXIT );
+
+	LOGTEXT2(_L8("\tret = [0x%08x]"), ret);
 	return ret;
 	}
 /**