diff -r f92a4f87e424 -r 012cc2ee6408 usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcInterfaceBase.cpp --- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcInterfaceBase.cpp Tue Aug 31 17:01:47 2010 +0300 +++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcInterfaceBase.cpp Wed Sep 01 12:35:00 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1997-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" @@ -17,12 +17,12 @@ #include #include "CdcInterfaceBase.h" -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "CdcInterfaceBaseTraces.h" +#include + +#ifdef __FLOG_ACTIVE +_LIT8(KLogComponent, "ECACM"); #endif - CCdcInterfaceBase::CCdcInterfaceBase(const TDesC16& aIfcName) /** * Constructor. @@ -30,9 +30,7 @@ * @param aIfcName The name of the interface. */ { - OstTraceFunctionEntry0( CCDCINTERFACEBASE_CCDCINTERFACEBASE_CONS_ENTRY ); iIfcName.Set(aIfcName); - OstTraceFunctionExit0( CCDCINTERFACEBASE_CCDCINTERFACEBASE_CONS_EXIT ); } void CCdcInterfaceBase::BaseConstructL() @@ -41,31 +39,21 @@ * This call registers the object with the USB device driver */ { - OstTraceFunctionEntry0( CCDCINTERFACEBASE_BASECONSTRUCTL_ENTRY ); - OstTrace0( TRACE_NORMAL, CCDCINTERFACEBASE_BASECONSTRUCTL, "CCdcInterfaceBase::BaseConstructL;\tcalling RDevUsbcClient::Open" ); + LOGTEXT(_L8("\tcalling RDevUsbcClient::Open")); // 0 is assumed to mean ep0 TInt ret = iLdd.Open(0); if ( ret ) - { - OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_BASECONSTRUCTL_DUP1, - "CCdcInterfaceBase::BaseConstructL;\tRDevUsbcClient::Open = %d", ret ); - if (ret < 0) - { - User::Leave(ret); - } + { + LOGTEXT2(_L8("\tRDevUsbcClient::Open = %d"), ret); + LEAVEIFERRORL(ret); } ret = SetUpInterface(); if ( ret ) { - OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_BASECONSTRUCTL_DUP2, - "CCdcInterfaceBase::BaseConstructL;\tSetUpInterface = %d", ret ); - if (ret < 0) - { - User::Leave(ret); - } + LOGTEXT2(_L8("\tSetUpInterface = %d"), ret); + LEAVEIFERRORL(ret); } - OstTraceFunctionExit0( CCDCINTERFACEBASE_BASECONSTRUCTL_EXIT ); } CCdcInterfaceBase::~CCdcInterfaceBase() @@ -73,18 +61,18 @@ * Destructor. */ { - OstTraceFunctionEntry0( CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES_ENTRY ); + LOG_FUNC + if ( iLdd.Handle() ) { - OstTrace0( TRACE_NORMAL, CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES, - "CCdcInterfaceBase::~CCdcInterfaceBase;\tLDD handle exists" ); + LOGTEXT(_L8("\tLDD handle exists")); + // Don't bother calling ReleaseInterface- the base driver spec says // that Close does it for us. - OstTrace0( TRACE_NORMAL, CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES_DUP1, - "CCdcInterfaceBase::~CCdcInterfaceBase;\tclosing LDD session" ); + + LOGTEXT(_L8("\tclosing LDD session")); iLdd.Close(); } - OstTraceFunctionExit0( CCDCINTERFACEBASE_CCDCINTERFACEBASE_DES_EXIT ); } TInt CCdcInterfaceBase::GetInterfaceNumber(TUint8& aIntNumber) @@ -95,25 +83,24 @@ * @return Error. */ { - OstTraceFunctionEntry0( CCDCINTERFACEBASE_GETINTERFACENUMBER_ENTRY ); + LOG_FUNC + TInt interfaceSize = 0; + // 0 means the main interface in the LDD API TInt res = iLdd.GetInterfaceDescriptorSize(0, interfaceSize); if ( res ) { - OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER, - "CCdcInterfaceBase::GetInterfaceNumber;\t***GetInterfaceDescriptorSize()=%d", res ); - OstTraceFunctionExit0( CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT ); + LOGTEXT2(_L8("\t***GetInterfaceDescriptorSize()=%d"), res); return res; } HBufC8* interfaceBuf = HBufC8::New(interfaceSize); if ( !interfaceBuf ) { - OstTrace0( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP1, - "CCdcInterfaceBase::GetInterfaceNumber;\t***failed to create interfaceBuf-returning KErrNoMemory" ); - OstTraceFunctionExit0( CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT_DUP1 ); + LOGTEXT(_L8("\t***failed to create interfaceBuf- " + "returning KErrNoMemory")); return KErrNoMemory; } @@ -125,27 +112,26 @@ if ( res ) { delete interfaceBuf; - OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP2, "CCdcInterfaceBase::GetInterfaceNumber;res=%d", res ); - OstTraceFunctionExit0( CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT_DUP2 ); + LOGTEXT2(_L8("\t***GetInterfaceDescriptor()=%d"), res); return res; } - OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP3, - "CCdcInterfaceBase::GetInterfaceNumber;\t***interface length = %d", interfacePtr.Length() ); +#ifdef __FLOG_ACTIVE + LOGTEXT2(_L8("\t***interface length = %d"), interfacePtr.Length()); for ( TInt i = 0 ; i < interfacePtr.Length() ; i++ ) { - OstTraceExt1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP4, - "\t***** %hhx", interfacePtr[i] ); + LOGTEXT2(_L8("\t***** %x"),interfacePtr[i]); } +#endif const TUint8* buffer = reinterpret_cast(interfacePtr.Ptr()); // 2 is where the interface number is, according to the LDD API aIntNumber = buffer[2]; - OstTrace1( TRACE_NORMAL, CCDCINTERFACEBASE_GETINTERFACENUMBER_DUP5, - "CCdcInterfaceBase::GetInterfaceNumber;\tinterface number = %d", (TInt)aIntNumber ); - + + LOGTEXT2(_L8("\tinterface number = %d"), aIntNumber); + delete interfaceBuf; - OstTraceFunctionExit0( CCDCINTERFACEBASE_GETINTERFACENUMBER_EXIT_DUP3 ); + return KErrNone; }