--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcControlInterfaceReader.cpp Tue Aug 31 17:01:47 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/CdcControlInterfaceReader.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"
@@ -22,12 +22,12 @@
#include "AcmUtils.h"
#include "CdcControlInterfaceRequestHandler.h"
#include "AcmConstants.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "CdcControlInterfaceReaderTraces.h"
+#include <usb/usblogger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "ECACM");
#endif
-
CCdcControlInterfaceReader::CCdcControlInterfaceReader(
MCdcCommsClassRequestHandler& aParent,
RDevUsbcClient& aLdd)
@@ -41,10 +41,8 @@
* @param aLdd The USB LDD handle to be used.
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_CONS_ENTRY );
CActiveScheduler::Add(this);
ReadMessageHeader();
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_CONS_EXIT );
}
CCdcControlInterfaceReader::~CCdcControlInterfaceReader()
@@ -52,9 +50,9 @@
* Destructor
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_DES_ENTRY );
+ LOG_FUNC
+
Cancel(); //Call CActive::Cancel()
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_CCDCCONTROLINTERFACEREADER_DES_EXIT );
}
CCdcControlInterfaceReader* CCdcControlInterfaceReader::NewL(
@@ -67,11 +65,11 @@
* @param aLdd The USB LDD handle to be used.
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_NEWL_ENTRY );
+ LOG_STATIC_FUNC_ENTRY
+
CCdcControlInterfaceReader* self = new(ELeave) CCdcControlInterfaceReader(
aParent,
aLdd);
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_NEWL_EXIT );
return self;
}
@@ -80,10 +78,9 @@
* This function will be called when a read completes.
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_RUNL_ENTRY );
- OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_RUNL, "CCdcControlInterfaceReader::RunL;iStatus=%d", iStatus.Int() );
+ LOGTEXT2(_L8(">>CCdcControlInterfaceReader::RunL iStatus=%d"), iStatus.Int());
HandleReadCompletion(iStatus.Int());
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_RUNL_EXIT );
+ LOGTEXT(_L8("<<CCdcControlInterfaceReader::RunL"));
}
void CCdcControlInterfaceReader::DoCancel()
@@ -91,9 +88,8 @@
* Cancel an outstanding read.
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_DOCANCEL_ENTRY );
+ LOG_FUNC
iLdd.ReadCancel(EEndpoint0);
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DOCANCEL_EXIT );
}
void CCdcControlInterfaceReader::HandleReadCompletion(TInt aError)
@@ -107,22 +103,17 @@
* @param aError Error
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_ENTRY );
- OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION,
- "CCdcControlInterfaceReader::HandleReadCompletion;aError=%d", aError );
+ LOGTEXT2(_L8(">>CCdcControlInterfaceReader::HandleReadCompletion "
+ "aError=%d"), aError);
if ( aError )
{
- ReadMessageHeader();
- OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_DUP1,
- "CCdcControlInterfaceReader::HandleReadCompletion" );
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_EXIT );
+ ReadMessageHeader();
+ LOGTEXT(_L8("<<CCdcControlInterfaceReader::HandleReadCompletion"));
return;
}
- OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_DUP2,
- "CCdcControlInterfaceReader::HandleReadCompletion;iState=%d", (TInt)iState );
-
+ LOGTEXT2(_L8("\tcompleted with iState=%d"),iState);
switch ( iState)
{
case EWaitingForHeader:
@@ -139,14 +130,12 @@
default:
{
- OstTrace1( TRACE_FATAL, CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_DUP3,
- "CCdcControlInterfaceReader::HandleReadCompletion;iState=%d", (TInt)iState );
- User::Panic(KAcmPanicCat, EPanicIllegalState);
+ _USB_PANIC(KAcmPanicCat, EPanicIllegalState);
}
break;
}
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_HANDLEREADCOMPLETION_EXIT_DUP1 );
+ LOGTEXT(_L8("<<CCdcControlInterfaceReader::HandleReadCompletion"));
}
void CCdcControlInterfaceReader::DecodeMessageHeader()
@@ -155,23 +144,20 @@
* requires some data in response and dispatches the request appropriately.
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_ENTRY );
+ LOG_FUNC
+
if ( TUsbRequestHdr::Decode(iMessageHeader, iRequestHeader) != KErrNone )
{
- OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER,
- "CCdcControlInterfaceReader::DecodeMessageHeader;\t- Unable to decode request header!" );
-
+ LOGTEXT(_L8("\t- Unable to decode request header!"));
// Stall bus- unknown message. If this fails, there's nothing we can
// do.
static_cast<void>(iLdd.EndpointZeroRequestError());
ReadMessageHeader();
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_EXIT );
return;
}
- OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_DUP1,
- "CCdcControlInterfaceReader::DecodeMessageHeader;\t- New read! Request %d", (TInt)iRequestHeader.iRequest );
-
+ LOGTEXT2(_L8("\t- New read! Request 0x%x"), iRequestHeader.iRequest);
+
if ( iRequestHeader.IsDataResponseRequired() )
{
DecodeMessageDataWithResponseRequired();
@@ -185,7 +171,6 @@
{
ReadMessageData(iRequestHeader.iLength);
}
- OstTraceFunctionExit0( DUP1_CCDCCONTROLINTERFACEREADER_DECODEMESSAGEHEADER_EXIT );
}
void CCdcControlInterfaceReader::DecodeMessageDataWithResponseRequired()
@@ -193,11 +178,11 @@
* Decode a message which requires data to be sent to the host in response.
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED_ENTRY );
- OstTraceExt1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED,
- "CCdcControlInterfaceReader::DecodeMessageDataWithResponseRequired;\t- New read! Request=%hhx", iRequestHeader.iRequest );
-
+ LOG_FUNC
+
+ LOGTEXT2(_L8("\t- New read! Request 0x%x"), iRequestHeader.iRequest);
TBuf8<KAcmControlReadBufferLength> returnBuffer;
+
switch ( iRequestHeader.iRequest )
{
case KGetEncapsulated:
@@ -263,10 +248,8 @@
default:
{
- OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED_DUP1,
- "CCdcControlInterfaceReader::DecodeMessageDataWithResponseRequired;\t- request number not recognised (%d)",
- (TInt)(iRequestHeader.iRequest) );
-
+ LOGTEXT2(_L8("\t- request number not recognised (%d)"),
+ iRequestHeader.iRequest);
// Stall bus- unknown message. If this fails, there's nothing we can
// do.
static_cast<void>(iLdd.EndpointZeroRequestError());
@@ -275,7 +258,6 @@
}
ReadMessageHeader();
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATAWITHRESPONSEREQUIRED_EXIT );
}
void CCdcControlInterfaceReader::DecodeMessageData()
@@ -286,20 +268,17 @@
* can be nack'ed by signalling an endpoint zero request error.
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_ENTRY );
+ LOG_FUNC
+
if ( iMessageData.Length() != iRequestHeader.iLength )
{
- OstTrace0( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA,
- "CCdcControlInterfaceReader::DecodeMessageData;\t- Data length is incorrect" );
-
+ LOGTEXT(_L8("\t- Data length is incorrect"));
ReadMessageHeader();
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_EXIT );
return;
}
- OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_DUP1,
- "CCdcControlInterfaceReader::DecodeMessageData;\tNew read! Request %d", (TInt)(iRequestHeader.iRequest) );
-
+ LOGTEXT2(_L8("\tNew read! Request %d"), iRequestHeader.iRequest);
+
switch ( iRequestHeader.iRequest )
{
case KSendEncapsulated:
@@ -387,9 +366,8 @@
}
break;
default:
- OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_DUP2,
- "CCdcControlInterfaceReader::DecodeMessageData;\t***request number not recognised (%d)", (TInt)(iRequestHeader.iRequest) );
-
+ LOGTEXT2(_L8("\t***request number not recognised (%d)"),
+ iRequestHeader.iRequest);
// Stall bus- unknown message. If this fails, there's nothing we can
// do.
static_cast<void>(iLdd.EndpointZeroRequestError());
@@ -397,7 +375,6 @@
}
ReadMessageHeader();
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_DECODEMESSAGEDATA_EXIT_DUP1 );
}
void CCdcControlInterfaceReader::ReadMessageHeader()
@@ -406,11 +383,12 @@
* message header.
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_READMESSAGEHEADER_ENTRY );
+ LOG_FUNC
+
iState = EWaitingForHeader;
+
iLdd.ReadPacket(iStatus, EEndpoint0, iMessageHeader, KUsbRequestHdrSize);
SetActive();
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_READMESSAGEHEADER_EXIT );
}
void CCdcControlInterfaceReader::ReadMessageData(TUint aLength)
@@ -421,14 +399,14 @@
* @param aLength Length of data to read.
*/
{
- OstTraceFunctionEntry0( CCDCCONTROLINTERFACEREADER_READMESSAGEDATA_ENTRY );
- OstTrace1( TRACE_NORMAL, CCDCCONTROLINTERFACEREADER_READMESSAGEDATA,
- "CCdcControlInterfaceReader::ReadMessageData;\tqueuing read, length = %d", (TInt)aLength );
+ LOG_FUNC
+
+ LOGTEXT2(_L8("\tqueuing read, length = %d"),aLength);
iState = EWaitingForData;
+
iLdd.Read(iStatus, EEndpoint0, iMessageData, static_cast<TInt>(aLength));
SetActive();
- OstTraceFunctionExit0( CCDCCONTROLINTERFACEREADER_READMESSAGEDATA_EXIT );
}
//