--- a/kerneltest/e32test/device/t_usbco2.cpp Thu Aug 19 11:14:22 2010 +0300
+++ b/kerneltest/e32test/device/t_usbco2.cpp Tue Aug 31 16:34:26 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
@@ -23,6 +23,10 @@
#include "t_usb.h" // CActiveConsole, CActiveRW
#include "t_usblib.h" // Helpers
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "t_usbco2Traces.h"
+#endif
_LIT(KUsbLddFilename, "eusbc"); // .ldd assumed - it's a filename
@@ -91,30 +95,36 @@
if (r != KErrNone && r != KErrAlreadyExists)
{
TUSB_PRINT1("Error %d on loading USB LDD", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL, "Error %d on loading USB LDD", r);
User::Leave(-1);
return;
}
TUSB_PRINT("Successfully loaded USB LDD");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP01, "Successfully loaded USB LDD");
// Open USB channel
r = iPort.Open(0);
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on opening USB port", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP02, "Error %d on opening USB port", r);
User::Leave(-1);
return;
}
TUSB_PRINT("Successfully opened USB port");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP03, "Successfully opened USB port");
// Create Reader/Writer active object
iRW = CActiveRW::NewL(iConsole, &iPort, iVerbose);
if (!iRW)
{
TUSB_PRINT("Failed to create reader/writer");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP04, "Failed to create reader/writer");
User::Leave(-1);
return;
}
TUSB_PRINT("Created reader/writer");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP05, "Created reader/writer");
// check for endpoint resource allocation v2 support
TUsbDeviceCaps d_caps;
@@ -122,6 +132,7 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on querying device capabilities", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP06, "Error %d on querying device capabilities", r);
User::Leave(-1);
return;
}
@@ -133,6 +144,7 @@
if (!(r == KErrNotSupported || r == KErrNone))
{
TUSB_PRINT1("Error %d while fetching OTG descriptor", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP07, "Error %d while fetching OTG descriptor", r);
User::Leave(-1);
return;
}
@@ -143,10 +155,12 @@
if (iOtg)
{
TUSB_PRINT("Running on OTG device: loading OTG driver");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP08, "Running on OTG device: loading OTG driver");
r = User::LoadLogicalDevice(KOtgdiLddFilename);
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on loading OTG LDD", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP09, "Error %d on loading OTG LDD", r);
User::Leave(-1);
return;
}
@@ -154,6 +168,7 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on opening OTG port", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP10, "Error %d on opening OTG port", r);
User::Leave(-1);
return;
}
@@ -161,6 +176,7 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on starting USB stack", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_CONSTRUCTL_DUP11, "Error %d on starting USB stack", r);
User::Leave(-1);
return;
}
@@ -175,15 +191,18 @@
if (r != KErrNone)
{
TUSB_PRINT1("Interface setup failed", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE, "Interface setup failed:%d", r);
return r;
}
TUSB_PRINT("Interface successfully set up");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE_DUP01, "Interface successfully set up");
// Change some descriptors to contain suitable values
r = SetupDescriptors();
if (r != KErrNone)
{
TUSB_PRINT1("Descriptor setup failed", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE_DUP02, "Descriptor setup failed:%d ", r);
return r;
}
@@ -192,6 +211,7 @@
if (!iDeviceStateNotifier)
{
TUSB_PRINT("Failed to create device state notifier");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE_DUP03, "Failed to create device state notifier");
return r;
}
iDeviceStateNotifier->Activate();
@@ -201,6 +221,7 @@
if (!iStallNotifier)
{
TUSB_PRINT("Failed to create stall notifier");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_SETUPINTERFACE_DUP04, "Failed to create stall notifier");
return r;
}
iStallNotifier->Activate();
@@ -212,6 +233,10 @@
CActiveConsole::~CActiveConsole()
{
TUSB_VERBOSE_PRINT("CActiveConsole::~CActiveConsole()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVECONSOLE_DCACTIVECONSOLE, "CActiveConsole::~CActiveConsole()");
+ }
Cancel(); // base class cancel -> calls our DoCancel
delete iRW; // destroy the reader/writer
delete iDeviceStateNotifier;
@@ -220,21 +245,25 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on string removal", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP01, "Error %d on string removal", r);
}
r = iPort.RemoveStringDescriptor(stridx2);
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on string removal", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP02, "Error %d on string removal", r);
}
if (iOtg)
{
TUSB_PRINT("Running on OTG device: unloading OTG driver");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP03, "Running on OTG device: unloading OTG driver");
iOtgPort.StopStacks();
iOtgPort.Close();
r = User::FreeLogicalDevice(RUsbOtgDriver::Name());
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on freeing OTG LDD", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP04, "Error %d on freeing OTG LDD", r);
}
}
iPort.Close(); // close USB channel
@@ -242,16 +271,22 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d during unloading USB LDD", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP05, "Error %d during unloading USB LDD", r);
User::Leave(-1);
return;
}
TUSB_PRINT("Successfully unloaded USB LDD");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_DCACTIVECONSOLE_DUP06, "Successfully unloaded USB LDD");
}
void CActiveConsole::DoCancel()
{
TUSB_VERBOSE_PRINT("CActiveConsole::DoCancel()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVECONSOLE_DOCANCEL, "CActiveConsole::DoCancel()");
+ }
iConsole->ReadCancel();
}
@@ -259,6 +294,10 @@
void CActiveConsole::RunL()
{
TUSB_VERBOSE_PRINT("CActiveConsole::RunL()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVECONSOLE_RUNL, "CActiveConsole::RunL()");
+ }
ProcessKeyPressL(static_cast<TChar>(iConsole->KeyCode()));
}
@@ -270,53 +309,87 @@
if (!iBufferSizeChosen)
{
iConsole->Printf(_L("\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER, "\n");
iConsole->Printf(_L("++++ Choose max. Transfer Size ++++\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP01, "++++ Choose max. Transfer Size ++++\n");
iConsole->Printf(_L(" '0' - Set up USB device for USBCV\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP02, " '0' - Set up USB device for USBCV\n");
iConsole->Printf(_L(" '1' - 32 bytes\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP03, " '1' - 32 bytes\n");
iConsole->Printf(_L(" '2' - 1024 bytes\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP04, " '2' - 1024 bytes\n");
iConsole->Printf(_L(" '3' - 64 kbytes\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP05, " '3' - 64 kbytes\n");
iConsole->Printf(_L(" '4' - 1 Mbyte\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP06, " '4' - 1 Mbyte\n");
}
else if (!iBandwidthPriorityChosen)
{
iConsole->Printf(_L("\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP07, "\n");
iConsole->Printf(_L("++++ Choose Bandwidth Priority ++++\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP08, "++++ Choose Bandwidth Priority ++++\n");
iConsole->Printf(_L(" '1' - Economical buffering - default\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP09, " '1' - Economical buffering - default\n");
iConsole->Printf(_L(" '2' - More memory than default buffering - Plus1\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP10, " '2' - More memory than default buffering - Plus1\n");
iConsole->Printf(_L(" '3' - More memory than Plus1 buffering - Plus2\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP11, " '3' - More memory than Plus1 buffering - Plus2\n");
iConsole->Printf(_L(" '4' - Maximum buffering\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP12, " '4' - Maximum buffering\n");
}
else if (!iDMAChosen)
{
iConsole->Printf(_L("\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP13, "\n");
iConsole->Printf(_L("++++ Choose Endpoint I/O Transfer Mode ++++\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP14, "++++ Choose Endpoint I/O Transfer Mode ++++\n");
iConsole->Printf(_L(" '1' - Interrupt Mode\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP15, " '1' - Interrupt Mode\n");
iConsole->Printf(_L(" '2' - DMA Mode (recommended)\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP16, " '2' - DMA Mode (recommended\n");
}
else if (!iDoubleBufferingChosen)
{
iConsole->Printf(_L("\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP17, "\n");
iConsole->Printf(_L("++++ Choose Endpoint FIFO Mode ++++\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP18, "++++ Choose Endpoint FIFO Mode ++++\n");
iConsole->Printf(_L(" '1' - Normal Buffering Mode\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP19, " '1' - Normal Buffering Mode\n");
iConsole->Printf(_L(" '2' - Double Buffering Mode (recommended)\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP20, " '2' - Double Buffering Mode (recommended\n");
}
else
{
iConsole->Printf(_L("\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP21, "\n");
iConsole->Printf(_L("++++ Select Program Option ++++\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP22, "++++ Select Program Option ++++\n");
iConsole->Printf(_L(" 'L'oop test\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP23, " 'L'oop test\n");
iConsole->Printf(_L(" Loop test with data 'C'ompare\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP24, " Loop test with data 'C'ompare\n");
iConsole->Printf(_L(" 'R'eceive-only test (we receive, host transmits)\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP25, " 'R'eceive-only test (we receive, host transmits\n");
iConsole->Printf(_L(" 'T'ransmit-only test\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP26, " 'T'ransmit-only test\n");
iConsole->Printf(_L(" Receive and 'P'ut (write) to File\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP27, " Receive and 'P'ut (writeto File\n");
iConsole->Printf(_L(" Transmit and 'G'et (read) from File\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP28, " Transmit and 'G'et (readfrom File\n");
iConsole->Printf(_L(" Signal Remote-'W'akeup to the host\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP29, " Signal Remote-'W'akeup to the host\n");
iConsole->Printf(_L(" 'S'top current transfer\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP30, " 'S'top current transfer\n");
#ifdef WITH_DUMP_OPTION
iConsole->Printf(_L(" 'D'ump USB regs to debugout\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP31, " 'D'ump USB regs to debugout\n");
#endif
iConsole->Printf(_L(" Re'E'numerate device\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP32, " Re'E'numerate device\n");
iConsole->Printf(_L(" 'Q'uit this app\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REQUESTCHARACTER_DUP33, " 'Q'uit this app\n");
}
iConsole->Read(iStatus);
SetActive();
@@ -327,7 +400,7 @@
{
if (aChar == EKeyEscape)
{
- RDebug::Print(_L("CActiveConsole: ESC key pressed -> stopping active scheduler..."));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL, "CActiveConsole: ESC key pressed -> stopping active scheduler...");
CActiveScheduler::Stop();
return;
}
@@ -355,9 +428,11 @@
break;
default:
TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint());
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP01, "Not a valid input character: %c", aChar.operator TUint());
goto request_char;
}
TUSB_PRINT1("Maximum buffer size set to %d bytes", iRW->MaxBufSize());
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP02, "Maximum buffer size set to %d bytes", iRW->MaxBufSize());
iBufferSizeChosen = ETrue;
}
else if (!iBandwidthPriorityChosen)
@@ -368,33 +443,41 @@
case '1':
iBandwidthPriority = EUsbcBandwidthOUTDefault | EUsbcBandwidthINDefault;
TUSB_PRINT("Bandwith priority set to default");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP03, "Bandwith priority set to default");
break;
case '2':
iBandwidthPriority = EUsbcBandwidthOUTPlus1 | EUsbcBandwidthINPlus1;
TUSB_PRINT("Bandwith priority set to Plus1");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP04, "Bandwith priority set to Plus1");
break;
case '3':
iBandwidthPriority = EUsbcBandwidthOUTPlus2 | EUsbcBandwidthINPlus2;
TUSB_PRINT("Bandwith priority set to Plus2");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP05, "Bandwith priority set to Plus2");
break;
case '4':
iBandwidthPriority = EUsbcBandwidthINMaximum | EUsbcBandwidthOUTMaximum;
TUSB_PRINT("Bandwith priority set to maximum");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP06, "Bandwith priority set to maximum");
break;
default:
TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint());
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP07, "Not a valid input character: %c", aChar.operator TUint());
goto request_char;
}
TUSB_PRINT1("(Set to 0x%08X)", iBandwidthPriority);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP08, "(Set to 0x%08X)", iBandwidthPriority);
iBandwidthPriorityChosen = ETrue;
if (!iResourceAllocationV2)
{
TUSB_PRINT("Configuring interface...");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP09, "Configuring interface...");
TInt r = SetupInterface();
if (r != KErrNone)
{
TUSB_PRINT1("Error: %d. Stopping active scheduler...", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP10, "Error: %d. Stopping active scheduler...", r);
CActiveScheduler::Stop();
return;
}
@@ -408,6 +491,7 @@
case '1':
{
TUSB_PRINT("- Trying to deallocate endpoint DMA:\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP11, "- Trying to deallocate endpoint DMA:\n");
if (!iResourceAllocationV2)
{
DeAllocateEndpointDMA(EEndpoint1);
@@ -419,6 +503,7 @@
case '2':
{
TUSB_PRINT("- Trying to allocate endpoint DMA:\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP12, "- Trying to allocate endpoint DMA:\n");
if (!iResourceAllocationV2)
{
AllocateEndpointDMA(EEndpoint1);
@@ -429,6 +514,7 @@
}
default:
TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint());
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP13, "Not a valid input character: %c", aChar.operator TUint());
goto request_char;
}
iDMAChosen = ETrue;
@@ -441,6 +527,7 @@
case '1':
{
TUSB_PRINT("- Trying to deallocate Double Buffering:\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP14, "- Trying to deallocate Double Buffering:\n");
if (!iResourceAllocationV2)
{
DeAllocateDoubleBuffering(EEndpoint1);
@@ -452,6 +539,7 @@
case '2':
{
TUSB_PRINT("- Trying to allocate Double Buffering:\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP15, "- Trying to allocate Double Buffering:\n");
if (!iResourceAllocationV2)
{
AllocateDoubleBuffering(EEndpoint1);
@@ -462,6 +550,7 @@
}
default:
TUSB_PRINT1("Not a valid input character: %c", aChar.operator TUint());
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP16, "Not a valid input character: %c", aChar.operator TUint());
goto request_char;
}
iDoubleBufferingChosen = ETrue;
@@ -469,10 +558,12 @@
if (iResourceAllocationV2)
{
TUSB_PRINT("Configuring interface...");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP17, "Configuring interface...");
TInt r = SetupInterface();
if (r != KErrNone)
{
TUSB_PRINT1("Error: %d. Stopping active scheduler...", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP18, "Error: %d. Stopping active scheduler...", r);
CActiveScheduler::Stop();
return;
}
@@ -480,14 +571,17 @@
// Everything chosen, so let's re-enumerate...
TUSB_PRINT("Enumeration...");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP19, "Enumeration...");
TInt r = ReEnumerate();
if (r != KErrNone)
{
TUSB_PRINT1("Error: %d. Stopping active scheduler...", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP20, "Error: %d. Stopping active scheduler...", r);
CActiveScheduler::Stop();
return;
}
TUSB_PRINT("Device successfully re-enumerated\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP21, "Device successfully re-enumerated\n");
// Make sure program versions match if testing against USBRFLCT
if (iRW->MaxBufSize() != 0)
@@ -496,6 +590,7 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error: %d. Stopping active scheduler...", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP22, "Error: %d. Stopping active scheduler...", r);
CActiveScheduler::Stop();
return;
}
@@ -509,30 +604,35 @@
case 'l': // start loop test
case 'L':
TUSB_PRINT("-> Loop test selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP23, "-> Loop test selected\n");
iRW->SetTransferMode(ELoop);
iRW->SendPreamble();
break;
case 'c': // start loop/compare test
case 'C':
TUSB_PRINT("-> Loop test with compare selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP24, "-> Loop test with compare selected\n");
iRW->SetTransferMode(ELoopComp);
iRW->SendPreamble();
break;
case 'r': // start receive-only test
case 'R':
TUSB_PRINT("-> Receive-only test selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP25, "-> Receive-only test selected\n");
iRW->SetTransferMode(EReceiveOnly);
iRW->SendPreamble();
break;
case 't': // start transmit-only test
case 'T':
TUSB_PRINT("-> Transmit-only test selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP26, "-> Transmit-only test selected\n");
iRW->SetTransferMode(ETransmitOnly);
iRW->SendPreamble();
break;
case 'g': // start transmit & get-from-file test
case 'G':
TUSB_PRINT("-> Transmit from file test selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP27, "-> Transmit from file test selected\n");
iRW->SetTransferMode(ETransmitOnly);
iRW->ReadFromDisk(ETrue);
iRW->SendPreamble();
@@ -540,6 +640,7 @@
case 'p': // start receive & put-to-file test
case 'P':
TUSB_PRINT("-> Receive to file test selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP28, "-> Receive to file test selected\n");
iRW->SetTransferMode(EReceiveOnly);
iRW->WriteToDisk(ETrue);
iRW->SendPreamble();
@@ -547,17 +648,20 @@
case 'w': // remote-wakeup
case 'W':
TUSB_PRINT("-> Signal Remote-wakeup selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP29, "-> Signal Remote-wakeup selected\n");
iPort.SignalRemoteWakeup();
break;
case 's': // stop either
case 'S':
TUSB_PRINT("-> Stop transfer selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP30, "-> Stop transfer selected\n");
iRW->Stop();
break;
#ifdef WITH_DUMP_OPTION
case 'd': // dump controller registers
case 'D':
TUSB_PRINT("-> Dump option selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP31, "-> Dump option selected\n");
iPort.DumpRegisters();
QueryRxBuffer();
break;
@@ -565,16 +669,23 @@
case 'e': // ReEnumerate()
case 'E':
TUSB_PRINT("-> Re-enumerate device selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP32, "-> Re-enumerate device selected\n");
ReEnumerate();
break;
case 'q': // quit
case 'Q':
TUSB_PRINT("-> Quit program selected\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP33, "-> Quit program selected\n");
TUSB_VERBOSE_PRINT("CActiveConsole: stopping active scheduler...");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP34, "CActiveConsole: stopping active scheduler...");
+ }
CActiveScheduler::Stop();
return;
default:
TUSB_PRINT1("-> Not a valid input character: %c", aChar.operator TUint());
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_PROCESSKEYPRESSL_DUP35, "-> Not a valid input character: %c", aChar.operator TUint());
goto request_char;
}
}
@@ -592,11 +703,11 @@
TInt r = iPort.QueryReceiveBuffer(EEndpoint2, bytes);
if (r != KErrNone)
{
- RDebug::Print(_L(" Error %d on querying read buffer\n"), r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYRXBUFFER, " Error %d on querying read buffer\n", r);
}
else
{
- RDebug::Print(_L(" %d bytes in RX buffer\n"), bytes);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYRXBUFFER_DUP01, " %d bytes in RX buffer\n", bytes);
}
}
#endif
@@ -637,35 +748,56 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on querying device capabilities", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL, "Error %d on querying device capabilities", r);
return KErrGeneral;
}
const TInt n = d_caps().iTotalEndpoints;
TUSB_PRINT("### USB device capabilities:");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP01, "### USB device capabilities:");
TUSB_PRINT1("Number of endpoints: %d", n);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP02, "Number of endpoints: %d", n);
TUSB_PRINT1("Supports Software-Connect: %s",
d_caps().iConnect ? _S("yes") : _S("no"));
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP03, "Supports Software-Connect: %s",
+ d_caps().iConnect ? _L("yes") : _L("no"));
TUSB_PRINT1("Device is Self-Powered: %s",
d_caps().iSelfPowered ? _S("yes") : _S("no"));
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP04, "Device is Self-Powered: %s",
+ d_caps().iSelfPowered ? _L("yes") : _L("no"));
TUSB_PRINT1("Supports Remote-Wakeup: %s",
d_caps().iRemoteWakeup ? _S("yes") : _S("no"));
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP05, "Supports Remote-Wakeup: %s",
+ d_caps().iRemoteWakeup ? _L("yes") : _L("no"));
TUSB_PRINT1("Supports High-speed: %s",
d_caps().iHighSpeed ? _S("yes") : _S("no"));
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP06, "Supports High-speed: %s",
+ d_caps().iHighSpeed ? _L("yes") : _L("no"));
TUSB_PRINT1("Supports OTG: %s",
iOtg ? _S("yes") : _S("no"));
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP07, "Supports OTG: %s",
+ iOtg ? _L("yes") : _L("no"));
TUSB_PRINT1("Supports unpowered cable detection: %s",
(d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ?
_S("yes") : _S("no"));
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP08, "Supports unpowered cable detection: %s",
+ (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ?
+ _L("yes") : _L("no"));
TUSB_PRINT1("Supports endpoint resource alloc scheme V2: %s\n",
(d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ?
_S("yes") : _S("no"));
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP09, "Supports endpoint resource alloc scheme V2: %s\n",
+ (d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) ?
+ _L("yes") : _L("no"));
TUSB_PRINT("");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP10, "");
iSoftwareConnect = d_caps().iConnect; // we need to remember this
if (n < 2)
{
TUSB_PRINT1("Error: only %d endpoints available on device", n);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP11, "Error: only %d endpoints available on device", n);
return KErrGeneral;
}
@@ -676,16 +808,21 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on querying endpoint capabilities", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP12, "Error %d on querying endpoint capabilities", r);
return KErrGeneral;
}
TUSB_PRINT("### USB device endpoint capabilities:");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP13, "### USB device endpoint capabilities:");
for (TInt i = 0; i < n; i++)
{
const TUsbcEndpointCaps* caps = &data[i].iCaps;
TUSB_PRINT2("Endpoint: SizeMask = 0x%08x TypeDirMask = 0x%08x",
caps->iSizes, caps->iTypesAndDir);
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP14, "Endpoint: SizeMask = 0x%08x TypeDirMask = 0x%08x",
+ caps->iSizes, caps->iTypesAndDir);
}
TUSB_PRINT("");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP15, "");
// Set up the active interface
TUsbcInterfaceInfoBuf ifc;
@@ -703,6 +840,7 @@
if (!(mps == 64 || mps == 512))
{
TUSB_PRINT1("Funny Bulk IN MaxPacketSize: %d - T_USB will probably fail...", mps);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP16, "Funny Bulk IN MaxPacketSize: %d - T_USB will probably fail...", mps);
}
// EEndpoint1 is going to be our Tx (IN) endpoint
ifc().iEndpointData[0].iType = KUsbEpTypeBulk;
@@ -719,6 +857,7 @@
if (!(mps == 64 || mps == 512))
{
TUSB_PRINT1("Funny Bulk OUT MaxPacketSize: %d - T_USB will probably fail...", mps);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP17, "Funny Bulk OUT MaxPacketSize: %d - T_USB will probably fail...", mps);
}
// EEndpoint2 is going to be our Rx (OUT) endpoint
ifc().iEndpointData[1].iType = KUsbEpTypeBulk;
@@ -732,6 +871,7 @@
if (ep_found != 2)
{
TUSB_PRINT1("No suitable endpoints found", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP18, "No suitable endpoints found:%d", r);
return KErrGeneral;
}
@@ -759,6 +899,7 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on setting active interface", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP19, "Error %d on setting active interface", r);
}
// Find ep's for an alternate ifc setting.
@@ -766,6 +907,7 @@
if (!SupportsAlternateInterfaces())
{
TUSB_PRINT("Alternate Interfaces not supported - skipping alternate setting setup\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP20, "Alternate Interfaces not supported - skipping alternate setting setup\n");
return KErrNone;
}
ep_found = 0;
@@ -834,6 +976,7 @@
if (ep_found == 0)
{
TUSB_PRINT("Not enough suitable endpoints found for alt ifc");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP21, "Not enough suitable endpoints found for alt ifc");
// not a disaster though
return KErrNone;
}
@@ -850,6 +993,7 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on setting alternate interface", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_QUERYUSBCLIENTL_DUP22, "Error %d on setting alternate interface", r);
}
return r;
@@ -860,22 +1004,24 @@
{
TInt r = iPort.AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA);
if (r == KErrNone)
- RDebug::Print(_L("DMA allocation on endpoint %d: KErrNone"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA, "DMA allocation on endpoint %d: KErrNone", aEndpoint);
else if (r == KErrInUse)
- RDebug::Print(_L("DMA allocation on endpoint %d: KErrInUse"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP01, "DMA allocation on endpoint %d: KErrInUse", aEndpoint);
else if (r == KErrNotSupported)
- RDebug::Print(_L("DMA allocation on endpoint %d: KErrNotSupported"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP02, "DMA allocation on endpoint %d: KErrNotSupported", aEndpoint);
else
- RDebug::Print(_L("DMA allocation on endpoint %d: unexpected return value %d"),
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP03, "DMA allocation on endpoint %d: unexpected return value %d",
aEndpoint, r);
TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA);
TUSB_PRINT2("DMA on endpoint %d %s\n",
aEndpoint, res ? _S("allocated") : _S("not allocated"));
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP04, "DMA on endpoint %d %s\n",
+ aEndpoint, res ? _L("allocated") : _L("not allocated"));
if ((r == KErrNone) && !res)
- RDebug::Print(_L("(Allocation success but negative query result: contradiction!)\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP05, "(Allocation success but negative query result: contradiction!)\n");
else if ((r != KErrNone) && res)
- RDebug::Print(_L("(Allocation failure but positive query result: contradiction!)\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEENDPOINTDMA_DUP06, "(Allocation failure but positive query result: contradiction!)\n");
}
@@ -883,15 +1029,17 @@
{
TInt r = iPort.DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDMA);
if (r == KErrNone)
- RDebug::Print(_L("DMA deallocation on endpoint %d: KErrNone"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEENDPOINTDMA, "DMA deallocation on endpoint %d: KErrNone", aEndpoint);
else if (r == KErrNotSupported)
- RDebug::Print(_L("DMA deallocation on endpoint %d: KErrNotSupported"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEENDPOINTDMA_DUP01, "DMA deallocation on endpoint %d: KErrNotSupported", aEndpoint);
else
- RDebug::Print(_L("DMA deallocation on endpoint %d: unexpected return value %d"),
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEENDPOINTDMA_DUP02, "DMA deallocation on endpoint %d: unexpected return value %d",
aEndpoint, r);
TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDMA);
TUSB_PRINT2("DMA on endpoint %d %s\n",
aEndpoint, res ? _S("allocated") : _S("not allocated"));
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEENDPOINTDMA_DUP03, "DMA on endpoint %d %s\n",
+ aEndpoint, res ? _L("allocated") : _L("not allocated"));
}
@@ -899,22 +1047,24 @@
{
TInt r = iPort.AllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering);
if (r == KErrNone)
- RDebug::Print(_L("Double Buffering allocation on endpoint %d: KErrNone"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING, "Double Buffering allocation on endpoint %d: KErrNone", aEndpoint);
else if (r == KErrInUse)
- RDebug::Print(_L("Double Buffering allocation on endpoint %d: KErrInUse"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP01, "Double Buffering allocation on endpoint %d: KErrInUse", aEndpoint);
else if (r == KErrNotSupported)
- RDebug::Print(_L("Double Buffering allocation on endpoint %d: KErrNotSupported"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP02, "Double Buffering allocation on endpoint %d: KErrNotSupported", aEndpoint);
else
- RDebug::Print(_L("Double Buffering allocation on endpoint %d: unexpected return value %d"),
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP03, "Double Buffering allocation on endpoint %d: unexpected return value %d",
aEndpoint, r);
TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering);
TUSB_PRINT2("Double Buffering on endpoint %d %s\n",
aEndpoint, res ? _S("allocated") : _S("not allocated"));
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP04, "Double Buffering on endpoint %d %s\n",
+ aEndpoint, res ? _L("allocated") : _L("not allocated"));
if ((r == KErrNone) && !res)
- RDebug::Print(_L("(Allocation success but negative query result: contradiction!)\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP05, "(Allocation success but negative query result: contradiction!)\n");
else if ((r != KErrNone) && res)
- RDebug::Print(_L("(Allocation failure but positive query result: contradiction!)\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_ALLOCATEDOUBLEBUFFERING_DUP06, "(Allocation failure but positive query result: contradiction!)\n");
}
@@ -922,15 +1072,17 @@
{
TInt r = iPort.DeAllocateEndpointResource(aEndpoint, EUsbcEndpointResourceDoubleBuffering);
if (r == KErrNone)
- RDebug::Print(_L("Double Buffering deallocation on endpoint %d: KErrNone"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEDOUBLEBUFFERING, "Double Buffering deallocation on endpoint %d: KErrNone", aEndpoint);
else if (r == KErrNotSupported)
- RDebug::Print(_L("Double Buffering deallocation on endpoint %d: KErrNotSupported"), aEndpoint);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEDOUBLEBUFFERING_DUP01, "Double Buffering deallocation on endpoint %d: KErrNotSupported", aEndpoint);
else
- RDebug::Print(_L("Double Buffering deallocation on endpoint %d: unexpected return value %d"),
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEDOUBLEBUFFERING_DUP02, "Double Buffering deallocation on endpoint %d: unexpected return value %d",
aEndpoint, r);
TBool res = iPort.QueryEndpointResourceUse(aEndpoint, EUsbcEndpointResourceDoubleBuffering);
TUSB_PRINT2("Double Buffering on endpoint %d %s\n",
aEndpoint, res ? _S("allocated") : _S("not allocated"));
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_DEALLOCATEDOUBLEBUFFERING_DUP03, "Double Buffering on endpoint %d %s\n",
+ aEndpoint, res ? _L("allocated") : _L("not allocated"));
}
@@ -941,15 +1093,21 @@
if (!iSoftwareConnect)
{
iConsole->Printf(_L("This device does not support software\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE, "This device does not support software\n");
iConsole->Printf(_L("disconnect/reconnect\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP01, "disconnect/reconnect\n");
iConsole->Printf(_L("Please physically unplug and replug\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP02, "Please physically unplug and replug\n");
iConsole->Printf(_L("the USB cable NOW... "));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP03, "the USB cable NOW... ");
}
iConsole->Printf(_L("\n>>> START THE USBRFLCT PROGRAM ON THE HOST SIDE NOW <<<\n"));
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP04, "\n>>> START THE USBRFLCT PROGRAM ON THE HOST SIDE NOW <<<\n");
User::WaitForRequest(enum_status);
if (enum_status != KErrNone)
{
TUSB_PRINT1("Error: Re-enumeration status = %d", enum_status.Int());
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP05, "Error: Re-enumeration status = %d", enum_status.Int());
return KErrGeneral;
}
TUsbcDeviceState device_state = EUsbcDeviceStateUndefined;
@@ -957,6 +1115,7 @@
if (r != KErrNone)
{
TUSB_PRINT1("Error %d on querying device state", r);
+ OstTrace1(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP06, "Error %d on querying device state", r);
}
else
{
@@ -969,6 +1128,15 @@
((device_state == EUsbcDeviceStateConfigured) ? _S("Configured") :
((device_state == EUsbcDeviceStateSuspended) ? _S("Suspended") :
_S("Unknown"))))))));
+ OstTraceExt1(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP07, "Current device state: %s",
+ (device_state == EUsbcDeviceStateUndefined) ? _L("Undefined") :
+ ((device_state == EUsbcDeviceStateAttached) ? _L("Attached") :
+ ((device_state == EUsbcDeviceStatePowered) ? _L("Powered") :
+ ((device_state == EUsbcDeviceStateDefault) ? _L("Default") :
+ ((device_state == EUsbcDeviceStateAddress) ? _L("Address") :
+ ((device_state == EUsbcDeviceStateConfigured) ? _L("Configured") :
+ ((device_state == EUsbcDeviceStateSuspended) ? _L("Suspended") :
+ _L("Unknown"))))))));
}
// Check the speed of the established physical USB connection
@@ -976,12 +1144,14 @@
if (iHighSpeed)
{
TUSB_PRINT("---> USB High-speed Testing\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP08, "---> USB High-speed Testing\n");
// It can only be 512 bytes when using high-speed.
iRW->SetMaxPacketSize(512); // iRW already exists at this point
}
else
{
TUSB_PRINT("---> USB Full-speed Testing\n");
+ OstTrace0(TRACE_NORMAL, CACTIVECONSOLE_REENUMERATE_DUP09, "---> USB Full-speed Testing\n");
// We only support 64 bytes when using full-speed.
iRW->SetMaxPacketSize(64); // iRW already exists at this point
}
@@ -1044,6 +1214,12 @@
(deviceDescriptor[KUsbDevReleaseOffset + 1] & 0x0f),
((deviceDescriptor[KUsbDevReleaseOffset] >> 4) & 0x0f),
(deviceDescriptor[KUsbDevReleaseOffset] & 0x0f));
+ OstTraceExt2(TRACE_NORMAL, CACTIVECONSOLE_SETUPDESCRIPTORS, "\nVID = 0x%04X / PID = 0x%04X / ", Vid, Pid);
+ OstTraceExt4(TRACE_NORMAL, CACTIVECONSOLE_SETUPDESCRIPTORS_DUP01, "DevRel = %d%d.%d%d\n",
+ ((deviceDescriptor[KUsbDevReleaseOffset + 1] >> 4) & 0x0f),
+ (deviceDescriptor[KUsbDevReleaseOffset + 1] & 0x0f),
+ ((deviceDescriptor[KUsbDevReleaseOffset] >> 4) & 0x0f),
+ (deviceDescriptor[KUsbDevReleaseOffset] & 0x0f));
// === Configuration Descriptor
@@ -1101,6 +1277,10 @@
iVerbose(aVerboseOutput)
{
TUSB_VERBOSE_PRINT("CActiveRW::CActiveRW()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_CACTIVERW, "CActiveRW::CActiveRW()");
+ }
}
@@ -1118,6 +1298,10 @@
void CActiveRW::ConstructL()
{
TUSB_VERBOSE_PRINT("CActiveRW::ConstructL()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_CONSTRUCTL, "CActiveRW::ConstructL()");
+ }
User::LeaveIfError(iFs.Connect());
@@ -1140,6 +1324,7 @@
if (!iTimeoutTimer)
{
TUSB_PRINT("Failed to create timeout timer");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_CONSTRUCTL_DUP01, "Failed to create timeout timer");
}
}
@@ -1147,6 +1332,10 @@
CActiveRW::~CActiveRW()
{
TUSB_VERBOSE_PRINT("CActiveRW::~CActiveRW()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_DCACTIVERW, "CActiveRW::~CActiveRW()");
+ }
Cancel(); // base class
delete iTimeoutTimer;
iFile.Close();
@@ -1159,6 +1348,7 @@
if (aBufSz > KMaxBufSize)
{
TUSB_PRINT2("SetMaxBufSize(): too large: %d! (using %d)", aBufSz, KMaxBufSize);
+ OstTraceExt2(TRACE_NORMAL, CACTIVERW_SETMAXBUFSIZE, "SetMaxBufSize(): too large: %d! (using %d)", aBufSz, KMaxBufSize);
aBufSz = KMaxBufSize;
}
iMaxBufSz = aBufSz;
@@ -1191,13 +1381,19 @@
void CActiveRW::RunL()
{
TUSB_VERBOSE_PRINT("CActiveRW::RunL()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_RUNL, "CActiveRW::RunL()");
+ }
if (iStatus != KErrNone)
{
TUSB_PRINT1("Error %d in RunL", iStatus.Int());
+ OstTrace1(TRACE_NORMAL, CACTIVERW_RUNL_DUP01, "Error %d in RunL", iStatus.Int());
}
if (iDoStop)
{
TUSB_PRINT("Stopped");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RUNL_DUP02, "Stopped");
iDoStop = EFalse;
return;
}
@@ -1222,6 +1418,7 @@
if (num != ++iPktNum)
{
TUSB_PRINT2("*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum);
+ OstTraceExt2(TRACE_NORMAL, CACTIVERW_RUNL_DUP03, "*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum);
// Update the packet number with the received number, so that
// if a single packet is duplicated or lost then a single error occurs
iPktNum = num;
@@ -1231,6 +1428,11 @@
// Write out to disk previous completed Read
TUSB_VERBOSE_PRINT2("iMaxBufSz = %d (iReadBuf.Size(): %d)",
iMaxBufSz, iReadBuf.Size());
+ if(iVerbose)
+ {
+ OstTraceExt2(TRACE_VERBOSE, CACTIVERW_RUNL_DUP04, "iMaxBufSz = %d (iReadBuf.Size(): %d)",
+ iMaxBufSz, iReadBuf.Size());
+ }
WriteBufferToDisk(iReadBuf, iMaxBufSz);
}
ReadData(); // next we read data
@@ -1241,6 +1443,7 @@
if (!CompareBuffers(iBufSz))
{
TUSB_PRINT1("Error while comparing tx & rx buffers for packet 0x%x", iPktNum);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_RUNL_DUP05, "Error while comparing tx & rx buffers for packet 0x%x", iPktNum);
}
}
else if (iBufSz > 3)
@@ -1249,6 +1452,7 @@
if (num != iPktNum)
{
TUSB_PRINT2("*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum);
+ OstTraceExt2(TRACE_NORMAL, CACTIVERW_RUNL_DUP06, "*** rcv'd wrong pkt number: 0x%x (expected: 0x%x)", num, iPktNum);
}
}
if (iBufSz == iMaxBufSz)
@@ -1263,6 +1467,7 @@
break;
default:
TUSB_PRINT("Oops. (Shouldn't end up here...)");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RUNL_DUP07, "Oops. (Shouldn't end up here...)");
break;
}
return;
@@ -1272,15 +1477,21 @@
TInt CActiveRW::SendVersion()
{
TUSB_VERBOSE_PRINT("CActiveRW::SendVersion()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_SENDVERSION, "CActiveRW::SendVersion()");
+ }
if (iXferMode != ::ENone)
{
TUSB_PRINT1("Error : wrong state: %d", iXferMode);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_SENDVERSION_DUP01, "Error : wrong state: %d", iXferMode);
return KErrGeneral;
}
// Here we send our version packet to the host.
// (We can use the preamble buffer because we only need it
// once and that's also before the preamble uses.)
TUSB_PRINT1("Sending T_USB version: %d\n", KTusbVersion);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_SENDVERSION_DUP02, "Sending T_USB version: %d\n", KTusbVersion);
iPreambleBuf.FillZ();
*reinterpret_cast<TUint32*>(&iPreambleBuf[0]) = SWAP_BYTES_32(KTusbVersion);
// A 'magic' string so that USBRFLCT doesn't interpret the first 4 bytes
@@ -1292,8 +1503,16 @@
TRequestStatus send_status;
iPort->Write(send_status, EEndpoint1, iPreambleBuf, KPreambleLength);
TUSB_VERBOSE_PRINT("Waiting for write request to complete...");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_SENDVERSION_DUP03, "Waiting for write request to complete...");
+ }
User::WaitForRequest(send_status);
TUSB_VERBOSE_PRINT("...done.\n");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_SENDVERSION_DUP04, "...done.\n");
+ }
return send_status.Int();
}
@@ -1301,50 +1520,87 @@
TInt CActiveRW::ReceiveVersion()
{
TUSB_VERBOSE_PRINT("CActiveRW::ReceiveVersion()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_RECEIVEVERSION, "CActiveRW::ReceiveVersion()");
+ }
if (iXferMode != ::ENone)
{
TUSB_PRINT1("Error : wrong state: %d", iXferMode);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP01, "Error : wrong state: %d", iXferMode);
return KErrGeneral;
}
// Here we try to receive a version packet from the host.
// (We can use the preamble buffer because we only need it
// once and that's also before the preamble uses.)
TUSB_PRINT("Getting host program versions...");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP02, "Getting host program versions...");
iPreambleBuf.FillZ();
TRequestStatus receive_status;
iPort->Read(receive_status, EEndpoint2, iPreambleBuf, KPreambleLength);
TUSB_VERBOSE_PRINT("Waiting for read request to complete...");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_RECEIVEVERSION_DUP03, "Waiting for read request to complete...");
+ }
iTimeoutTimer->Activate(5000000); // Host gets 5s
User::WaitForRequest(receive_status, iTimeoutTimer->iStatus);
if (receive_status == KRequestPending)
{
// Read() still pending...
TUSB_PRINT("Cancelling USB Read(): no response from host.\n");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP04, "Cancelling USB Read(): no response from host.\n");
iPort->ReadCancel(EEndpoint2);
TUSB_PRINT("THIS COULD BE DUE TO AN OLD VERSION OF USBRFLCT ON THE PC:");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP05, "THIS COULD BE DUE TO AN OLD VERSION OF USBRFLCT ON THE PC:");
TUSB_PRINT3("PLEASE CHECK THE VERSION THERE - WE NEED AT LEAST V%d.%d.%d!\n",
KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro);
+ OstTraceExt3(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP06, "PLEASE CHECK THE VERSION THERE - WE NEED AT LEAST V%d.%d.%d!\n",
+ KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro);
TUSB_PRINT("When updating an existing USBRFLCT installation <= v1.3.1,\n" \
L"the following three things will need to be done:\n");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP07, "When updating an existing USBRFLCT installation <= v1.3.1,\n" \
+ L"the following three things will need to be done:\n");
TUSB_PRINT("1. Connect the device to the PC & start T_USB (just as now),\n" \
L"then find the USB device in the Windows Device Manager\n" \
L"('Control Panel'->'System'->'Hardware'->'Device Manager').\n" \
L"Right click on the device name and choose 'Uninstall...'.\n");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP08, "1. Connect the device to the PC & start T_USB (just as now),\n" \
+ L"then find the USB device in the Windows Device Manager\n" \
+ L"('Control Panel'->'System'->'Hardware'->'Device Manager').\n" \
+ L"Right click on the device name and choose 'Uninstall...'.\n");
TUSB_PRINT("2. In c:\\winnt\\inf\\, find (by searching for \"Symbian\") and\n" \
L"delete the *.INF file that was used to install the existing\n" \
L"version of USBRFLCT.SYS. Make sure to also delete the\n" \
L"precompiled version of that file (<samename>.PNF).\n");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP09, "2. In c:\\winnt\\inf\\, find (by searching for \"Symbian\") and\n" \
+ L"delete the *.INF file that was used to install the existing\n" \
+ L"version of USBRFLCT.SYS. Make sure to also delete the\n" \
+ L"precompiled version of that file (<samename>.PNF).\n");
TUSB_PRINT("3. In c:\\winnt\\system32\\drivers\\, delete the file USBRFLCT.SYS.\n");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP10, "3. In c:\\winnt\\system32\\drivers\\, delete the file USBRFLCT.SYS.\n");
TUSB_PRINT("Then unplug & reconnect the USB device and, when prompted, install\n" \
L"the new USBRFLCT.SYS driver using the .INF file from this distribution.\n" \
L"(All files can be found under e32test\\win32\\usbrflct_distribution\\.)\n");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP11, "Then unplug & reconnect the USB device and, when prompted, install\n" \
+ L"the new USBRFLCT.SYS driver using the .INF file from this distribution.\n" \
+ L"(All files can be found under e32test\\win32\\usbrflct_distribution\\.)\n");
TUSB_PRINT("Use the new USBRFLCT.EXE from this distribution.\n");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_RECEIVEVERSION_DUP12, "Use the new USBRFLCT.EXE from this distribution.\n");
}
else
{
TUSB_VERBOSE_PRINT("...done.");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_RECEIVEVERSION_DUP13, "...done.");
+ }
// Timeout not needed any longer
TUSB_VERBOSE_PRINT("Cancelling timeout timer: USB Read() completed.\n");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_RECEIVEVERSION_DUP14, "Cancelling timeout timer: USB Read() completed.\n");
+ }
iTimeoutTimer->Cancel();
}
return receive_status.Int();
@@ -1354,6 +1610,10 @@
TInt CActiveRW::ExchangeVersions()
{
TUSB_VERBOSE_PRINT("CActiveRW::ExchangeVersions()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_EXCHANGEVERSIONS, "CActiveRW::ExchangeVersions()");
+ }
// First check the version of USBRFLCT that's running on the host
TInt r = ReceiveVersion();
if (r != KErrNone)
@@ -1368,10 +1628,15 @@
TUSB_PRINT5("Host-side: USBRFLCT v%d.%d.%d USBIO v%d.%d\n",
usbrflct_ver_major, usbrflct_ver_minor, usbrflct_ver_micro,
usbio_ver_major, usbio_ver_minor);
+ OstTraceExt5(TRACE_NORMAL, CACTIVERW_EXCHANGEVERSIONS_DUP01, "Host-side: USBRFLCT v%d.%d.%d USBIO v%d.%d\n",
+ usbrflct_ver_major, usbrflct_ver_minor, usbrflct_ver_micro,
+ usbio_ver_major, usbio_ver_minor);
if (usbrflct_ver_major < KUsbrflctVersionMajor)
{
TUSB_PRINT1("USBRFLCT version not sufficient (need at least v%d.x.x)\n",
KUsbrflctVersionMajor);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_EXCHANGEVERSIONS_DUP02, "USBRFLCT version not sufficient (need at least v%d.x.x)\n",
+ KUsbrflctVersionMajor);
return KErrGeneral;
}
// Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without
@@ -1381,6 +1646,8 @@
{
TUSB_PRINT2("USBRFLCT version not sufficient (need at least v%d.%d.x)\n",
KUsbrflctVersionMajor, KUsbrflctVersionMinor);
+ OstTraceExt2(TRACE_NORMAL, CACTIVERW_EXCHANGEVERSIONS_DUP03, "USBRFLCT version not sufficient (need at least v%d.%d.x)\n",
+ KUsbrflctVersionMajor, KUsbrflctVersionMinor);
return KErrGeneral;
}
// Just using '<' instead of the seemingly absurd '<= && !==' doesn't work without
@@ -1390,6 +1657,8 @@
{
TUSB_PRINT3("USBRFLCT version not sufficient (need at least v%d.%d.%d)\n",
KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro);
+ OstTraceExt3(TRACE_NORMAL, CACTIVERW_EXCHANGEVERSIONS_DUP04, "USBRFLCT version not sufficient (need at least v%d.%d.%d)\n",
+ KUsbrflctVersionMajor, KUsbrflctVersionMinor, KUsbrflctVersionMicro);
return KErrGeneral;
}
// Now we send T_USB's version to the host
@@ -1405,8 +1674,16 @@
void CActiveRW::SendPreamble()
{
TUSB_VERBOSE_PRINT("CActiveRW::SendPreamble()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_SENDPREAMBLE, "CActiveRW::SendPreamble()");
+ }
__ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666));
TUSB_VERBOSE_PRINT1("Sending data length: %d bytes", iBufSz);
+ if(iVerbose)
+ {
+ OstTrace1(TRACE_VERBOSE, CACTIVERW_SENDPREAMBLE_DUP01, "Sending data length: %d bytes", iBufSz);
+ }
*reinterpret_cast<TUint32*>(&iPreambleBuf[0]) = SWAP_BYTES_32(iBufSz);
iPort->Write(iStatus, EEndpoint1, iPreambleBuf, KPreambleLength);
iCurrentXfer = EPreamble;
@@ -1417,6 +1694,10 @@
void CActiveRW::SendData()
{
TUSB_VERBOSE_PRINT("CActiveRW::SendData()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_SENDDATA, "CActiveRW::SendData()");
+ }
__ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666));
if (iDiskAccessEnabled)
{
@@ -1435,6 +1716,10 @@
}
}
TUSB_VERBOSE_PRINT1("Sending data: %d bytes", iBufSz);
+ if(iVerbose)
+ {
+ OstTrace1(TRACE_VERBOSE, CACTIVERW_SENDDATA_DUP01, "Sending data: %d bytes", iBufSz);
+ }
iPort->Write(iStatus, EEndpoint1, iWriteBuf, iBufSz);
iCurrentXfer = EWriteXfer;
SetActive();
@@ -1448,9 +1733,11 @@
if (r != KErrNone)
{
TUSB_PRINT1("RFs::DriveList() returned %d", r);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_SELECTDRIVE, "RFs::DriveList() returned %d", r);
return r;
}
TUSB_PRINT("Available drives:");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_SELECTDRIVE_DUP01, "Available drives:");
for (TInt n = 0; n < KMaxDrives; n++)
{
if (driveList[n] != 0)
@@ -1461,13 +1748,17 @@
{
TPtr name(volumeInfo.iName.Des());
TUSB_PRINT2("Drive %c: %- 16S", 'A' + n, &name);
+ OstTraceExt2(TRACE_NORMAL, CACTIVERW_SELECTDRIVE_DUP02, "Drive %c: %S", 'A' + n, name);
if (volumeInfo.iDrive.iMediaAtt & KMediaAttWriteProtected)
TUSB_PRINT(" (read-only)");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_SELECTDRIVE_DUP03, " (read-only)");
TUSB_PRINT("");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_SELECTDRIVE_DUP04, "");
}
}
}
iConsole->Printf(_L("Please select a drive letter (or 'Q' to quit)..."));
+ OstTrace0(TRACE_NORMAL, CACTIVERW_SELECTDRIVE_DUP05, "Please select a drive letter (or 'Q' to quit...");
TChar driveLetter;
TInt driveNumber;
TVolumeInfo volumeInfo;
@@ -1491,7 +1782,9 @@
iFileName.Format(_L("%c:"), driveLetter.operator TUint());
iFileName.Append(KFileName);
TUSB_PRINT1("\nFilename = %S", &iFileName);
+ OstTraceExt1(TRACE_NORMAL, CACTIVERW_SELECTDRIVE_DUP06, "\nFilename = %S", iFileName);
TUSB_PRINT1("File size: %d", KMaxFileSize);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_SELECTDRIVE_DUP07, "File size: %d", KMaxFileSize);
return r;
}
@@ -1535,6 +1828,7 @@
if (r != KErrNone)
{
TUSB_PRINT1("RFile::Replace() returned %d", r);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_READFROMDISK, "RFile::Replace() returned %d", r);
iDiskAccessEnabled = EFalse;
return r;
}
@@ -1546,24 +1840,28 @@
buffer[n] = static_cast<TUint8>(n & 0x000000ff);
}
TUSB_PRINT("Writing data to file (this may take some minutes...)");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_READFROMDISK_DUP01, "Writing data to file (this may take some minutes...)");
for (TInt n = 0; n < KMaxFileSize; n += KBufferSize)
{
r = iFile.Write(buffer, KBufferSize);
if (r != KErrNone)
{
TUSB_PRINT1("RFile::Write() returned %d (disk full?)", r);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_READFROMDISK_DUP02, "RFile::Write() returned %d (disk full?)", r);
iFile.Close();
iDiskAccessEnabled = EFalse;
return r;
}
}
TUSB_PRINT("Done.");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_READFROMDISK_DUP03, "Done.");
iFile.Close();
// Now open the file for reading
r = iFile.Open(iFs, iFileName, EFileRead);
if (r != KErrNone)
{
TUSB_PRINT1("RFile::Open() returned %d", r);
+ OstTrace1(TRACE_NORMAL, CACTIVERW_READFROMDISK_DUP04, "RFile::Open() returned %d", r);
iDiskAccessEnabled = EFalse;
return r;
}
@@ -1576,10 +1874,15 @@
void CActiveRW::WriteBufferToDisk(TDes8& aBuffer, TInt aLen)
{
TUSB_VERBOSE_PRINT1("CActiveRW::WriteBufferToDisk(), len = %d", aLen);
+ if(iVerbose)
+ {
+ OstTrace1(TRACE_VERBOSE, CACTIVERW_WRITEBUFFERTODISK, "CActiveRW::WriteBufferToDisk(), len = %d", aLen);
+ }
TInt r = iFile.Write(aBuffer, aLen);
if (r != KErrNone)
{
TUSB_PRINT2("Error writing to %S (%d)", &iFileName, r);
+ OstTraceExt2(TRACE_NORMAL, CACTIVERW_WRITEBUFFERTODISK_DUP01, "Error writing to %S (%d)", iFileName, r);
iDiskAccessEnabled = EFalse;
return;
}
@@ -1603,15 +1906,22 @@
if (r != KErrNone)
{
TUSB_PRINT2("Error reading from %S (%d)", &iFileName, r);
+ OstTraceExt2(TRACE_NORMAL, CACTIVERW_READBUFFERFROMDISK, "Error reading from %S (%d)", iFileName, r);
iDiskAccessEnabled = EFalse;
return;
}
TInt readLen = aBuffer.Length();
TUSB_VERBOSE_PRINT1("CActiveRW::ReadBufferFromDisk(), len = %d\n", readLen);
+ if(iVerbose)
+ {
+ OstTrace1(TRACE_VERBOSE, CACTIVERW_READBUFFERFROMDISK_DUP01, "CActiveRW::ReadBufferFromDisk(), len = %d\n", readLen);
+ }
if (readLen < aLen)
{
TUSB_PRINT3("Only %d bytes of %d read from file %S)",
readLen, aLen, &iFileName);
+ OstTraceExt3(TRACE_NORMAL, CACTIVERW_READBUFFERFROMDISK_DUP02, "Only %d bytes of %d read from file %S)",
+ readLen, aLen, iFileName);
iDiskAccessEnabled = EFalse;
return;
}
@@ -1622,29 +1932,53 @@
void CActiveRW::ReadData()
{
TUSB_VERBOSE_PRINT("CActiveRW::ReadData()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA, "CActiveRW::ReadData()");
+ }
__ASSERT_ALWAYS(!IsActive(), User::Panic(KActivePanic, 666));
TUSB_VERBOSE_PRINT1("Reading data: %d bytes", iBufSz);
+ if(iVerbose)
+ {
+ OstTrace1(TRACE_VERBOSE, CACTIVERW_READDATA_DUP01, "Reading data: %d bytes", iBufSz);
+ }
if (iXferMode == EReceiveOnly)
{
TUSB_VERBOSE_PRINT(" (rx only)");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA_DUP02, " (rx only)");
+ }
iPort->Read(iStatus, EEndpoint2, iReadBuf, iBufSz);
}
else if (iBufSz == iMaxPktSz)
{
// we also want to test the packet version of Read()
TUSB_VERBOSE_PRINT(" (a single packet)");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA_DUP03, " (a single packet)");
+ }
iPort->ReadPacket(iStatus, EEndpoint2, iReadBuf, iBufSz);
}
else if (iBufSz == iReadBuf.MaxSize())
{
// or we could perhaps test the three-parameter version
TUSB_VERBOSE_PRINT(" (w/o length)");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA_DUP04, " (w/o length)");
+ }
iPort->Read(iStatus, EEndpoint2, iReadBuf);
}
else
{
// otherwise, we use the universal default version
TUSB_VERBOSE_PRINT(" (normal)");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_READDATA_DUP05, " (normal)");
+ }
iPort->Read(iStatus, EEndpoint2, iReadBuf, iBufSz);
}
iCurrentXfer = EReadXfer;
@@ -1657,9 +1991,11 @@
if (!IsActive())
{
TUSB_PRINT("CActiveRW::Stop(): Not active");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_STOP, "CActiveRW::Stop(): Not active");
return;
}
TUSB_PRINT("Cancelling outstanding transfer requests\n");
+ OstTrace0(TRACE_NORMAL, CACTIVERW_STOP_DUP01, "Cancelling outstanding transfer requests\n");
iBufSz = KInitialBufSz;
iPktNum = ~0;
iDoStop = ETrue;
@@ -1671,6 +2007,10 @@
void CActiveRW::DoCancel()
{
TUSB_VERBOSE_PRINT("CActiveRW::DoCancel()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVERW_DOCANCEL, "CActiveRW::DoCancel()");
+ }
// Canceling the transfer requests can be done explicitly
// for every transfer...
iPort->WriteCancel(EEndpoint1);
@@ -1683,13 +2023,26 @@
TBool CActiveRW::CompareBuffers(TInt aLen)
{
TUSB_VERBOSE_PRINT1("CActiveRW::CompareBuffers(%d)", aLen);
+ if(iVerbose)
+ {
+ OstTrace1(TRACE_VERBOSE, CACTIVERW_COMPAREBUFFERS, "CActiveRW::CompareBuffers(%d)", aLen);
+ }
for (TInt i = 0; i < aLen; i++)
{
if (iReadBuf[i] != iWriteBuf[i])
{
TUSB_VERBOSE_PRINT1("Error: for i = %d:", i);
+ if(iVerbose)
+ {
+ OstTrace1(TRACE_VERBOSE, CACTIVERW_COMPAREBUFFERS_DUP01, "Error: for i = %d:", i);
+ }
TUSB_VERBOSE_PRINT2("iReadBuf: %d != iWriteBuf: %d",
iReadBuf[i], iWriteBuf[i]);
+ if(iVerbose)
+ {
+ OstTraceExt2(TRACE_VERBOSE, CACTIVERW_COMPAREBUFFERS_DUP02, "iReadBuf: %d != iWriteBuf: %d",
+ iReadBuf[i], iWriteBuf[i]);
+ }
return EFalse;
}
}
@@ -1730,6 +2083,10 @@
CActiveStallNotifier::~CActiveStallNotifier()
{
TUSB_VERBOSE_PRINT("CActiveStallNotifier::~CActiveStallNotifier()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVESTALLNOTIFIER_DCACTIVESTALLNOTIFIER, "CActiveStallNotifier::~CActiveStallNotifier()");
+ }
Cancel(); // base class
}
@@ -1737,6 +2094,10 @@
void CActiveStallNotifier::DoCancel()
{
TUSB_VERBOSE_PRINT("CActiveStallNotifier::DoCancel()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVESTALLNOTIFIER_DOCANCEL, "CActiveStallNotifier::DoCancel()");
+ }
iPort->EndpointStatusNotifyCancel();
}
@@ -1747,6 +2108,10 @@
// In a real world program, the user could take here appropriate action (cancel a
// transfer request or whatever).
TUSB_VERBOSE_PRINT1("StallNotifier: Endpointstate 0x%x\n", iEndpointState);
+ if(iVerbose)
+ {
+ OstTrace1(TRACE_VERBOSE, CACTIVESTALLNOTIFIER_RUNL, "StallNotifier: Endpointstate 0x%x\n", iEndpointState);
+ }
Activate();
}
@@ -1792,6 +2157,10 @@
CActiveDeviceStateNotifier::~CActiveDeviceStateNotifier()
{
TUSB_VERBOSE_PRINT("CActiveDeviceStateNotifier::~CActiveDeviceStateNotifier()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVEDEVICESTATENOTIFIER_DCACTIVEDEVICESTATENOTIFIER, "CActiveDeviceStateNotifier::~CActiveDeviceStateNotifier()");
+ }
Cancel(); // base class
}
@@ -1799,6 +2168,10 @@
void CActiveDeviceStateNotifier::DoCancel()
{
TUSB_VERBOSE_PRINT("CActiveDeviceStateNotifier::DoCancel()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVEDEVICESTATENOTIFIER_DOCANCEL, "CActiveDeviceStateNotifier::DoCancel()");
+ }
iPort->AlternateDeviceStatusNotifyCancel();
}
@@ -1814,33 +2187,43 @@
{
case EUsbcDeviceStateUndefined:
TUSB_PRINT("Device State notifier: Undefined");
+ OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL, "Device State notifier: Undefined");
break;
case EUsbcDeviceStateAttached:
TUSB_PRINT("Device State notifier: Attached");
+ OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP01, "Device State notifier: Attached");
break;
case EUsbcDeviceStatePowered:
TUSB_PRINT("Device State notifier: Powered");
+ OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP02, "Device State notifier: Powered");
break;
case EUsbcDeviceStateDefault:
TUSB_PRINT("Device State notifier: Default");
+ OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP03, "Device State notifier: Default");
break;
case EUsbcDeviceStateAddress:
TUSB_PRINT("Device State notifier: Address");
+ OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP04, "Device State notifier: Address");
break;
case EUsbcDeviceStateConfigured:
TUSB_PRINT("Device State notifier: Configured");
+ OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP05, "Device State notifier: Configured");
break;
case EUsbcDeviceStateSuspended:
TUSB_PRINT("Device State notifier: Suspended");
+ OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP06, "Device State notifier: Suspended");
break;
default:
TUSB_PRINT("Device State notifier: ***BAD***");
+ OstTrace0(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP07, "Device State notifier: ***BAD***");
}
}
else if (iDeviceState & KUsbAlternateSetting)
{
TUSB_PRINT1("Device State notifier: Alternate interface setting has changed: now %d",
iDeviceState & ~KUsbAlternateSetting);
+ OstTrace1(TRACE_NORMAL, CACTIVEDEVICESTATENOTIFIER_RUNL_DUP08, "Device State notifier: Alternate interface setting has changed: now %d",
+ iDeviceState & ~KUsbAlternateSetting);
}
Activate();
@@ -1890,6 +2273,10 @@
CActiveTimer::~CActiveTimer()
{
TUSB_VERBOSE_PRINT("CActiveTimer::~CActiveTimer()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVETIMER_DCACTIVETIMER, "CActiveTimer::~CActiveTimer()");
+ }
Cancel(); // base class
iTimer.Close();
}
@@ -1898,6 +2285,10 @@
void CActiveTimer::DoCancel()
{
TUSB_VERBOSE_PRINT("CActiveTimer::DoCancel()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVETIMER_DOCANCEL, "CActiveTimer::DoCancel()");
+ }
iTimer.Cancel();
}
@@ -1905,6 +2296,10 @@
void CActiveTimer::RunL()
{
TUSB_VERBOSE_PRINT("CActiveTimer::RunL()");
+ if(iVerbose)
+ {
+ OstTrace0(TRACE_VERBOSE, CACTIVETIMER_RUNL, "CActiveTimer::RunL()");
+ }
// Nothing to do here, as we call ReadCancel() after a manual WaitForRequest()
// (in CActiveRW::ReceiveVersion()).
}