--- a/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/src/Stub2CC.cpp Thu Jul 15 20:42:20 2010 +0300
+++ b/usbmgmt/usbmgrtest/t_usbmanager_suite/Stub2CC/src/Stub2CC.cpp Tue Aug 31 17:01:47 2010 +0300
@@ -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"
@@ -21,12 +21,10 @@
/**
@file
*/
-
-#include "Stub2CC.h"
#include <usb_std.h>
#include <es_ini.h>
#include <d32usbc.h>
-#include <usb/usblogger.h>
+#include "Stub2CC.h"
#ifdef __FLOG_ACTIVE
_LIT8(KLogComponent, "STUB2CC");
@@ -34,6 +32,11 @@
#include "usbmaninternalconstants.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "Stub2CCTraces.h"
+#endif
+
// Panic category
@@ -161,34 +164,39 @@
*/
void CUsbstub2ClassController::Start(TRequestStatus& aStatus)
{
- LOG_FUNC
-
+ OstTraceFunctionEntry0( CUSBSTUB2CLASSCONTROLLER_START_ENTRY );
+
aStatus = KRequestPending;
iReportStatus = &aStatus;
//If we are already started then just complete the request.
if (iState == EUsbServiceStarted)
{
User::RequestComplete(iReportStatus, KErrNone);
+ OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_START_EXIT );
return;
}
if (iFailToStart)
{
User::RequestComplete(iReportStatus, KErrGeneral);
+ OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_START_EXIT_DUP1 );
return;
}
iState = EUsbServiceStarting;
#ifndef __WINS__
TInt ret = iLdd.Open(0);
- LOGTEXT2(_L8("Open LDD, ret=%d"), ret);
+ OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_START,_L8("Open LDD, ret=%d"),ret);
ret = SetUpInterface();
- LOGTEXT2(_L8("SetUpInterface(), ret=%d"), ret);
+ OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_START_DUP1,
+ _L8("SetUpInterface(),ret=%d"),ret);
+
#endif
iTimer.After(iStatus, iStartDelay*1000); //convert from usec to msec
SetActive();
+ OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_START_EXIT_DUP2 );
}
/**
@@ -198,20 +206,21 @@
*/
void CUsbstub2ClassController::Stop(TRequestStatus& aStatus)
{
- LOG_FUNC
-
+ OstTraceFunctionEntry0( CUSBSTUB2CLASSCONTROLLER_STOP_ENTRY );
aStatus = KRequestPending;
iReportStatus = &aStatus;
//If we are already idle then just complete the request.
if (iState == EUsbServiceIdle)
{
User::RequestComplete(iReportStatus, KErrNone);
+ OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_STOP_EXIT );
return;
}
if (iFailToStop)
{
User::RequestComplete(iReportStatus, KErrGeneral);
+ OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_STOP_EXIT_DUP1 );
return;
}
@@ -223,6 +232,7 @@
iTimer.After(iStatus, iStopDelay*1000); //convert from usec to msec
SetActive();
+ OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_STOP_EXIT_DUP2 );
}
/**
@@ -232,10 +242,12 @@
*/
void CUsbstub2ClassController::GetDescriptorInfo(TUsbDescriptor& aDescriptorInfo) const
{
- LOG_FUNC
-
+ OstTraceFunctionEntry0( CUSBSTUB2CLASSCONTROLLER_GETDESCRIPTORINFO_ENTRY );
+
aDescriptorInfo.iLength = Kstub2DescriptorLength;
aDescriptorInfo.iNumInterfaces = Kstub2NumberOfInterfacesPerstub2Function;
+
+ OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_GETDESCRIPTORINFO_EXIT );
}
@@ -244,9 +256,14 @@
*/
void CUsbstub2ClassController::RunL()
{
- LOG_FUNC
-
- __ASSERT_DEBUG( iStatus == KErrNone, _USB_PANIC(Kstub2CcPanicCategory, EPanicUnexpectedStatus) );
+ OstTraceFunctionEntry0( CUSBSTUB2CLASSCONTROLLER_RUNL_ENTRY );
+
+ if(iStatus != KErrNone)
+ {
+ OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_RUNL,
+ "CUsbstub2ClassController::RunL panic with error %d", EPanicUnexpectedStatus);
+ __ASSERT_DEBUG(EFalse,User::Panic(Kstub2CcPanicCategory,EPanicUnexpectedStatus));
+ }
switch (iState)
{
case EUsbServiceStarting:
@@ -255,11 +272,14 @@
case EUsbServiceStopping:
iState = EUsbServiceIdle;
break;
- default:
- _USB_PANIC(Kstub2CcPanicCategory, EPanicUnexpectedState);
+ default:
+ OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_RUNL_DUP1,
+ "CUsbstub2ClassController::RunL panic with error %d", EPanicUnexpectedStatus);
+ User::Panic(Kstub2CcPanicCategory, EPanicUnexpectedState);
}
*iReportStatus = KErrNone;
User::RequestComplete(iReportStatus, iStatus.Int());
+ OstTraceFunctionExit0( CUSBSTUB2CLASSCONTROLLER_RUNL_EXIT );
}
/**
@@ -281,8 +301,10 @@
case EUsbServiceStopping:
iState = EUsbServiceStarted;
break;
- default:
- _USB_PANIC(Kstub2CcPanicCategory, EPanicUnexpectedState);
+ default:
+ OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_DOCANCEL,
+ "CUsbstub2ClassController::DoCancel panic with error %d", EPanicUnexpectedState );
+ User::Panic(Kstub2CcPanicCategory, EPanicUnexpectedState);
}
*iReportStatus = KErrNone;
User::RequestComplete(iReportStatus, KErrCancel);
@@ -297,7 +319,10 @@
*/
TInt CUsbstub2ClassController::RunError(TInt /*aError*/)
{
- __ASSERT_DEBUG( EFalse, _USB_PANIC(Kstub2CcPanicCategory, EUnusedFunction) );
+ OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_RUNERROR,
+ "CUsbstub2ClassController::RunError panic with error %d",
+ EUnusedFunction);
+ __ASSERT_DEBUG(EFalse,User::Panic(Kstub2CcPanicCategory, EUnusedFunction));
return KErrNone;
}
@@ -307,25 +332,33 @@
* endpoint and, if found, configuring the interface.
*/
{
- LOGTEXT(_L8(">>CCdcControlInterface::SetUpInterface"));
-
+ OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE,
+ _L8(">>CCdcControlInterface::SetUpInterface"));
+
TUsbDeviceCaps dCaps;
TInt ret = iLdd.DeviceCaps(dCaps);
- LOGTEXT(_L8("\tchecking result of DeviceCaps"));
+ OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP1,
+ _L8("\tchecking result of DeviceCaps"));
+
if ( ret )
{
- LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+ OstTrace1( TRACE_ERROR, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP2,
+ _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+
return ret;
}
const TUint KRequiredNumberOfEndpoints = 1; // in addition to endpoint 0.
const TUint totalEndpoints = static_cast<TUint>(dCaps().iTotalEndpoints);
- LOGTEXT2(_L8("\tiTotalEndpoints = %d"), totalEndpoints);
+ OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP3,
+ _L8("\tiTotalEndpoints = %d"), totalEndpoints );
+
if ( totalEndpoints < KRequiredNumberOfEndpoints )
{
- LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"),
- KErrGeneral);
+ OstTrace1( TRACE_ERROR, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP4,
+ _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), KErrGeneral);
+
return KErrGeneral;
}
@@ -333,10 +366,14 @@
TUsbcEndpointData data[KUsbcMaxEndpoints];
TPtr8 dataptr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
ret = iLdd.EndpointCaps(dataptr);
- LOGTEXT(_L8("\tchecking result of EndpointCaps"));
+ OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP5,
+ _L8("\tchecking result of EndpointCaps"));
+
if ( ret )
{
- LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+ OstTrace1( TRACE_ERROR, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP6,
+ _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+
return ret;
}
@@ -346,8 +383,13 @@
for ( TUint i = 0 ; i < totalEndpoints ; i++ )
{
const TUsbcEndpointCaps* caps = &data[i].iCaps;
- __ASSERT_DEBUG(caps,_USB_PANIC(Kstub2CcPanicCategory, EPanicUnexpectedStatus));
-
+ if(!caps)
+ {
+ OstTrace1( TRACE_FATAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP7,
+ "CUsbstub2ClassController::SetUpInterface panic with error %d",
+ EPanicUnexpectedStatus);
+ __ASSERT_DEBUG(EFalse,User::Panic(Kstub2CcPanicCategory,EPanicUnexpectedStatus));
+ }
if (data[i].iInUse)
{
continue;
@@ -372,11 +414,13 @@
break;
}
}
- LOGTEXT(_L8("\tchecking epFound"));
+ OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP8, _L8("\tchecking epFound"));
+
if ( !epFound )
{
- LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"),
- KErrGeneral);
+ OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP9,
+ _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), KErrGeneral);
+
return KErrGeneral;
}
@@ -388,11 +432,15 @@
ifc().iClass.iSubClassNum = 0x02; // Table 16- Abstract Control Model
ifc().iClass.iProtocolNum = 0x01; // Table 17- Hayes compatible
- LOGTEXT(_L8("\tabout to call SetInterface"));
+ OstTrace0( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP10,
+ _L8("\tabout to call SetInterface"));
+
// Zero effectively indicates that alternate interfaces are not used.
ret = iLdd.SetInterface(0, ifc);
- LOGTEXT2(_L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret);
+ OstTrace1( TRACE_NORMAL, CUSBSTUB2CLASSCONTROLLER_SETUPINTERFACE_DUP11,
+ _L8("<<CCdcControlInterface::SetUpInterface ret=%d"), ret );
+
return ret;
}