kerneltest/e32test/usb/t_usb_device/src/activedevicestatenotifier.cpp
changeset 259 57b9594f5772
parent 247 d8d70de2bd36
--- a/kerneltest/e32test/usb/t_usb_device/src/activedevicestatenotifier.cpp	Wed Aug 18 11:08:29 2010 +0300
+++ b/kerneltest/e32test/usb/t_usb_device/src/activedevicestatenotifier.cpp	Thu Sep 02 21:54:16 2010 +0300
@@ -14,13 +14,17 @@
 // e32test/usb/t_usb_device/src/activestatenotifier.cpp
 // USB Test Program T_USB_DEVICE, functional part.
 // Device-side part, to work against T_USB_HOST running on the host.
-// 
+//
 //
 
 #include "general.h"
 #include "activerw.h"									// CActiveRW
 #include "config.h"
 #include "activeControl.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "activedevicestatenotifierTraces.h"
+#endif
 #include "activedevicestatenotifier.h"
 
 extern CActiveControl* gActiveControl;
@@ -64,6 +68,10 @@
 CActiveDeviceStateNotifier::~CActiveDeviceStateNotifier()
 	{
 	TUSB_VERBOSE_PRINT("CActiveDeviceStateNotifier::~CActiveDeviceStateNotifier()");
+	if(gVerbose)
+	    {
+	    OstTrace0(TRACE_VERBOSE, CACTIVEDEVICESTATENOTIFIER_DCACTIVEDEVICESTATENOTIFIER, "CActiveDeviceStateNotifier::~CActiveDeviceStateNotifier()");
+	    }
 	Cancel();												// base class
 	}
 
@@ -71,6 +79,10 @@
 void CActiveDeviceStateNotifier::DoCancel()
 	{
 	TUSB_VERBOSE_PRINT("CActiveDeviceStateNotifier::DoCancel()");
+	if(gVerbose)
+	    {
+	    OstTrace0(TRACE_VERBOSE, CACTIVEDEVICESTATENOTIFIER_DOCANCEL, "CActiveDeviceStateNotifier::DoCancel()");
+	    }
 	iPort->AlternateDeviceStatusNotifyCancel();
 	}
 
@@ -87,37 +99,50 @@
 		case EUsbcDeviceStateUndefined:
 #ifdef	USB_SC
 			TUSB_PRINT("Device State notifier: Undefined0");
+			OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL, "Device State notifier: Undefined0");
 			for (TUint16 i =0; i < KMaxConcurrentTests; i++)
 				{
 				if (gRW[i])
 					{
 					TUSB_VERBOSE_PRINT2("ResetAltSetting index %d, LDD %x",i, gRW[i]->Ldd());
-					gRW[i]->Ldd()->ResetAltSetting();						
+					if(gVerbose)
+					    {
+					    OstTraceExt2(TRACE_VERBOSE, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP01, "ResetAltSetting index %u, LDD %x",(TUint32)i, (TUint32)gRW[i]->Ldd());
+					    }
+					gRW[i]->Ldd()->ResetAltSetting();
 					}
 				}
 #endif
 			TUSB_PRINT("Device State notifier: Undefined");
+			OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP02, "Device State notifier: Undefined");
 			break;
 		case EUsbcDeviceStateAttached:
 			TUSB_PRINT("Device State notifier: Attached");
+			OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP03, "Device State notifier: Attached");
 			break;
 		case EUsbcDeviceStatePowered:
 			TUSB_PRINT("Device State notifier: Powered");
+			OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP04, "Device State notifier: Powered");
 			break;
 		case EUsbcDeviceStateDefault:
 			TUSB_PRINT("Device State notifier: Default");
+			OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP05, "Device State notifier: Default");
 			break;
 		case EUsbcDeviceStateAddress:
 			TUSB_PRINT("Device State notifier: Address");
+			OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP06, "Device State notifier: Address");
 			break;
 		case EUsbcDeviceStateConfigured:
 			TUSB_PRINT("Device State notifier: Configured");
+			OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP07, "Device State notifier: Configured");
 			break;
 		case EUsbcDeviceStateSuspended:
 			TUSB_PRINT("Device State notifier: Suspended");
+			OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP08, "Device State notifier: Suspended");
 			break;
 		default:
 			TUSB_PRINT("Device State notifier: ***BAD***");
+			OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP09, "Device State notifier: ***BAD***");
 			}
 		}
 	else if (iDeviceState & KUsbAlternateSetting)
@@ -125,7 +150,9 @@
 		TUint8 altSetting = iDeviceState & ~KUsbAlternateSetting;
 		TUSB_PRINT2("Device State notifier: Alternate interface %d setting has changed: now %d",
 					iPortNumber, altSetting);
-					
+		OstTraceExt2(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP10, "Device State notifier: Alternate interface %u setting has changed: now %u",
+					(TUint32)iPortNumber, (TUint32)altSetting);
+
 		TUsbDeviceCaps dCaps;
 		iPort->DeviceCaps(dCaps);
 		TBool isResourceAllocationV2 = ((dCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != 0);
@@ -148,12 +175,12 @@
 							newIfPtr->iEpDoubleBuff[i-1] ? gActiveControl->AllocateDoubleBuffering(iPort,(TENDPOINTNUMBER)i) : gActiveControl->DeAllocateDoubleBuffering(iPort,(TENDPOINTNUMBER)i);
 							#endif
 							}
-						break;				
+						break;
 						}
 					}
 				}
-			}	
-						
+			}
+
 		if (gAltSettingOnNotify)
 			{
 			for (TUint16 i =0; i < KMaxConcurrentTests; i++)
@@ -161,7 +188,11 @@
 				if (gRW[i])
 					{
 					TUSB_VERBOSE_PRINT1("Resuming alternate Setting - activeRW index %d",i);
-					gRW[i]->ResumeAltSetting(altSetting);						
+					if(gVerbose)
+					    {
+					    OstTrace1(TRACE_VERBOSE, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP11, "Resuming alternate Setting - activeRW index %d",i);
+					    }
+					gRW[i]->ResumeAltSetting(altSetting);
 					}
 				}
 			}