# HG changeset patch # User hgs # Date 1288093760 -3600 # Node ID b2826f67641fc977cace1399ec334d55da6df1f2 # Parent 94f2adf59133616aa9b17241fb677ef1316d3dae 201043_03 diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/server/t_filecache.cpp --- a/kerneltest/f32test/server/t_filecache.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/server/t_filecache.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -591,7 +591,7 @@ test(fileCacheStats.iLockedSegmentCount >= maxLockedSegmentCount); maxLockedSegmentCount = Max(maxLockedSegmentCount, fileCacheStats.iLockedSegmentCount); // wrap to start of file - if (pos >= gFileCacheConfig.iCacheSize) + if (pos >= gFileCacheConfig.iCacheSize || pos >= KBufSize) pos = 0; } timer.Close(); @@ -1017,14 +1017,11 @@ test_Value(r, r==KErrArgument); //********************************** // Test that continuously appending to a file yields the correct size... - // NB: Must have lock failure more ON in debug mode for this test to pass + // NB: Must have lock failure mode ON in debug mode for this test to pass //********************************** test.Next(_L("Test appending to a file & checking the file size...")); gBufPtr.SetLength(KBufSize); - r = f.Replace(TheFs, testFile, EFileWrite | EFileWriteBuffered); - test_KErrNone(r); - const TInt KWriteLen = KSegmentSize+1; writePtr.Set(gBuf->Des().Ptr(), KWriteLen); @@ -1039,6 +1036,9 @@ TInt fileSize = 0; for (TInt i=0; i<4; i++) { + r = f.Replace(TheFs, testFile, EFileWrite | EFileWriteBuffered); + test_KErrNone(r); + fileSize = 0; r = f.SetSize(fileSize); test_KErrNone(r); @@ -1080,6 +1080,13 @@ #endif } + // Close & delete the file after filling it - to ensure all pages are decomitted + // otherwise we may never again get a simulated lock failure + r = f.Flush(); + test_KErrNone(r); + f.Close(); + r = TheFs.Delete(testFile); + test_KErrNone(r); } #if defined(_DEBUG) || defined(_DEBUG_RELEASE) diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/server/t_main.cpp --- a/kerneltest/f32test/server/t_main.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/server/t_main.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -665,12 +665,17 @@ TInt orgSessionCount; r = controlIo(TheFs,theDrive, KControlIoSessionCount, orgSessionCount); test_KErrNone(r); - test.Printf(_L("Session count start=%d\n"),orgSessionCount); + test.Printf(_L("Session count start=%d\n"),orgSessionCount); TInt orgObjectCount; r = controlIo(TheFs,theDrive, KControlIoObjectCount, orgObjectCount); test_KErrNone(r); - test.Printf(_L("Object count start=%d\n"),orgObjectCount); + test.Printf(_L("Object count start=%d\n"),orgObjectCount); + + TInt orgHeapCellCount; + r = controlIo(TheFs,theDrive, KControlIoHeapCellCount, orgHeapCellCount); + test_KErrNone(r); + test.Printf(_L("Heap cell count start=%d\n"),orgHeapCellCount); TPckgBuf pkgOrgValues; @@ -742,11 +747,11 @@ r = controlIo(TheFs,theDrive, KControlIoSessionCount, endSessionCount); test_KErrNone(r); - test.Printf(_L("Session count end=%d\n"),endSessionCount); + test.Printf(_L("Session count end=%d\n"),endSessionCount); r = controlIo(TheFs,theDrive, KControlIoObjectCount, endObjectCount); test_KErrNone(r); - test.Printf(_L("Object count end=%d\n"),endObjectCount); + test.Printf(_L("Object count end=%d\n"),endObjectCount); if (endSessionCount == orgSessionCount && endObjectCount == orgObjectCount) break; @@ -755,6 +760,11 @@ User::After(1000000); } + TInt endHeapCellCount; + r = controlIo(TheFs,theDrive, KControlIoHeapCellCount, endHeapCellCount); + test_KErrNone(r); + test.Printf(_L("Heap cell count end=%d\n"),endHeapCellCount); + // some tests don't close their sessions, so this test won't work until // all the tests are fixed : // test(endSessionCount == orgSessionCount); diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/app/husbconsapp.cpp --- a/kerneltest/f32test/shostmassstorage/msman/app/husbconsapp.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/app/husbconsapp.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -40,7 +40,7 @@ #include "cdisplay.h" #include "husbconsapp.h" -#include "tmslog.h" +#include "debug.h" _LIT(KTxtApp,"HOST USB CONSOLE APP"); @@ -48,59 +48,58 @@ CHeartBeat* CHeartBeat::NewLC(CDisplay& aDisplay) - { - CHeartBeat* me = new(ELeave) CHeartBeat(aDisplay); - CleanupStack::PushL(me); - me->ConstructL(); - return me; - } + { + CHeartBeat* me = new(ELeave) CHeartBeat(aDisplay); + CleanupStack::PushL(me); + me->ConstructL(); + return me; + } CHeartBeat::CHeartBeat(CDisplay& aDisplay) : CActive(0), iDisplay(aDisplay) - {} + {} void CHeartBeat::ConstructL() - { - CActiveScheduler::Add(this); - iTimer.CreateLocal(); - RunL(); - } + { + CActiveScheduler::Add(this); + iTimer.CreateLocal(); + RunL(); + } CHeartBeat::~CHeartBeat() - { - Cancel(); - } + { + Cancel(); + } void CHeartBeat::DoCancel() - { + { iTimer.Cancel(); - } + } void CHeartBeat::RunL() - { - SetActive(); - // Print RAM usage & up time - iUpTime++; + { + SetActive(); + // Print RAM usage & up time + iUpTime++; iDisplay.UpTime(iUpTime); - TInt mem=0; - if (HAL::Get(HALData::EMemoryRAMFree, mem)==KErrNone) - { + TInt mem=0; + if (HAL::Get(HALData::EMemoryRAMFree, mem)==KErrNone) + { iDisplay.MemoryFree(mem); - } - iTimer.After(iStatus, 1000000); - } + } + iTimer.After(iStatus, 1000000); + } GLDEF_C void RunAppL() { - __MSFNSLOG CActiveScheduler* sched = new(ELeave) CActiveScheduler; CleanupStack::PushL(sched); CActiveScheduler::Install(sched); @@ -114,11 +113,11 @@ User::LeaveIfError(err); CConsoleBase* console; - console = Console::NewL(KTxtApp, TSize(KConsFullScreen,KConsFullScreen)); - CleanupStack::PushL(console); + console = Console::NewL(KTxtApp, TSize(KConsFullScreen,KConsFullScreen)); + CleanupStack::PushL(console); CDisplay* display = CDisplay::NewLC(fs, *console); - CMessageKeyProcessor::NewLC(*display, usbOtgSession); + CMessageKeyProcessor::NewLC(*display, usbOtgSession); CHeartBeat::NewLC(*display); display->Menu(); @@ -135,8 +134,8 @@ // ************************************************************************* CActiveScheduler::Start(); - // 1 sec delay for sessions to stop - User::After(1000000); + // 1 sec delay for sessions to stop + User::After(1000000); CleanupStack::PopAndDestroy(usbHost); CleanupStack::PopAndDestroy(); // CPeriodUpdate CleanupStack::PopAndDestroy(); // CMessageKeyProcessor @@ -149,12 +148,12 @@ GLDEF_C TInt E32Main() - { - __UHEAP_MARK; - CTrapCleanup* cleanup = CTrapCleanup::New(); - TRAPD(error, RunAppL()); - __ASSERT_ALWAYS(!error, User::Panic(KTxtApp, error)); - delete cleanup; - __UHEAP_MARKEND; - return 0; - } + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + TRAPD(error, RunAppL()); + __ASSERT_ALWAYS(!error, User::Panic(KTxtApp, error)); + delete cleanup; + __UHEAP_MARKEND; + return 0; + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/app/husbconsapp.mmp --- a/kerneltest/f32test/shostmassstorage/msman/app/husbconsapp.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/app/husbconsapp.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -33,9 +33,6 @@ SOURCE cusbmsmountmanager.cpp SOURCE rextfilesystem.cpp -SOURCEPATH ../shared -SOURCE tmslog.cpp - SOURCEPATH . SOURCE husbconsapp.cpp SOURCE cdisplay.cpp diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/client/msmanclient.mmp --- a/kerneltest/f32test/shostmassstorage/msman/client/msmanclient.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/client/msmanclient.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -13,24 +13,21 @@ // Description: // -TARGET msmanclient.dll +TARGET msmanclient.dll -TARGETTYPE dll +TARGETTYPE dll OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared - -SOURCEPATH . -SOURCE rusbhostsession.cpp -SOURCE rusbotgsession.cpp +USERINCLUDE . +USERINCLUDE ../shared -SOURCEPATH ../shared -SOURCE tmslog.cpp +SOURCEPATH . +SOURCE rusbhostsession.cpp +SOURCE rusbotgsession.cpp -LIBRARY efsrv.lib euser.lib +LIBRARY efsrv.lib euser.lib -// MACRO _TESTAPP_DEBUG_PRINT_ +// MACRO _TESTAPP_DEBUG_PRINT_ CAPABILITY ALL diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/client/rusbhostsession.cpp --- a/kerneltest/f32test/shostmassstorage/msman/client/rusbhostsession.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/client/rusbhostsession.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -26,13 +26,11 @@ #include "msmanclientserver.h" #include "rusbhostsession.h" -#include "tmslog.h" #include "debug.h" TVersion RUsbHostSession::Version() const { - __MSFNSLOG return(TVersion(KUsbHostSrvMajorVersionNumber, KUsbHostSrvMinorVersionNumber, KUsbHostSrvBuildVersionNumber)); @@ -41,14 +39,11 @@ EXPORT_C RUsbHostSession::RUsbHostSession() { - __MSFNSLOG } EXPORT_C TInt RUsbHostSession::Connect() { - __MSFNSLOG - TInt retry = 2; for (;;) { @@ -73,8 +68,6 @@ TInt RUsbHostSession::StartServer() { - __MSFNSLOG - const TUidType serverUid(KNullUid, KNullUid, KUsbHostServerUid3); // Create the server process @@ -96,7 +89,7 @@ return status.Int(); } - server.SetPriority(EPriorityHigh); + server.SetPriority(EPriorityHigh); server.Resume(); // start the server // Test whether the process has ended and if it has ended, return how it ended. @@ -115,6 +108,6 @@ EXPORT_C TInt RUsbHostSession::Start() - { - return SendReceive(EUsbHostStart); - } + { + return SendReceive(EUsbHostStart); + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/client/rusbotgsession.cpp --- a/kerneltest/f32test/shostmassstorage/msman/client/rusbotgsession.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/client/rusbotgsession.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -28,13 +28,11 @@ #include "msmanclientserver.h" #include "rusbotgsession.h" -#include "tmslog.h" #include "debug.h" TVersion RUsbOtgSession::Version() const { - __MSFNSLOG return(TVersion(KUsbOtgSrvMajorVersionNumber, KUsbOtgSrvMinorVersionNumber, KUsbOtgSrvBuildVersionNumber)); @@ -43,19 +41,15 @@ EXPORT_C RUsbOtgSession::RUsbOtgSession() { - __MSFNSLOG } EXPORT_C RUsbOtgSession::RUsbOtgSession(TInt /* aParam */) { - __MSFNSLOG } EXPORT_C TInt RUsbOtgSession::Connect() { - __MSFNSLOG - TInt retry = 2; for (;;) { @@ -80,8 +74,6 @@ TInt RUsbOtgSession::StartServer() { - __MSFNSLOG - const TUidType serverUid(KNullUid, KNullUid, KUsbOtgServerUid3); // Create the server process @@ -103,7 +95,7 @@ return status.Int(); } - server.SetPriority(EPriorityHigh); + server.SetPriority(EPriorityHigh); server.Resume(); // start the server // Test whether the process has ended and if it has ended, return how it ended. @@ -122,7 +114,6 @@ EXPORT_C TBool RUsbOtgSession::DeviceInserted() { - __MSFNSLOG TPckgBuf pckg; TIpcArgs args(&pckg); @@ -134,7 +125,6 @@ EXPORT_C void RUsbOtgSession::NotifyChange(TBool& /* aChanged */, TRequestStatus& aStatus) { - __MSFNSLOG TPckgBuf pckg; TIpcArgs args(&pckg); @@ -144,13 +134,11 @@ EXPORT_C TInt RUsbOtgSession::NotifyChangeCancel() { - __MSFNSLOG return SendReceive(EUsbOtgNotifyChangeCancel); } EXPORT_C TInt RUsbOtgSession::BusDrop() - { - __MSFNSLOG - return SendReceive(EUsbOtgBusDrop); - } + { + return SendReceive(EUsbOtgBusDrop); + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/server/cusbhostserver.cpp --- a/kerneltest/f32test/shostmassstorage/msman/server/cusbhostserver.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/server/cusbhostserver.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // Implements a Symbian OS server that exposes the RUsbMassStorage API -// +// // @@ -38,74 +38,63 @@ #include "cusbhostserver.h" #include "cusbhostsession.h" -#include "tmslog.h" - CUsbHostServer* CUsbHostServer::NewLC() - { - __MSFNSLOG - CUsbHostServer* r = new (ELeave) CUsbHostServer(); - CleanupStack::PushL(r); + { + CUsbHostServer* r = new (ELeave) CUsbHostServer(); + CleanupStack::PushL(r); r->ConstructL(); - return r; - } + return r; + } CUsbHostServer::CUsbHostServer() : CServer2(EPriorityLow) - { - __MSFNSLOG - } + { + } void CUsbHostServer::ConstructL() { - __MSFNSLOG iUsbHost = CUsbHost::NewL(); - StartL(KUsbHostServerName); + StartL(KUsbHostServerName); } CUsbHostServer::~CUsbHostServer() - { - __MSFNSLOG + { delete iUsbHost; - } + } CSession2* CUsbHostServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMessage*/) const - { - __MSFNSLOG - TVersion v(KUsbHostSrvMajorVersionNumber, KUsbHostSrvMinorVersionNumber, KUsbHostSrvBuildVersionNumber); + { + TVersion v(KUsbHostSrvMajorVersionNumber, KUsbHostSrvMinorVersionNumber, KUsbHostSrvBuildVersionNumber); - if (!User::QueryVersionSupported(v, aVersion)) - User::Leave(KErrNotSupported); + if (!User::QueryVersionSupported(v, aVersion)) + User::Leave(KErrNotSupported); - CUsbHostSession* session = CUsbHostSession::NewL(); + CUsbHostSession* session = CUsbHostSession::NewL(); - return session; - } + return session; + } TInt CUsbHostServer::RunError(TInt aError) - { - __MSFNSLOG - - Message().Complete(aError); - ReStart(); + { + Message().Complete(aError); + ReStart(); return KErrNone; - } + } void CUsbHostServer::AddSession() { - __MSFNSLOG ++iSessionCount; } void CUsbHostServer::RemoveSession() { - __MSFNSLOG if (--iSessionCount == 0) { User::After(1000000); diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/server/cusbhostsession.cpp --- a/kerneltest/f32test/shostmassstorage/msman/server/cusbhostsession.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/server/cusbhostsession.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // Implements a Session of a Symbian OS server for the RUsbMassStorage API -// +// // @@ -25,7 +25,6 @@ #include #include -#include "tmslog.h" #include "msmanclientserver.h" #include @@ -42,71 +41,62 @@ CUsbHostSession* CUsbHostSession::NewL() - { - __MSFNSLOG - CUsbHostSession* r = new (ELeave) CUsbHostSession(); - CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; - } + { + CUsbHostSession* r = new (ELeave) CUsbHostSession(); + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; + } CUsbHostSession::CUsbHostSession() - { - __MSFNSLOG - - } + { + } void CUsbHostSession::ConstructL() - { - __MSFNSLOG - } + { + } void CUsbHostSession::CreateL() - { - __MSFNSLOG + { Server().AddSession(); - } + } CUsbHostSession::~CUsbHostSession() - { - __MSFNSLOG + { Server().RemoveSession(); - } + } void CUsbHostSession::ServiceL(const RMessage2& aMessage) - { - __MSFNSLOG - DispatchMessageL(aMessage); - } + { + DispatchMessageL(aMessage); + } void CUsbHostSession::DispatchMessageL(const RMessage2& aMessage) - { - __MSFNSLOG - TInt ret = KErrNone; + { + TInt ret = KErrNone; - switch (aMessage.Function()) - { - case EUsbHostStart: - ret = Start(aMessage); - break; - default: - aMessage.Panic(KUsbHostClientPncCat, EUsbHostPanicIllegalIPC); - break; - } + switch (aMessage.Function()) + { + case EUsbHostStart: + ret = Start(aMessage); + break; + default: + aMessage.Panic(KUsbHostClientPncCat, EUsbHostPanicIllegalIPC); + break; + } - aMessage.Complete(ret); - } + aMessage.Complete(ret); + } TInt CUsbHostSession::Start(const RMessage2& aMessage) - { - __MSFNSLOG + { Server().iUsbHost->Start(); - return KErrNone; - } + return KErrNone; + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/server/cusbotgserver.cpp --- a/kerneltest/f32test/shostmassstorage/msman/server/cusbotgserver.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/server/cusbotgserver.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // Implements a Symbian OS server that exposes the RUsbMassStorage API -// +// // @@ -35,75 +35,63 @@ #include "cusbotgserver.h" #include "cusbotgsession.h" -#include "tmslog.h" - CUsbOtgServer* CUsbOtgServer::NewLC() - { - __MSFNSLOG - CUsbOtgServer* r = new (ELeave) CUsbOtgServer(); - CleanupStack::PushL(r); + { + CUsbOtgServer* r = new (ELeave) CUsbOtgServer(); + CleanupStack::PushL(r); r->ConstructL(); - return r; - } + return r; + } CUsbOtgServer::CUsbOtgServer() : CServer2(EPriorityLow) - { - __MSFNSLOG - } + { + } void CUsbOtgServer::ConstructL() { - __MSFNSLOG - - iUsbOtg = CUsbOtg::NewL(); - StartL(KUsbOtgServerName); + iUsbOtg = CUsbOtg::NewL(); + StartL(KUsbOtgServerName); } CUsbOtgServer::~CUsbOtgServer() - { - __MSFNSLOG + { delete iUsbOtg; - } + } CSession2* CUsbOtgServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMessage*/) const - { - __MSFNSLOG - TVersion v(KUsbOtgSrvMajorVersionNumber, KUsbOtgSrvMinorVersionNumber, KUsbOtgSrvBuildVersionNumber); + { + TVersion v(KUsbOtgSrvMajorVersionNumber, KUsbOtgSrvMinorVersionNumber, KUsbOtgSrvBuildVersionNumber); - if (!User::QueryVersionSupported(v, aVersion)) - User::Leave(KErrNotSupported); + if (!User::QueryVersionSupported(v, aVersion)) + User::Leave(KErrNotSupported); - CUsbOtgSession* session = CUsbOtgSession::NewL(); + CUsbOtgSession* session = CUsbOtgSession::NewL(); - return session; - } + return session; + } TInt CUsbOtgServer::RunError(TInt aError) - { - __MSFNSLOG - - Message().Complete(aError); - ReStart(); + { + Message().Complete(aError); + ReStart(); return KErrNone; - } + } void CUsbOtgServer::AddSession() { - __MSFNSLOG ++iSessionCount; } void CUsbOtgServer::RemoveSession() { - __MSFNSLOG if (--iSessionCount == 0) { User::After(1000000); diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/server/cusbotgsession.cpp --- a/kerneltest/f32test/shostmassstorage/msman/server/cusbotgsession.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/server/cusbotgsession.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // Implements a Session of a Symbian OS server for the RUsbMassStorage API -// +// // @@ -25,7 +25,6 @@ #include #include -#include "tmslog.h" #include "msmanclientserver.h" #include @@ -40,56 +39,48 @@ CUsbOtgSession* CUsbOtgSession::NewL() - { - __MSFNSLOG - CUsbOtgSession* r = new (ELeave) CUsbOtgSession(); - CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; - } + { + CUsbOtgSession* r = new (ELeave) CUsbOtgSession(); + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; + } CUsbOtgSession::CUsbOtgSession() - { - __MSFNSLOG - - } + { + } void CUsbOtgSession::ConstructL() - { - __MSFNSLOG - } + { + } void CUsbOtgSession::CreateL() - { - __MSFNSLOG + { Server().AddSession(); - } + } CUsbOtgSession::~CUsbOtgSession() - { - __MSFNSLOG + { Server().RemoveSession(); - } + } void CUsbOtgSession::ServiceL(const RMessage2& aMessage) - { - __MSFNSLOG - DispatchMessageL(aMessage); - } + { + DispatchMessageL(aMessage); + } void CUsbOtgSession::DispatchMessageL(const RMessage2& aMessage) - { - __MSFNSLOG - TInt ret = KErrNone; + { + TInt ret = KErrNone; - switch (aMessage.Function()) - { + switch (aMessage.Function()) + { case EUsbOtgDeviceInserted: DeviceInsertedL(aMessage); break; @@ -99,21 +90,20 @@ case EUsbOtgNotifyChangeCancel: NotifyChangeCancel(); break; - case EUsbOtgBusDrop: - ret = BusDrop(); - break; - default: - aMessage.Panic(KUsbOtgClientPncCat, EUsbOtgPanicIllegalIPC); - break; - } + case EUsbOtgBusDrop: + ret = BusDrop(); + break; + default: + aMessage.Panic(KUsbOtgClientPncCat, EUsbOtgPanicIllegalIPC); + break; + } - aMessage.Complete(ret); - } + aMessage.Complete(ret); + } void CUsbOtgSession::DeviceInsertedL(const RMessage2& aMessage) { - __MSFNSLOG TBool inserted = Server().iUsbOtg->DeviceInserted(); TPckgBuf p(inserted); aMessage.WriteL(0,p); @@ -121,20 +111,17 @@ void CUsbOtgSession::NotifyChange(const RMessage2& aMessage) { - __MSFNSLOG Server().iUsbOtg->NotifyChange(aMessage); } void CUsbOtgSession::NotifyChangeCancel() { - __MSFNSLOG Server().iUsbOtg->NotifyChangeCancel(); } TInt CUsbOtgSession::BusDrop() { - __MSFNSLOG return Server().iUsbOtg->BusDrop(); - } + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/server/usbhostserver.mmp --- a/kerneltest/f32test/shostmassstorage/msman/server/usbhostserver.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/server/usbhostserver.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -13,42 +13,39 @@ // Description: // -TARGET usbhostserver.exe +TARGET usbhostserver.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../src +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../src -SOURCEPATH . -SOURCE cusbhostsession.cpp -SOURCE cusbhostserver.cpp -SOURCE usbhostserver.cpp +SOURCEPATH . +SOURCE cusbhostsession.cpp +SOURCE cusbhostserver.cpp +SOURCE usbhostserver.cpp SOURCEPATH ../src -SOURCE cusbhostao.cpp -SOURCE cusbhost.cpp -SOURCE cusbmsmountmanager.cpp -SOURCE rextfilesystem.cpp +SOURCE cusbhostao.cpp +SOURCE cusbhost.cpp +SOURCE cusbmsmountmanager.cpp +SOURCE rextfilesystem.cpp -SOURCEPATH ../shared -SOURCE tmslog.cpp +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../inc -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../inc - -LIBRARY efsrv.lib euser.lib usbdescriptors.lib usbdi_utils.lib usbhostmsclient.lib +LIBRARY efsrv.lib euser.lib usbdescriptors.lib usbdi_utils.lib usbhostmsclient.lib -//MACRO _TESTAPP_DEBUG_PRINT_ +//MACRO _TESTAPP_DEBUG_PRINT_ //CAPABILITY ALL CAPABILITY CommDD PowerMgmt DISKADMIN ALLFILES NetworkControl -UID 0 0x10282b48 +UID 0 0x10282b48 SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/server/usbotgserver.mmp --- a/kerneltest/f32test/shostmassstorage/msman/server/usbotgserver.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/server/usbotgserver.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -13,51 +13,48 @@ // Description: // -TARGET usbotgserver.exe +TARGET usbotgserver.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../src +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../src -SOURCEPATH . -SOURCE cusbotgsession.cpp -SOURCE cusbotgserver.cpp -SOURCE usbotgserver.cpp +SOURCEPATH . +SOURCE cusbotgsession.cpp +SOURCE cusbotgserver.cpp +SOURCE usbotgserver.cpp SOURCEPATH ../src -SOURCE cusbhostao.cpp -SOURCE cusbhost.cpp -SOURCE cusbmsmountmanager.cpp -SOURCE rextfilesystem.cpp +SOURCE cusbhostao.cpp +SOURCE cusbhost.cpp +SOURCE cusbmsmountmanager.cpp +SOURCE rextfilesystem.cpp -SOURCE rusbmspublisher.cpp -SOURCE cusbotgwatcher.cpp -SOURCE cusbotg.cpp +SOURCE rusbmspublisher.cpp +SOURCE cusbotgwatcher.cpp +SOURCE cusbotg.cpp -SOURCEPATH ../shared -SOURCE tmslog.cpp +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../shared +USERINCLUDE ../client -USERINCLUDE . -USERINCLUDE ../inc -USERINCLUDE ../shared -USERINCLUDE ../client - -LIBRARY efsrv.lib -LIBRARY euser.lib -LIBRARY usbdescriptors.lib -LIBRARY usbdi_utils.lib -LIBRARY usbhostmsclient.lib +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY usbdescriptors.lib +LIBRARY usbdi_utils.lib +LIBRARY usbhostmsclient.lib -//MACRO _TESTAPP_DEBUG_PRINT_ +//MACRO _TESTAPP_DEBUG_PRINT_ //CAPABILITY ALL CAPABILITY CommDD PowerMgmt DISKADMIN ALLFILES NetworkControl -UID 0 0x101fe1db +UID 0 0x101fe1db SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/shared/debug.h --- a/kerneltest/f32test/shostmassstorage/msman/shared/debug.h Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/shared/debug.h Tue Oct 26 12:49:20 2010 +0100 @@ -88,7 +88,21 @@ #define __USBHOSTPRINT5(t,a,b,c,d,e) #endif +#if defined(_USBMS_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) +#define __PRINT(t) {RDebug::Print(t);} +#define __PRINT1(t,a) {RDebug::Print(t,a);} +#define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} +#define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} +#define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} +#else +#define __PRINT(t) +#define __PRINT1(t,a) +#define __PRINT2(t,a,b) +#define __PRINT3(t,a,b,c) +#define __PRINT4(t,a,b,c,d) + +#endif #endif // DEBUG_H diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/shared/tmslog.cpp --- a/kerneltest/f32test/shostmassstorage/msman/shared/tmslog.cpp Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -// Copyright (c) 2009 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" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#include "tmslog.h" - -#ifdef TRACE_ENABLED - -_LIT8(KMsgSIn, ">>\t%S\r\n"); -_LIT8(KMsgSOut,"<<\t%S\r\n"); -_LIT8(KMsgIn, ">>[0x%08x]\t%S\r\n"); -_LIT8(KMsgOut,"<<[0x%08x]\t%S\r\n"); - - -TMsLogStaticFn::TMsLogStaticFn(const TDesC8& aFunctionName) - { - iFunctionName.Set(aFunctionName); - buf.AppendFormat(KMsgSIn, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TMsLogStaticFn::~TMsLogStaticFn() - { - buf.Zero(); - buf.AppendFormat(KMsgSOut, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TMsLogFn::TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer) -: iThisPointer(aThisPointer) - { - iFunctionName.Set(aFunctionName); - buf.AppendFormat(KMsgIn, iThisPointer, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TMsLogFn::~TMsLogFn() - { - buf.Zero(); - buf.AppendFormat(KMsgOut, iThisPointer, &iFunctionName); - RDebug::RawPrint(buf); - }; - -#endif diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/shared/tmslog.h --- a/kerneltest/f32test/shostmassstorage/msman/shared/tmslog.h Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (c) 2009 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" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* @file tmslog.h -* -* -*/ - - - - - - -#ifndef TMSLOG_H -#define TMSLOG_H - -//#define _TESTAPP_DEBUG_PRINT_ - -#if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#include -#endif - -#if defined(_TESTAPP_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#define TRACE_ENABLED -#endif - -#ifdef TRACE_ENABLED - -class TMsLogStaticFn - { -public: - static const TInt KLogBufferSize = 0xFF; - - TMsLogStaticFn(const TDesC8& aFunctionName); - - ~TMsLogStaticFn(); - -protected: - TBuf8 buf; - TPtrC8 iFunctionName; - }; - - - - -class TMsLogFn - { -public: - static const TInt KLogBufferSize = 0xFF; - TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer); - - ~TMsLogFn(); - -private: - TBuf8 buf; - TPtrC8 iFunctionName; - void* iThisPointer; - }; - - - - -#define __MSFNLOG TMsLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this); -#define __MSFNSLOG TMsLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); -#else -#define __MSFNSLOG -#define __MSFNLOG -#endif - - - -#ifdef TRACE_ENABLED -#define __PRINT(t) {RDebug::Print(t);} -#define __PRINT1(t,a) {RDebug::Print(t,a);} -#define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} -#define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} -#else -#define __PRINT(t) -#define __PRINT1(t,a) -#define __PRINT2(t,a,b) -#define __PRINT3(t,a,b,c) - -#endif - - -#endif // TMSLOG_H diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/src/cusbhost.cpp --- a/kerneltest/f32test/shostmassstorage/msman/src/cusbhost.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/src/cusbhost.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -29,7 +29,6 @@ #include "mdrivedisplay.h" #include "cusbhostao.h" #include "cusbhost.h" -#include "tmslog.h" #include "debug.h" @@ -40,21 +39,19 @@ CUsbHost* CUsbHost::NewL() { - __MSFNSLOG - CUsbHost* r = new (ELeave) CUsbHost(); - CleanupStack::PushL(r); + CUsbHost* r = new (ELeave) CUsbHost(); + CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CUsbHost::ConstructL() { - __MSFNLOG OpenHubL(); - LoadFileSystemL(); + LoadFileSystemL(); iUsbHostAo = CUsbHostAo::NewL(iHubDriver, iEvent, *this); @@ -64,13 +61,11 @@ CUsbHost::CUsbHost() { - __MSFNLOG } CUsbHost::~CUsbHost() { - __MSFNLOG delete iUsbHostAo; DismountAllFileSystemsL(); @@ -83,11 +78,10 @@ void CUsbHost::LoadFileSystemL() { - __MSFNLOG RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); - _LIT(KFsNm, "elocal"); + _LIT(KFsNm, "elocal"); TInt err; err = fs.AddFileSystem(KFsNm); @@ -108,7 +102,6 @@ void CUsbHost::OpenHubL() { - __MSFNLOG TInt err; err = User::LoadLogicalDevice(KHubDriverLddFileName); if (err != KErrAlreadyExists) @@ -125,24 +118,22 @@ void CUsbHost::CloseHubL() { - __MSFNLOG - iHubDriver.StopHost(); - iHubDriver.Close(); + iHubDriver.StopHost(); + iHubDriver.Close(); + + TInt err1 = User::FreeLogicalDevice(KUsbdiLddFileName); + __ASSERT_DEBUG(err1==KErrNone, User::Panic(KUsbdiLddFileName, err1)); - TInt err1 = User::FreeLogicalDevice(KUsbdiLddFileName); - __ASSERT_DEBUG(err1==KErrNone, User::Panic(KUsbdiLddFileName, err1)); + TInt err2 = User::FreeLogicalDevice(KHubDriverLddFileName); + __ASSERT_DEBUG(err2==KErrNone, User::Panic(KHubDriverLddFileName, err2)); - TInt err2 = User::FreeLogicalDevice(KHubDriverLddFileName); - __ASSERT_DEBUG(err2==KErrNone, User::Panic(KHubDriverLddFileName, err2)); - - User::LeaveIfError(err1); - User::LeaveIfError(err2); + User::LeaveIfError(err1); + User::LeaveIfError(err2); } TToken CUsbHost::OpenDeviceL() { - __MSFNLOG CDevice* device = CDevice::NewL(); TToken token = 0; @@ -159,7 +150,6 @@ void CUsbHost::CloseDeviceL() { - __MSFNLOG CDevice* device = iMountManager->RemoveDeviceL(iDeviceHandle); device->CloseDeviceL(); delete device; @@ -168,43 +158,36 @@ void CUsbHost::CloseAllDevicesL() { - __MSFNLOG iMountManager->CloseAllDevicesL(); } void CUsbHost::MountDeviceL() { - __MSFNLOG iMountManager->MountDeviceL(iDeviceHandle); } void CUsbHost::DismountDeviceL() { - __MSFNLOG iMountManager->DismountDeviceL(iDeviceHandle); } void CUsbHost::DismountAllFileSystemsL() { - __MSFNLOG iMountManager->DismountL(); } void CUsbHost::Start() { - __MSFNLOG iUsbHostAo->Wait(); } void CUsbHost::ProcessBusEventL() { - __MSFNLOG - __USBHOSTPRINT2(_L(">> CUsbHost RUsbHubDriver Event[%d] Device Handle = %d"), iEvent.iEventType, iEvent.iDeviceHandle); __USBHOSTPRINT2(_L("Error = %d reason = %x"), @@ -218,12 +201,12 @@ /* Jungo stack has attached the device */ TUint32 token = OpenDeviceL(); MountDeviceL(); - __USBHOSTPRINT(_L("CUsbHost: device attached")); + __USBHOSTPRINT(_L("CUsbHost: device attached")); } else if (event == RUsbHubDriver::TBusEvent::EDeviceRemoved) { - TRAPD(err, DismountDeviceL()); - CloseDeviceL(); + TRAPD(err, DismountDeviceL()); + CloseDeviceL(); User::LeaveIfError(err); __USBHOSTPRINT(_L("CUsbHost: device removed")); } @@ -237,7 +220,6 @@ RUsbHubDriver::TBusEvent::TEvent CUsbHost::WaitForBusEvent() { - __MSFNLOG TRequestStatus status; RUsbHubDriver::TBusEvent event; TBool eventReceived = EFalse; @@ -281,14 +263,12 @@ void CUsbHost::DriveMap(TDriveMap& aDriveMap) const { - __MSFNSLOG iMountManager->DriveMap(aDriveMap); } void CUsbHost::DeviceMap(TInt aDeviceIndex, TDeviceMap& aDeviceMap) const { - __MSFNSLOG iMountManager->DeviceMap(aDeviceIndex, aDeviceMap); } @@ -301,18 +281,16 @@ CUsbHostDisp* CUsbHostDisp::NewL(MDriveDisplay& aDriveDisplay) { - __MSFNSLOG - CUsbHostDisp* r = new (ELeave) CUsbHostDisp(aDriveDisplay); - CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + CUsbHostDisp* r = new (ELeave) CUsbHostDisp(aDriveDisplay); + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CUsbHostDisp::ConstructL() { - __MSFNLOG CUsbHost::ConstructL(); } @@ -321,13 +299,11 @@ : CUsbHost(), iDriveDisplay(aDriveDisplay) { - __MSFNLOG } CUsbHostDisp::~CUsbHostDisp() { - __MSFNLOG } void CUsbHostDisp::ProcessBusEventL() diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/src/cusbhostao.cpp --- a/kerneltest/f32test/shostmassstorage/msman/src/cusbhostao.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/src/cusbhostao.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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,7 +23,6 @@ #include "cusbmsmountmanager.h" //#include "cusbhost.h" #include "cusbhostao.h" -#include "tmslog.h" #include "debug.h" @@ -33,16 +32,14 @@ RUsbHubDriver::TBusEvent& aEvent, MUsbHostBusEventObserver& aObserver) { - __MSFNSLOG CUsbHostAo* r = new (ELeave) CUsbHostAo(aHubDriver, aEvent, aObserver); - r->ConstructL(); - return r; + r->ConstructL(); + return r; } void CUsbHostAo::ConstructL() { - __MSFNLOG } @@ -54,78 +51,72 @@ iEvent(aEvent), iObserver(aObserver) { - __MSFNLOG CActiveScheduler::Add(this); } CUsbHostAo::~CUsbHostAo() { - __MSFNLOG - Cancel(); + Cancel(); } void CUsbHostAo::Wait() { - __MSFNLOG - if (IsActive()) - { - __ASSERT_ALWAYS(EFalse, User::Panic(KTxtApp, -1)); - return; - } + if (IsActive()) + { + __ASSERT_ALWAYS(EFalse, User::Panic(KTxtApp, -1)); + return; + } __USBHOSTPRINT(_L("WaitForBusEvent...")); - iHubDriver.WaitForBusEvent(iEvent, iStatus); + iHubDriver.WaitForBusEvent(iEvent, iStatus); __USBHOSTPRINT2(_L("WaitForBusEvent done. Event=%d Status=%d"), iEvent.iEventType, iStatus.Int()); - SetActive(); + SetActive(); } void CUsbHostAo::DoCancel() - { - __MSFNLOG + { iHubDriver.CancelWaitForBusEvent(); - } + } void CUsbHostAo::RunL() - { - __MSFNLOG + { TInt status = iStatus.Int(); - if (status == KErrNotReady) - { + if (status == KErrNotReady) + { const TInt KDelay = 500 * 1000; // in uSecs User::After(KDelay); Wait(); - return; - } + return; + } // Let RunError handle any other error User::LeaveIfError(status); // Process bus event TRAP(status, iObserver.ProcessBusEventL()); - if(status != KErrNone) - { + if(status != KErrNone) + { Wait(); - return; - } + return; + } Wait(); - } + } _LIT(KErrLog, "ERROR %d in CActiveUsbHost"); TInt CUsbHostAo::RunError(TInt aError) - { - __MSFNLOG - RDebug::Print(KErrLog, aError); - return KErrNone; - } + { + RDebug::Print(KErrLog, aError); + return KErrNone; + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/src/cusbmsmountmanager.cpp --- a/kerneltest/f32test/shostmassstorage/msman/src/cusbmsmountmanager.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/src/cusbmsmountmanager.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -27,44 +27,38 @@ #include "rextfilesystem.h" #include "usbtypes.h" #include "cusbmsmountmanager.h" -#include "tmslog.h" #include "debug.h" CDevice* CDevice::NewL() { - __MSFNSLOG - CDevice* r = new (ELeave) CDevice(); - CleanupStack::PushL(r); + CDevice* r = new (ELeave) CDevice(); + CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CDevice::ConstructL() { - __MSFNLOG } CDevice::CDevice() { - __MSFNLOG } CDevice::~CDevice() { - __MSFNLOG __USBHOSTPRINT1(_L("~CDevice Token=%d"), iDeviceToken); } TToken CDevice::OpenDeviceL(TUint aDeviceHandle, RUsbHubDriver& aHub) { - __MSFNLOG __USBHOSTPRINT1(_L("CDevice::OpenDeviceL Handle=%d"), aDeviceHandle); TInt err = iUsbDevice.Open(aHub, aDeviceHandle); @@ -106,32 +100,32 @@ User::Leave(KErrGeneral); } - TUint8 iProtocolId = ifDescriptor.InterfaceSubClass(); - TUint8 iTransportId = ifDescriptor.InterfaceProtocol(); + TUint8 iProtocolId = ifDescriptor.InterfaceSubClass(); + TUint8 iTransportId = ifDescriptor.InterfaceProtocol(); interface_ep0.Close(); THostMassStorageConfig msConfig; msConfig.iInterfaceToken = token; - msConfig.iProtocolId =iProtocolId; - msConfig.iTransportId = iTransportId; - msConfig.iStatusPollingInterval = 10; // 10 secs + msConfig.iProtocolId =iProtocolId; + msConfig.iTransportId = iTransportId; + msConfig.iStatusPollingInterval = 10; // 10 secs TUint32 numLun; TRequestStatus status; iUsbHostMsDevice.Add(msConfig, status); - User::WaitForRequest(status); - if (status.Int() != KErrNone) + User::WaitForRequest(status); + if (status.Int() != KErrNone) { - __USBHOSTPRINT(_L("Add device failed")); - User::Leave(status.Int()); + __USBHOSTPRINT(_L("Add device failed")); + User::Leave(status.Int()); } - TInt r = iUsbHostMsDevice.GetNumLun(numLun); - if (r != KErrNone) + TInt r = iUsbHostMsDevice.GetNumLun(numLun); + if (r != KErrNone) { - __USBHOSTPRINT(_L("GetNumLun failed")); - User::Leave(r); + __USBHOSTPRINT(_L("GetNumLun failed")); + User::Leave(r); } if (numLun > KMaxLun) @@ -151,8 +145,6 @@ void CDevice::CloseDeviceL() { - __MSFNLOG - THostMassStorageConfig msConfig; msConfig.iInterfaceToken = iDeviceToken; @@ -163,7 +155,6 @@ void CDevice::MountLogicalUnitsL() { - __MSFNLOG iExt.OpenL(); for (TInt lun = 0; lun < iNumLuns; lun++) @@ -184,7 +175,6 @@ void CDevice::DismountLogicalUnitsL() { - __MSFNLOG for (TInt lun = 0; lun < iLuList.Count(); lun++) { TDriveNumber driveNumber = iLuList[lun]; @@ -201,83 +191,79 @@ TUint8 aTransferType, TUint8 aDirection, TInt& aEndpointAddress) const - { - __MSFNSLOG + { + // Get the interface descriptor + RDebug::Print(_L("GetEndpointAddress : Getting the interface descriptor for this alternate setting")); - // Get the interface descriptor - RDebug::Print(_L("GetEndpointAddress : Getting the interface descriptor for this alternate setting")); - - TUsbInterfaceDescriptor alternateInterfaceDescriptor; - TInt err = aUsbInterface.GetAlternateInterfaceDescriptor(aInterfaceSetting, alternateInterfaceDescriptor); + TUsbInterfaceDescriptor alternateInterfaceDescriptor; + TInt err = aUsbInterface.GetAlternateInterfaceDescriptor(aInterfaceSetting, alternateInterfaceDescriptor); - if (err) - { - RDebug::Print(_L("GetEndpointAddress : Unable to get alternate interface (%d) descriptor"),err,aInterfaceSetting); - return err; - } + if (err) + { + RDebug::Print(_L("GetEndpointAddress : Unable to get alternate interface (%d) descriptor"),err,aInterfaceSetting); + return err; + } + + // Parse the descriptor tree from the interface + RDebug::Print(_L("Search the child descriptors for matching endpoint attributes")); - // Parse the descriptor tree from the interface - RDebug::Print(_L("Search the child descriptors for matching endpoint attributes")); + TUsbGenericDescriptor* descriptor = alternateInterfaceDescriptor.iFirstChild; - TUsbGenericDescriptor* descriptor = alternateInterfaceDescriptor.iFirstChild; + while (descriptor) + { + RDebug::Print(_L("GetEndpointAddress : Check descriptor type for endpoint")); - while (descriptor) - { - RDebug::Print(_L("GetEndpointAddress : Check descriptor type for endpoint")); + // Cast the descriptor to an endpoint descriptor + TUsbEndpointDescriptor* endpoint = TUsbEndpointDescriptor::Cast(descriptor); - // Cast the descriptor to an endpoint descriptor - TUsbEndpointDescriptor* endpoint = TUsbEndpointDescriptor::Cast(descriptor); + if (endpoint) + { + RDebug::Print(_L("GetEndpointAddress : Match attributes for transfer type")); - if (endpoint) - { - RDebug::Print(_L("GetEndpointAddress : Match attributes for transfer type")); - - if ( (endpoint->Attributes() & aTransferType) == aTransferType) - { - RDebug::Print(_L("GetEndpointAddress : Match attributes for endpoint direction")); + if ( (endpoint->Attributes() & aTransferType) == aTransferType) + { + RDebug::Print(_L("GetEndpointAddress : Match attributes for endpoint direction")); - if ( (endpoint->EndpointAddress() & 0x80) == aDirection) - { - aEndpointAddress = endpoint->EndpointAddress(); - RDebug::Print(_L("GetEndpointAddress : Endpoint address found")); - return KErrNone; - } - } - } + if ( (endpoint->EndpointAddress() & 0x80) == aDirection) + { + aEndpointAddress = endpoint->EndpointAddress(); + RDebug::Print(_L("GetEndpointAddress : Endpoint address found")); + return KErrNone; + } + } + } - descriptor = descriptor->iNextPeer; - } + descriptor = descriptor->iNextPeer; + } - // Unable to find the endpoint address - RDebug::Print(_L("GetEndpointAddress : Unable to find endpoint address matching the specified attributes")); + // Unable to find the endpoint address + RDebug::Print(_L("GetEndpointAddress : Unable to find endpoint address matching the specified attributes")); - return KErrNotFound; - } + return KErrNotFound; + } TBool CDevice::IsDeviceMassStorage(const TUsbInterfaceDescriptor& aInterfaceDesc, const TUsbDeviceDescriptor& aDeviceDesc) const { - __MSFNSLOG - /* check the interface descriptor */ - if(aInterfaceDesc.InterfaceClass() == 0x08 && - aInterfaceDesc.InterfaceSubClass() == 0x06 && - aInterfaceDesc.InterfaceProtocol() == 0x50) + /* check the interface descriptor */ + if(aInterfaceDesc.InterfaceClass() == 0x08 && + aInterfaceDesc.InterfaceSubClass() == 0x06 && + aInterfaceDesc.InterfaceProtocol() == 0x50) { - if(aDeviceDesc.DeviceClass() == 0x00 && - aDeviceDesc.DeviceSubClass() == 0x00 && - aDeviceDesc.DeviceProtocol() == 0x00) - return ETrue; + if(aDeviceDesc.DeviceClass() == 0x00 && + aDeviceDesc.DeviceSubClass() == 0x00 && + aDeviceDesc.DeviceProtocol() == 0x00) + return ETrue; } - return EFalse; + return EFalse; } TLun CDevice::DriveMap(TDriveMap& aDriveMap) const { - __MSFNSLOG TDriveNumber driveNumber; RDebug::Printf("LuList.Count=%d", iLuList.Count()); for (TInt i = 0; i < iLuList.Count(); i++) @@ -293,7 +279,6 @@ TLun CDevice::DeviceMap(TDeviceMap& aDeviceMap) const { - __MSFNSLOG TDriveNumber driveNumber; RDebug::Printf("LuList.Count=%d", iLuList.Count()); for (TInt i = 0; i < iLuList.Count(); i++) @@ -309,31 +294,27 @@ CUsbMsMountManager* CUsbMsMountManager::NewL() { - __MSFNSLOG - CUsbMsMountManager* r = new (ELeave) CUsbMsMountManager(); - CleanupStack::PushL(r); + CUsbMsMountManager* r = new (ELeave) CUsbMsMountManager(); + CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CUsbMsMountManager::ConstructL() { - __MSFNLOG } CUsbMsMountManager::CUsbMsMountManager() { - __MSFNLOG } CUsbMsMountManager::~CUsbMsMountManager() { - __MSFNLOG iDeviceList.ResetAndDestroy(); } @@ -341,23 +322,20 @@ // adds new entry for this device void CUsbMsMountManager::AddDeviceL(CDevice* aDevice) { - __MSFNLOG iDeviceList.Append(aDevice); } CDevice* CUsbMsMountManager::RemoveDeviceL(TUint aDeviceHandle) { - __MSFNLOG - TInt index = GetHandleIndexL(aDeviceHandle); - CDevice* device = iDeviceList[index]; + TInt index = GetHandleIndexL(aDeviceHandle); + CDevice* device = iDeviceList[index]; iDeviceList.Remove(index); return device; } void CUsbMsMountManager::CloseAllDevicesL() { - __MSFNLOG for (TInt i = 0; i < iDeviceList.Count(); i++) { iDeviceList[i]->CloseDeviceL(); @@ -367,7 +345,6 @@ TInt CUsbMsMountManager::GetDeviceIndexL(TToken aDeviceToken) const { - __MSFNSLOG TInt index; for (index = 0; index < iDeviceList.Count(); index++) { @@ -388,7 +365,6 @@ TInt CUsbMsMountManager::GetHandleIndexL(TUint aDeviceHandle) const { - __MSFNSLOG TInt index; for (index = 0; index < iDeviceList.Count(); index++) { @@ -411,7 +387,6 @@ // mounts all LUNs for the device void CUsbMsMountManager::MountDeviceL(TUint aDeviceHandle) { - __MSFNLOG TInt index = GetHandleIndexL(aDeviceHandle); iDeviceList[index]->MountLogicalUnitsL(); } @@ -421,7 +396,6 @@ // dismount all LUNs for this device void CUsbMsMountManager::DismountDeviceL(TUint aDeviceHandle) { - __MSFNLOG TInt index = GetHandleIndexL(aDeviceHandle); iDeviceList[index]->DismountLogicalUnitsL(); } @@ -430,7 +404,6 @@ // dismount all LUNs void CUsbMsMountManager::DismountL() { - __MSFNLOG for (TInt i = 0; i < iDeviceList.Count(); i++) { iDeviceList[i]->DismountLogicalUnitsL(); @@ -440,7 +413,6 @@ void CUsbMsMountManager::DriveMap(TDriveMap& aDriveMap) const { - __MSFNSLOG TInt maxLun = 0; RDebug::Printf("DeviceList.Count=%d", iDeviceList.Count()); for (TInt i = 0; i < iDeviceList.Count(); i++) @@ -453,7 +425,6 @@ void CUsbMsMountManager::DeviceMap(TInt aDeviceIndex, TDeviceMap& aDeviceMap) const { - __MSFNSLOG RDebug::Printf("Device=%d", aDeviceIndex); __ASSERT_DEBUG(aDeviceIndex < iDeviceList.Count(), User::Invariant()); @@ -468,215 +439,215 @@ } void TUsbPrint::PrintTree(const TUsbGenericDescriptor& aDesc, TInt aDepth) - { + { if (!iDebug) { return; } - TBuf<20> buf; - for(TInt depth=aDepth;depth>=0;--depth) - { - buf.Append(_L(" ")); - } - if(aDesc.iRecognisedAndParsed == TUsbGenericDescriptor::ERecognised) - { - RDebug::Print(_L("%S+0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType); - } - else - { - RDebug::Print(_L("%S-0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType); - } - HBufC* blob = HBufC::New(5*aDesc.iBlob.Length()); // 5* for " 0x" + 2*bytes for hex representation - if(blob) - { - for(TInt i=0;iDes().AppendFormat(_L("0x%02x "), aDesc.iBlob[i]); - } - RDebug::Print(_L("%S >%S"), &buf, blob); - delete blob; - } - if(aDesc.iFirstChild) - { - RDebug::Print(_L("%S \\ "), &buf); - PrintTree(*(aDesc.iFirstChild), aDepth+1); - RDebug::Print(_L("%S / "), &buf); - } - if(aDesc.iNextPeer) - { - PrintTree(*(aDesc.iNextPeer), aDepth); - } - } + TBuf<20> buf; + for(TInt depth=aDepth;depth>=0;--depth) + { + buf.Append(_L(" ")); + } + if(aDesc.iRecognisedAndParsed == TUsbGenericDescriptor::ERecognised) + { + RDebug::Print(_L("%S+0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType); + } + else + { + RDebug::Print(_L("%S-0x%08x - %d 0x%02x"), &buf, &aDesc, aDesc.ibLength, aDesc.ibDescriptorType); + } + HBufC* blob = HBufC::New(5*aDesc.iBlob.Length()); // 5* for " 0x" + 2*bytes for hex representation + if(blob) + { + for(TInt i=0;iDes().AppendFormat(_L("0x%02x "), aDesc.iBlob[i]); + } + RDebug::Print(_L("%S >%S"), &buf, blob); + delete blob; + } + if(aDesc.iFirstChild) + { + RDebug::Print(_L("%S \\ "), &buf); + PrintTree(*(aDesc.iFirstChild), aDepth+1); + RDebug::Print(_L("%S / "), &buf); + } + if(aDesc.iNextPeer) + { + PrintTree(*(aDesc.iNextPeer), aDepth); + } + } static TUint16 gLangId = 0x0000; void TUsbPrint::SetLanguageToPrintL(RUsbDevice& aDevice) - { + { if (!iDebug) return; - // Try to set language to US Eng, otherwise take the first one listed. - if(gLangId == 0x0000) // Only make the request if not been made before. - { - // Get string descriptor 0. - TBuf8<256> stringBuf; - TUsbStringDescriptor* stringDesc = NULL; - User::LeaveIfError(aDevice.GetStringDescriptor(stringDesc, stringBuf, 0)); - CleanupStack::PushL(*stringDesc); + // Try to set language to US Eng, otherwise take the first one listed. + if(gLangId == 0x0000) // Only make the request if not been made before. + { + // Get string descriptor 0. + TBuf8<256> stringBuf; + TUsbStringDescriptor* stringDesc = NULL; + User::LeaveIfError(aDevice.GetStringDescriptor(stringDesc, stringBuf, 0)); + CleanupStack::PushL(*stringDesc); - // Search for US English - TBool usEngLang = EFalse; - TInt langId = 0; - TInt index = 0; - const TUint16 KLangIdUsEng = 0x0409; - while(!usEngLang && langId != KErrNotFound) - { - langId = stringDesc->GetLangId(index); - usEngLang = (langId == KLangIdUsEng); - index++; - } + // Search for US English + TBool usEngLang = EFalse; + TInt langId = 0; + TInt index = 0; + const TUint16 KLangIdUsEng = 0x0409; + while(!usEngLang && langId != KErrNotFound) + { + langId = stringDesc->GetLangId(index); + usEngLang = (langId == KLangIdUsEng); + index++; + } - // Set the language appropriately - if(usEngLang) - { - gLangId = KLangIdUsEng; - } - else - { - gLangId = stringDesc->GetLangId(0); - } + // Set the language appropriately + if(usEngLang) + { + gLangId = KLangIdUsEng; + } + else + { + gLangId = stringDesc->GetLangId(0); + } - CleanupStack::PopAndDestroy(); // stringDesc - } - } + CleanupStack::PopAndDestroy(); // stringDesc + } + } void TUsbPrint::PrintStringFromIndex(const TDesC& aFormatString, TInt aIndex, RUsbDevice* aDevice) - { + { if (!iDebug) return; - // If we have no device handle, we cannot go and get any strings. - // If we have index 0, this indicates we don't have a string for this entry. - if(aDevice && aIndex != 0) - { - TRAPD(err, SetLanguageToPrintL(*aDevice)); - if(err == KErrNone) - { - TBuf8<255> stringBuf; - TUsbStringDescriptor* stringDesc = NULL; - err = aDevice->GetStringDescriptor(stringDesc, stringBuf, aIndex, gLangId); - if(err == KErrNone) - { - TBuf<128> buf; - stringDesc->StringData(buf); - RDebug::Print(aFormatString, &buf); - stringDesc->DestroyTree(); - } - delete stringDesc; - } - else - { - RDebug::Print(_L("Error while Selecting Langauge %d\n"), err); - } - } - } + // If we have no device handle, we cannot go and get any strings. + // If we have index 0, this indicates we don't have a string for this entry. + if(aDevice && aIndex != 0) + { + TRAPD(err, SetLanguageToPrintL(*aDevice)); + if(err == KErrNone) + { + TBuf8<255> stringBuf; + TUsbStringDescriptor* stringDesc = NULL; + err = aDevice->GetStringDescriptor(stringDesc, stringBuf, aIndex, gLangId); + if(err == KErrNone) + { + TBuf<128> buf; + stringDesc->StringData(buf); + RDebug::Print(aFormatString, &buf); + stringDesc->DestroyTree(); + } + delete stringDesc; + } + else + { + RDebug::Print(_L("Error while Selecting Langauge %d\n"), err); + } + } + } void TUsbPrint::PrintDescriptor(const TUsbDeviceDescriptor& aDeviceDesc, TInt /*aVariant*/, RUsbDevice* aDevice) - { + { if (!iDebug) return; - RDebug::Print(_L("USBBcd = 0x%04x\n"), aDeviceDesc.USBBcd()); - RDebug::Print(_L("DeviceClass = 0x%02x\n"), aDeviceDesc.DeviceClass()); - RDebug::Print(_L("DeviceSubClass = 0x%02x\n"), aDeviceDesc.DeviceSubClass()); - RDebug::Print(_L("DeviceProtocol = 0x%02x\n"), aDeviceDesc.DeviceProtocol()); - RDebug::Print(_L("MaxPacketSize0 = 0x%02x\n"), aDeviceDesc.MaxPacketSize0()); - RDebug::Print(_L("VendorId = 0x%04x\n"), aDeviceDesc.VendorId()); - RDebug::Print(_L("ProductId = 0x%04x\n"), aDeviceDesc.ProductId()); - RDebug::Print(_L("DeviceBcd = 0x%04x\n"), aDeviceDesc.DeviceBcd()); - RDebug::Print(_L("ManufacturerIndex = 0x%02x\n"), aDeviceDesc.ManufacturerIndex()); - PrintStringFromIndex(_L("ManufacturerString = %S\n"), aDeviceDesc.ManufacturerIndex(), aDevice); - RDebug::Print(_L("ProductIndex = 0x%02x\n"), aDeviceDesc.ProductIndex()); - PrintStringFromIndex(_L("ProductString = %S\n"), aDeviceDesc.ProductIndex(), aDevice); - RDebug::Print(_L("SerialNumberIndex = 0x%02x\n"), aDeviceDesc.SerialNumberIndex()); - PrintStringFromIndex(_L("SerialNumberString = %S\n"), aDeviceDesc.SerialNumberIndex(), aDevice); - RDebug::Print(_L("NumConfigurations = 0x%02x\n"), aDeviceDesc.NumConfigurations()); - } + RDebug::Print(_L("USBBcd = 0x%04x\n"), aDeviceDesc.USBBcd()); + RDebug::Print(_L("DeviceClass = 0x%02x\n"), aDeviceDesc.DeviceClass()); + RDebug::Print(_L("DeviceSubClass = 0x%02x\n"), aDeviceDesc.DeviceSubClass()); + RDebug::Print(_L("DeviceProtocol = 0x%02x\n"), aDeviceDesc.DeviceProtocol()); + RDebug::Print(_L("MaxPacketSize0 = 0x%02x\n"), aDeviceDesc.MaxPacketSize0()); + RDebug::Print(_L("VendorId = 0x%04x\n"), aDeviceDesc.VendorId()); + RDebug::Print(_L("ProductId = 0x%04x\n"), aDeviceDesc.ProductId()); + RDebug::Print(_L("DeviceBcd = 0x%04x\n"), aDeviceDesc.DeviceBcd()); + RDebug::Print(_L("ManufacturerIndex = 0x%02x\n"), aDeviceDesc.ManufacturerIndex()); + PrintStringFromIndex(_L("ManufacturerString = %S\n"), aDeviceDesc.ManufacturerIndex(), aDevice); + RDebug::Print(_L("ProductIndex = 0x%02x\n"), aDeviceDesc.ProductIndex()); + PrintStringFromIndex(_L("ProductString = %S\n"), aDeviceDesc.ProductIndex(), aDevice); + RDebug::Print(_L("SerialNumberIndex = 0x%02x\n"), aDeviceDesc.SerialNumberIndex()); + PrintStringFromIndex(_L("SerialNumberString = %S\n"), aDeviceDesc.SerialNumberIndex(), aDevice); + RDebug::Print(_L("NumConfigurations = 0x%02x\n"), aDeviceDesc.NumConfigurations()); + } void TUsbPrint::PrintDescriptor(const TUsbConfigurationDescriptor& aConfigDesc, TInt /*aVariant*/, RUsbDevice* aDevice) - { + { if (!iDebug) return; - RDebug::Print(_L("TotalLength = 0x%04x\n"), aConfigDesc.TotalLength()); - RDebug::Print(_L("NumInterfaces = 0x%02x\n"), aConfigDesc.NumInterfaces()); - RDebug::Print(_L("ConfigurationValue = 0x%02x\n"), aConfigDesc.ConfigurationValue()); - RDebug::Print(_L("ConfigurationIndex = 0x%02x\n"), aConfigDesc.ConfigurationIndex()); - PrintStringFromIndex(_L("ConfigurationString = %S\n"), aConfigDesc.ConfigurationIndex(), aDevice); - RDebug::Print(_L("Attributes = 0x%02x\n"), aConfigDesc.Attributes()); - RDebug::Print(_L("MaxPower = 0x%02x\n"), aConfigDesc.MaxPower()); - } + RDebug::Print(_L("TotalLength = 0x%04x\n"), aConfigDesc.TotalLength()); + RDebug::Print(_L("NumInterfaces = 0x%02x\n"), aConfigDesc.NumInterfaces()); + RDebug::Print(_L("ConfigurationValue = 0x%02x\n"), aConfigDesc.ConfigurationValue()); + RDebug::Print(_L("ConfigurationIndex = 0x%02x\n"), aConfigDesc.ConfigurationIndex()); + PrintStringFromIndex(_L("ConfigurationString = %S\n"), aConfigDesc.ConfigurationIndex(), aDevice); + RDebug::Print(_L("Attributes = 0x%02x\n"), aConfigDesc.Attributes()); + RDebug::Print(_L("MaxPower = 0x%02x\n"), aConfigDesc.MaxPower()); + } void TUsbPrint::PrintDescriptor(const TUsbEndpointDescriptor& aEndpointDesc, TInt /*aVariant*/, RUsbDevice* /*aDevice*/) - { + { if (!iDebug) return; - RDebug::Print(_L("EndpointAddress = 0x%02x\n"), aEndpointDesc.EndpointAddress()); - RDebug::Print(_L("Attributes = 0x%02x\n"), aEndpointDesc.Attributes()); - RDebug::Print(_L("MaxPacketSize = 0x%04x\n"), aEndpointDesc.MaxPacketSize()); - RDebug::Print(_L("Interval = 0x%02x\n"), aEndpointDesc.Interval()); - } + RDebug::Print(_L("EndpointAddress = 0x%02x\n"), aEndpointDesc.EndpointAddress()); + RDebug::Print(_L("Attributes = 0x%02x\n"), aEndpointDesc.Attributes()); + RDebug::Print(_L("MaxPacketSize = 0x%04x\n"), aEndpointDesc.MaxPacketSize()); + RDebug::Print(_L("Interval = 0x%02x\n"), aEndpointDesc.Interval()); + } void TUsbPrint::PrintDescriptor(const TUsbInterfaceDescriptor& aInterfaceDesc, TInt /*aVariant*/, RUsbDevice* /*aDevice*/) - { + { if (!iDebug) return; - RDebug::Print(_L("InterfaceNumber = 0x%02x\n"), aInterfaceDesc.InterfaceNumber()); - RDebug::Print(_L("AlternateSetting = 0x%02x\n"), aInterfaceDesc.AlternateSetting()); - RDebug::Print(_L("NumEndpoints = 0x%02x\n"), aInterfaceDesc.NumEndpoints()); - RDebug::Print(_L("InterfaceClass = 0x%02x\n"), aInterfaceDesc.InterfaceClass()); - RDebug::Print(_L("InterfaceSubClass = 0x%02x\n"), aInterfaceDesc.InterfaceSubClass()); - RDebug::Print(_L("InterfaceProtocol = 0x%02x\n"), aInterfaceDesc.InterfaceProtocol()); - RDebug::Print(_L("Interface = 0x%02x\n"), aInterfaceDesc.Interface()); - } + RDebug::Print(_L("InterfaceNumber = 0x%02x\n"), aInterfaceDesc.InterfaceNumber()); + RDebug::Print(_L("AlternateSetting = 0x%02x\n"), aInterfaceDesc.AlternateSetting()); + RDebug::Print(_L("NumEndpoints = 0x%02x\n"), aInterfaceDesc.NumEndpoints()); + RDebug::Print(_L("InterfaceClass = 0x%02x\n"), aInterfaceDesc.InterfaceClass()); + RDebug::Print(_L("InterfaceSubClass = 0x%02x\n"), aInterfaceDesc.InterfaceSubClass()); + RDebug::Print(_L("InterfaceProtocol = 0x%02x\n"), aInterfaceDesc.InterfaceProtocol()); + RDebug::Print(_L("Interface = 0x%02x\n"), aInterfaceDesc.Interface()); + } void TUsbPrint::PrintDescriptor(const TUsbStringDescriptor& aStringDesc, TInt aVariant, RUsbDevice* /*aDevice*/) - { + { if (!iDebug) return; - if(aVariant == 0) - { - RDebug::Print(_L("String Descriptor Zero\n")); - TInt index = 0; - TInt langId = 0; - while((langId = aStringDesc.GetLangId(index)) != KErrNotFound) - { - RDebug::Print(_L(" >0x%04x\n"), langId); - ++index; - } - } - else - { - RDebug::Print(_L("Generic String Descriptor\n")); - HBufC16* string = HBufC16::New(128); - if(string) - { - TPtr16 stringPtr = string->Des(); - aStringDesc.StringData(stringPtr); - RDebug::Print(_L(" >%S\n"), string); - } - delete string; - } - } + if(aVariant == 0) + { + RDebug::Print(_L("String Descriptor Zero\n")); + TInt index = 0; + TInt langId = 0; + while((langId = aStringDesc.GetLangId(index)) != KErrNotFound) + { + RDebug::Print(_L(" >0x%04x\n"), langId); + ++index; + } + } + else + { + RDebug::Print(_L("Generic String Descriptor\n")); + HBufC16* string = HBufC16::New(128); + if(string) + { + TPtr16 stringPtr = string->Des(); + aStringDesc.StringData(stringPtr); + RDebug::Print(_L(" >%S\n"), string); + } + delete string; + } + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/src/cusbotg.cpp --- a/kerneltest/f32test/shostmassstorage/msman/src/cusbotg.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/src/cusbotg.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -22,8 +22,6 @@ #include "cusbotgwatcher.h" #include "rusbmspublisher.h" - -#include "tmslog.h" #include "debug.h" _LIT(KOtgdiLddFileName, "otgdi"); @@ -32,13 +30,11 @@ ROtgStateChangeNotifier::ROtgStateChangeNotifier() : iRegistered(EFalse) { - __MSFNSLOG } ROtgStateChangeNotifier::~ROtgStateChangeNotifier() { - __MSFNSLOG if (iRegistered) iMessage.Complete(KErrDisconnected); } @@ -50,54 +46,48 @@ */ void ROtgStateChangeNotifier::Register(const RMessage2& aMessage) { - __MSFNLOG - iRegistered = ETrue; - iMessage = aMessage; + iRegistered = ETrue; + iMessage = aMessage; } void ROtgStateChangeNotifier::DoNotifyL() { - __MSFNLOG - CompleteNotifierL(KErrNone); + CompleteNotifierL(KErrNone); } void ROtgStateChangeNotifier::DoCancelL() { - __MSFNLOG - CompleteNotifierL(KErrCancel); + CompleteNotifierL(KErrCancel); } void ROtgStateChangeNotifier::CompleteNotifierL(TInt aReason) - { - __MSFNLOG - if (iRegistered) + { + if (iRegistered) { - TBool changed = ETrue; + TBool changed = ETrue; TPckgBuf p(changed); - iMessage.WriteL(0, p); - iMessage.Complete(aReason); - iRegistered = EFalse; + iMessage.WriteL(0, p); + iMessage.Complete(aReason); + iRegistered = EFalse; } - } + } CUsbOtg* CUsbOtg::NewL() - { - __MSFNSLOG - CUsbOtg* self = new (ELeave) CUsbOtg(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } + { + CUsbOtg* self = new (ELeave) CUsbOtg(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } void CUsbOtg::ConstructL() - { - __MSFNLOG + { TInt r = User::LoadLogicalDevice(KOtgdiLddFileName); @@ -126,19 +116,17 @@ } __USBOTGPRINT(_L(" otg stacks successfully started")); - } + } CUsbOtg::CUsbOtg() : iOtgState(KOtgStateStart) { - __MSFNLOG } CUsbOtg::~CUsbOtg() - { - __MSFNLOG + { Stop(); TInt r = iUsbOtgDriver.BusDrop(); @@ -153,15 +141,14 @@ } TInt err = User::FreeLogicalDevice(RUsbOtgDriver::Name()); - } + } void CUsbOtg::StartL() { - __MSFNLOG - // Request Otg notifications + // Request Otg notifications iOtgEventWatcher = CUsbOtgEventWatcher::NewL(iUsbOtgDriver, *this); - iOtgEventWatcher->Start(); + iOtgEventWatcher->Start(); iRequestSessionWatcher = CRequestSessionWatcher::NewL(*this); } @@ -172,8 +159,6 @@ * Stop the USB OTG events watcher */ { - __MSFNLOG - if (iOtgEventWatcher) { iOtgEventWatcher->Cancel(); @@ -191,7 +176,6 @@ void CUsbOtg::BusRequestL() { - __MSFNLOG if (iOtgState == KOtgStateAPlugInserted) { TInt err = iUsbOtgDriver.BusRequest(); @@ -208,8 +192,6 @@ void CUsbOtg::HandleUsbOtgEvent(RUsbOtgDriver::TOtgEvent aEvent) { - __MSFNLOG - switch (aEvent) { case RUsbOtgDriver::EEventAPlugInserted: @@ -245,26 +227,22 @@ TBool CUsbOtg::DeviceInserted() { - __MSFNLOG return iOtgState == KOtgStateAPlugInserted ? ETrue : EFalse; } void CUsbOtg::NotifyChange(const RMessage2& aMessage) { - __MSFNLOG iNotifier.Register(aMessage); } void CUsbOtg::NotifyChangeCancel() { - __MSFNLOG iNotifier.DoCancelL(); } TInt CUsbOtg::BusDrop() { - __MSFNLOG return iUsbOtgDriver.BusDrop(); } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/src/cusbotgwatcher.cpp --- a/kerneltest/f32test/shostmassstorage/msman/src/cusbotgwatcher.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/src/cusbotgwatcher.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -22,36 +22,31 @@ #include "cusbotg.h" #include "cusbotgwatcher.h" -#include "tmslog.h" #include "debug.h" CUsbOtgBaseWatcher::CUsbOtgBaseWatcher(RUsbOtgDriver& aLdd) : CActive(CActive::EPriorityStandard), iLdd(aLdd) - { - __MSFNLOG - CActiveScheduler::Add(this); - } + { + CActiveScheduler::Add(this); + } CUsbOtgBaseWatcher::~CUsbOtgBaseWatcher() - { - __MSFNLOG - Cancel(); - } + { + Cancel(); + } void CUsbOtgBaseWatcher::Start() - { - __MSFNLOG - Post(); - } + { + Post(); + } CRequestSessionWatcher* CRequestSessionWatcher::NewL(MUsbRequestSessionObserver& aObserver) { - __MSFNSLOG CRequestSessionWatcher* r = new (ELeave) CRequestSessionWatcher(aObserver); r->ConstructL(); return r; @@ -61,31 +56,27 @@ : CActive(EPriorityStandard), iObserver(aObserver) { - __MSFNLOG } void CRequestSessionWatcher::ConstructL() { - __MSFNLOG User::LeaveIfError(iProperty.Define(KUidUsbManCategory, KUsbRequestSessionProperty, RProperty::EInt)); User::LeaveIfError(iProperty.Attach(KUidUsbManCategory, KUsbRequestSessionProperty)); CActiveScheduler::Add(this); // initial subscription and process current property value - RunL(); + RunL(); } void CRequestSessionWatcher::DoCancel() - { - __MSFNLOG - iProperty.Cancel(); - } + { + iProperty.Cancel(); + } CRequestSessionWatcher::~CRequestSessionWatcher() { - __MSFNLOG Cancel(); iProperty.Close(); iProperty.Delete(KUidUsbManCategory, KUsbRequestSessionProperty); @@ -94,10 +85,9 @@ void CRequestSessionWatcher::RunL() { - __MSFNLOG - // resubscribe before processing new value to prevent missing updates - iProperty.Subscribe(iStatus); - SetActive(); + // resubscribe before processing new value to prevent missing updates + iProperty.Subscribe(iStatus); + SetActive(); TInt val; User::LeaveIfError(iProperty.Get(KUidUsbManCategory, KUsbRequestSessionProperty, val)); __USBOTGPRINT1(_L(">> CUsbRequestSessionWatcher[%d]"), val); @@ -117,7 +107,6 @@ TInt CRequestSessionWatcher::RunError(TInt aError) { - __MSFNLOG __USBOTGPRINT1(_L("CUsbRequestSessionWatcher::RunError[%d]"), aError); return KErrNone; } @@ -133,7 +122,6 @@ CUsbOtgEventWatcher* CUsbOtgEventWatcher::NewL(RUsbOtgDriver& aLdd, CUsbOtg& aUsbOtg) { - __MSFNSLOG CUsbOtgEventWatcher* r = new (ELeave) CUsbOtgEventWatcher(aLdd, aUsbOtg); r->ConstructL(); return r; @@ -144,40 +132,33 @@ : CUsbOtgBaseWatcher(aLdd), iUsbOtg(aUsbOtg) { - __MSFNLOG } void CUsbOtgEventWatcher::ConstructL() { - __MSFNLOG } void CUsbOtgEventWatcher::DoCancel() - { - __MSFNLOG + { iLdd.CancelOtgEventRequest(); - } + } CUsbOtgEventWatcher::~CUsbOtgEventWatcher() { - __MSFNLOG } void CUsbOtgEventWatcher::Post() { - __MSFNLOG iLdd.QueueOtgEventRequest(iEvent, iStatus); SetActive(); } void CUsbOtgEventWatcher::RunL() { - __MSFNLOG - TInt r = iStatus.Int(); User::LeaveIfError(r); @@ -190,7 +171,6 @@ TInt CUsbOtgEventWatcher::RunError(TInt aError) { - __MSFNLOG __USBOTGPRINT1(_L("CUsbRequestSessionWatcher::RunError[%d]"), aError); return KErrNone; } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/src/rextfilesystem.cpp --- a/kerneltest/f32test/shostmassstorage/msman/src/rextfilesystem.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/src/rextfilesystem.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -17,25 +17,22 @@ #include "rusbhostmsdevice.h" #include "rextfilesystem.h" -#include "tmslog.h" +#include "debug.h" _LIT(KFsNm, "elocal"); RExtFileSystem::RExtFileSystem() { - __MSFNLOG } RExtFileSystem::~RExtFileSystem() { - __MSFNLOG } void RExtFileSystem::OpenL() { - __MSFNLOG RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); @@ -59,7 +56,6 @@ void RExtFileSystem::CloseL() { - __MSFNLOG RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); @@ -73,8 +69,6 @@ TToken aToken, TLun aLun) { - __MSFNLOG - TTime start; TTime end; @@ -85,13 +79,13 @@ CleanupClosePushL(fs); TInt err; - err = aDevice.MountLun(aLun, aDriveNumber); - if (!(KErrAlreadyExists == err || KErrNotReady == err)) - { - __PRINT1(_L("** Error: MountLun returned %d **"), err); + err = aDevice.MountLun(aLun, aDriveNumber); + if (!(KErrAlreadyExists == err || KErrNotReady == err)) + { + __PRINT1(_L("** Error: MountLun returned %d **"), err); RDebug::Print(_L("** Error: MountLun returned %d **"), err); User::LeaveIfError(err); - } + } CleanupStack::PopAndDestroy(&fs); @@ -109,11 +103,10 @@ void RExtFileSystem::DismountL(RUsbHostMsDevice& aDevice, TDriveNumber aDriveNumber) { - __MSFNLOG RFs fs; User::LeaveIfError(fs.Connect()); __PRINT(_L("DismountFileSystem")); - //TInt err = aDevice.DismountLun(aDriveNumber); + //TInt err = aDevice.DismountLun(aDriveNumber); aDevice.DismountLun(aDriveNumber); fs.Close(); } @@ -129,7 +122,7 @@ TInt drive; for (drive = EDriveG; drive <= EDriveZ; drive++) - { + { // Skip K drive which is reserved for LFFS but shows as being free if (drive == EDriveK) { diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/cblockdevicetester.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/cblockdevicetester.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/cblockdevicetester.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -20,7 +20,6 @@ #include #include -#include "tmslog.h" #include "cblockdevicetester.h" extern RTest test; @@ -38,7 +37,6 @@ void TLocalBuffer::Init() { - __MSFNSLOG TInt64 rndSeed = 123456789; //-- initialize buffer with random rubbish @@ -65,34 +63,29 @@ RTargetMedia::RTargetMedia(TInt aDriveNumber) : iDriveNumber(aDriveNumber) { - __MSFNSLOG } void RTargetMedia::OpenL() { - __MSFNSLOG User::LeaveIfError(iRawDisk.Open(fsSession, iDriveNumber)); } void RTargetMedia::Close() { - __MSFNSLOG iRawDisk.Close(); } TInt RTargetMedia::MediaRawWrite(TPos aPos, const TDesC8& aData) { - __MSFNSLOG return iRawDisk.Write(aPos, (TDesC8&)aData); } TInt RTargetMedia::MediaRawRead(TPos aPos, TUint32 aLen, TDes8& aData) { - __MSFNSLOG aData.SetMax(); TPtr8 ptr = aData.LeftTPtr(aLen); TInt err = iRawDisk.Read(aPos, ptr); @@ -108,7 +101,6 @@ TInt RTargetDrive::OpenTestAreaL(const TDesC8& aData) { - __MSFNSLOG RTargetMedia::OpenL(); iStartLba = 0x20; @@ -121,7 +113,6 @@ TInt RTargetDrive::Update(TInt aPos, TUint aLen) { - __MSFNSLOG TPtrC8 ptr = iSource.Mid(aPos, aLen); TPos targetPos = TargetPos(aPos); return MediaRawWrite(targetPos, ptr); @@ -130,7 +121,6 @@ TInt RTargetDrive::Verify() { - __MSFNLOG TInt res = MediaRawRead(StartPos(), iSource.Length(), iTmpBuffer); if (res) return res; @@ -141,7 +131,6 @@ TInt RTargetDrive::Verify(TInt aPos, TUint aLen) { - __MSFNSLOG TPos pos = TargetPos(aPos); TInt res = MediaRawRead(pos, aLen, iTmpBuffer); if (res) @@ -157,7 +146,6 @@ TInt RTargetDrive::VerifyBlock(TLba aLba, TLba aBlocks) { - __MSFNSLOG return Verify(TLbaUtils::Pos(aLba), TLbaUtils::Length(aBlocks)); } @@ -168,12 +156,10 @@ TTargetTestArea::TTargetTestArea(RTargetMedia& aMedia) : iTargetMedia(aMedia) { - __MSFNLOG } void TTargetTestArea::CreateControlFile() { - __MSFNLOG iStartLba = -1; static const TInt KBlockSize = 0x200; static const TInt KFileSize = KBlockSize * 8; @@ -196,7 +182,6 @@ void TTargetTestArea::RemoveControlFile() { - __MSFNLOG TInt err = fsSession.Delete(KTxtControlFile); test(err == KErrNone); } @@ -204,7 +189,6 @@ void TTargetTestArea::FindBlockStartL() { - __MSFNLOG iTargetMedia.OpenL(); // search for first block TBuf8 readBlock; @@ -237,7 +221,6 @@ TInt TTargetTestArea::WriteBlockL(TBuf8& aBlock) { - __MSFNLOG iTargetMedia.OpenL(); TInt err = iTargetMedia.MediaRawWrite(iStartLba * KBlockSize, aBlock); iTargetMedia.Close(); @@ -247,7 +230,6 @@ TInt TTargetTestArea::ReadBlockL(TBuf8& aBlock) { - __MSFNLOG iTargetMedia.OpenL(); TInt err = iTargetMedia.MediaRawRead(iStartLba * KBlockSize, KBlockSize, aBlock); iTargetMedia.Close(); @@ -258,13 +240,11 @@ RBlockTargetMedia::RBlockTargetMedia(TInt aDriveNumber) : RTargetMedia(aDriveNumber) { - __MSFNSLOG } void RBlockTargetMedia::OpenL() { - __MSFNSLOG RTargetMedia::OpenL(); TInt64 rndSeed = 123456789; @@ -280,7 +260,6 @@ TInt RBlockTargetMedia::WriteBlock(TLba aLba) { - __MSFNSLOG TPos pos = TLbaUtils::Pos(aLba); return iRawDisk.Write(pos, (TDesC8&)iBlockData); } @@ -288,7 +267,6 @@ TInt RBlockTargetMedia::ReadBlock(TLba aLba) { - __MSFNSLOG TBuf8 blockData; TPos pos = TLbaUtils::Pos(aLba); blockData.SetMax(); @@ -299,19 +277,17 @@ CBlockDeviceTester* CBlockDeviceTester::NewL(TInt aDriveNumber) { - __MSFNSLOG - CBlockDeviceTester* r = new (ELeave) CBlockDeviceTester(aDriveNumber); - CleanupStack::PushL(r); + CBlockDeviceTester* r = new (ELeave) CBlockDeviceTester(aDriveNumber); + CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CBlockDeviceTester::ConstructL() { - __MSFNLOG TVolumeInfo volumeInfo; User::LeaveIfError(fsSession.Volume(volumeInfo, iDriveNumber)); @@ -326,13 +302,11 @@ : iDriveNumber(aDriveNumber), iTargetDrive(aDriveNumber) { - __MSFNLOG } CBlockDeviceTester::~CBlockDeviceTester() { - __MSFNLOG iTargetDrive.Close(); } @@ -351,14 +325,12 @@ TInt CBlockDeviceTester::VerifyDrive() { - __MSFNLOG return iTargetDrive.Verify(); } TInt CBlockDeviceTester::Update(TPos aPos, TUint aLen) { - __MSFNLOG iLocalBuffer.Update(aPos, aLen); return iTargetDrive.Update(aPos, aLen); } @@ -366,20 +338,17 @@ TInt CBlockDeviceTester::UpdateBlock(TLba aLba, TLba aBlocks) { - __MSFNLOG return Update(TLbaUtils::Pos(aLba), TLbaUtils::Length(aBlocks)); } TInt CBlockDeviceTester::Verify(TPos aPos, TUint aLen) { - __MSFNLOG return iTargetDrive.Verify(aPos, aLen); } TInt CBlockDeviceTester::VerifyBlock(TLba aLba, TLba aBlocks) { - __MSFNLOG return iTargetDrive.VerifyBlock(aLba, aBlocks); } @@ -388,19 +357,17 @@ */ CBotTester* CBotTester::NewL(TInt aDriveNumber) { - __MSFNSLOG - CBotTester* r = new (ELeave) CBotTester(aDriveNumber); - CleanupStack::PushL(r); + CBotTester* r = new (ELeave) CBotTester(aDriveNumber); + CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CBotTester::ConstructL() { - __MSFNLOG CBlockDeviceTester::ConstructL(); @@ -421,20 +388,17 @@ CBotTester::CBotTester(TInt aDriveNumber) : CBlockDeviceTester(aDriveNumber) { - __MSFNLOG } CBotTester::~CBotTester() { - __MSFNLOG iTargetDrive.Close(); } TInt CBotTester::SetTest(TTestCase aTestCase) { - __MSFNLOG iCmdBuffer[KTestCaseDataOffset] = static_cast(aTestCase); TPos pos = KSetTestPos; @@ -444,7 +408,6 @@ TInt CBotTester::WriteEnableFile() { - __MSFNLOG TPos pos = KWriteEnableFilePos; return iTargetDrive.MediaRawWrite(pos, iOutEnableBuffer); } @@ -452,7 +415,6 @@ TInt CBotTester::InitReadEnableFile() { - __MSFNLOG TPos pos = KReadEnableFilePos; return iTargetDrive.MediaRawWrite(pos, iInEnableBuffer); } @@ -460,7 +422,6 @@ TInt CBotTester::ReadEnableFile() { - __MSFNLOG TBuf8 readBuf(KInEnableBufferSize); TPos pos = KReadEnableFilePos; return iTargetDrive.MediaRawRead(pos, readBuf.Size(), readBuf); @@ -472,20 +433,17 @@ */ CSbcErrTester* CSbcErrTester::NewL(TInt aDriveNumber) { - __MSFNSLOG - CSbcErrTester* r = new (ELeave) CSbcErrTester(aDriveNumber); - CleanupStack::PushL(r); + CSbcErrTester* r = new (ELeave) CSbcErrTester(aDriveNumber); + CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CSbcErrTester::ConstructL() { - __MSFNLOG - CBlockDeviceTester::ConstructL(); iCmdBuffer.Append(KTxtTestCaseOutPreamble); @@ -505,20 +463,17 @@ CSbcErrTester::CSbcErrTester(TInt aDriveNumber) : CBlockDeviceTester(aDriveNumber) { - __MSFNLOG } CSbcErrTester::~CSbcErrTester() { - __MSFNLOG iTargetDrive.Close(); } TInt CSbcErrTester::WriteTestFile() { - __MSFNLOG TPos pos = KWriteTestFilePos; return iTargetDrive.MediaRawWrite(pos, iEnableBuffer); } @@ -526,7 +481,6 @@ TInt CSbcErrTester::ReadTestFile() { - __MSFNLOG TBuf8 readBuf(KEnableBufferSize); TPos pos = KReadTestFilePos; TInt err = iTargetDrive.MediaRawRead(pos, readBuf.Size(), readBuf); @@ -536,7 +490,6 @@ TInt CSbcErrTester::WriteSenseErrorFile(TTestSenseError aTestSenseError) { - __MSFNLOG iSenseErrorBuffer[KTestCaseDataOffset] = static_cast(aTestSenseError); TPos pos = KSenseErrorFile; return iTargetDrive.MediaRawWrite(pos, iSenseErrorBuffer); @@ -545,18 +498,16 @@ CWrPrTester* CWrPrTester::NewL(TInt aDriveNumber) { - __MSFNSLOG - CWrPrTester* r = new (ELeave) CWrPrTester(aDriveNumber); - CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + CWrPrTester* r = new (ELeave) CWrPrTester(aDriveNumber); + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CWrPrTester::ConstructL() { - __MSFNLOG iCmdBuffer.Append(KTxtTestCaseOutPreamble); iCmdBuffer.Append(KTxtTestConfig); iCmdBuffer.AppendFill('c', iCmdBuffer.MaxLength() - iCmdBuffer.Length()); @@ -574,20 +525,17 @@ : iTargetMedia(aDriveNumber), iTargetTestArea(iTargetMedia) { - __MSFNLOG } CWrPrTester::~CWrPrTester() { - __MSFNLOG iTargetTestArea.RemoveControlFile(); } void CWrPrTester::SetWriteProtectL() { - __MSFNLOG // first write WrPr CLR Control block to media to enable setting to be // cleared iInCmdBuffer[KTestCaseDataOffset] = ETestConfigMediaWpClr; @@ -605,7 +553,6 @@ void CWrPrTester::ClrWriteProtectL() { - __MSFNLOG test.Printf(_L("Clearing WRITE PROTECT")); TInt err = KErrNone; // Write protect so read the control file from the drive @@ -623,7 +570,6 @@ TInt CWrPrTester::SetRemovableL() { - __MSFNLOG iCmdBuffer[KTestCaseDataOffset] = ETestConfigMediaRmbSet; iTargetMedia.OpenL(); TInt err = iTargetMedia.MediaRawWrite(KCmdPos, iCmdBuffer); @@ -633,7 +579,6 @@ TInt CWrPrTester::ClrRemovableL() { - __MSFNLOG iCmdBuffer[KTestCaseDataOffset] = ETestConfigMediaRmbClr; iTargetMedia.OpenL(); TInt err = iTargetMedia.MediaRawWrite(KCmdPos, iCmdBuffer); @@ -644,7 +589,6 @@ TInt CWrPrTester::WriteReadTestL() { - __MSFNLOG TInt err = KErrNone; TBuf8 wrBuffer; diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msblock.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msblock.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msblock.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -30,7 +30,6 @@ #include "cmsdrive.h" #include "tmsprintdrive.h" #include "ttestutils.h" -#include "tmslog.h" using namespace F32_Test_Utils; diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msblock.mmp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msblock.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msblock.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -14,41 +14,37 @@ // Verify read/write access of block deivce. // -TARGET t_msblock.exe +TARGET t_msblock.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../client -USERINCLUDE ../../../server +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../client +USERINCLUDE ../../../server USERINCLUDE ../../../fileutils/inc -SOURCEPATH . -SOURCE rfsydebug.cpp -SOURCE cblockdevicetester.cpp -SOURCE ttestutils.cpp -SOURCE cmsdrive.cpp -SOURCE tmsprintdrive.cpp +SOURCEPATH . +SOURCE rfsydebug.cpp +SOURCE cblockdevicetester.cpp +SOURCE ttestutils.cpp +SOURCE cmsdrive.cpp +SOURCE tmsprintdrive.cpp -SOURCE t_msmain.cpp -SOURCE t_msblock.cpp +SOURCE t_msmain.cpp +SOURCE t_msblock.cpp + +SOURCEPATH ../../../fileutils/src +SOURCE f32_test_utils.cpp + +LIBRARY msmanclient.lib efsrv.lib euser.lib -SOURCEPATH ../shared -SOURCE tmslog.cpp - -SOURCEPATH ../../../fileutils/src -SOURCE f32_test_utils.cpp - -LIBRARY msmanclient.lib efsrv.lib euser.lib - - -//MACRO _TESTAPP_DEBUG_PRINT_ +//MACRO _TESTAPP_DEBUG_PRINT_ CAPABILITY ALL -UID 0 0x10285B2E +UID 0 0x10285B2E SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msbot.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msbot.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msbot.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -28,7 +28,6 @@ #include "cmsdrive.h" #include "tmsprintdrive.h" #include "ttestutils.h" -#include "tmslog.h" extern CMsDrive* msDrive; @@ -164,19 +163,17 @@ CTestBot* CTestBot::NewL() { - __MSFNSLOG - CTestBot* r = new (ELeave) CTestBot(); - CleanupStack::PushL(r); + CTestBot* r = new (ELeave) CTestBot(); + CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CTestBot::ConstructL() { - __MSFNLOG TInt driveNumber = msDrive->DriveNumber(); iBotTester = CBotTester::NewL(driveNumber); } @@ -184,14 +181,12 @@ CTestBot::CTestBot() { - __MSFNLOG } CTestBot::~CTestBot() { - __MSFNLOG delete iBotTester; } @@ -206,7 +201,6 @@ */ void CTestBot::CswResetRecovery(CBotTester::TTestCase aTestCase, const TDesC& aTestName) { - __MSFNLOG TInt res; test.Start(aTestName); @@ -237,7 +231,6 @@ void CTestBot::NoDataResetRecovery(CBotTester::TTestCase aTestCase, const TDesC& aTestName) { - __MSFNLOG TInt res; test.Start(aTestName); @@ -264,7 +257,6 @@ void CTestBot::NoDataClearStall(CBotTester::TTestCase aTestCase, const TDesC& aTestName) { - __MSFNLOG TInt res; test.Start(aTestName); @@ -303,7 +295,6 @@ void CTestBot::DataOutClearStall(CBotTester::TTestCase aTestCase, const TDesC& aTestName) { - __MSFNLOG TInt res; test.Start(aTestName); @@ -342,7 +333,6 @@ void CTestBot::DataInClearStall(CBotTester::TTestCase aTestCase, const TDesC& aTestName) { - __MSFNLOG TInt res; test.Start(aTestName); @@ -393,7 +383,6 @@ */ void CTestBot::tTagMismatch() { - __MSFNLOG CswResetRecovery(CBotTester::ETestCaseTagMismatch, KTagMismatch); } @@ -406,7 +395,6 @@ */ void CTestBot::tInvalidSignature() { - __MSFNLOG CswResetRecovery(CBotTester::ETestCaseInvalidSignature, KInvalidSignature); } @@ -419,7 +407,6 @@ */ void CTestBot::tNoDataStallCsw() { - __MSFNLOG NoDataClearStall(CBotTester::ETestCaseNoDataStallCsw, KNoDataStallCsw); } @@ -430,35 +417,30 @@ */ void CTestBot::tNoDataPhaseError() { - __MSFNLOG NoDataResetRecovery(CBotTester::ETestCaseNoDataPhaseError, KNoDataPhaseError); } void CTestBot::tDoStallCsw() { - __MSFNLOG DataOutClearStall(CBotTester::ETestCaseDoStallCsw, KDoStallCsw); } void CTestBot::tDoStallData() { - __MSFNLOG DataOutClearStall(CBotTester::ETestCaseDoStallData, KDoStallData); } void CTestBot::tDoPhaseError() { - __MSFNLOG CswResetRecovery(CBotTester::ETestCaseDoPhaseError, KDoPhaseError); } void CTestBot::tDoResidue() { - __MSFNLOG TInt res; test.Start(KDoResidue); res = iBotTester->SetTest(CBotTester::ETestCaseDoResidue); @@ -484,28 +466,24 @@ void CTestBot::tDiStallCsw() { - __MSFNLOG DataInClearStall(CBotTester::ETestCaseDiStallCsw, KDiStallCsw); } void CTestBot::tDiStallData() { - __MSFNLOG DataInClearStall(CBotTester::ETestCaseDiStallData, KDiStallData); } void CTestBot::tDiPhaseError() { - __MSFNLOG CswResetRecovery(CBotTester::ETestCaseDiPhaseError, KDiPhaseError); } void CTestBot::tDiResidue() { - __MSFNLOG TInt res; test.Start(KDiResidue); diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msbot.mmp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msbot.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msbot.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -15,38 +15,33 @@ // -TARGET t_msbot.exe +TARGET t_msbot.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../client -USERINCLUDE ../../../server +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../client +USERINCLUDE ../../../server -SOURCEPATH . -SOURCE rfsydebug.cpp -SOURCE cblockdevicetester.cpp -SOURCE ttestutils.cpp -SOURCE cmsdrive.cpp -SOURCE tmsprintdrive.cpp +SOURCEPATH . +SOURCE rfsydebug.cpp +SOURCE cblockdevicetester.cpp +SOURCE ttestutils.cpp +SOURCE cmsdrive.cpp +SOURCE tmsprintdrive.cpp -SOURCE t_msmain.cpp -SOURCE t_msbot.cpp +SOURCE t_msmain.cpp +SOURCE t_msbot.cpp + +LIBRARY msmanclient.lib efsrv.lib euser.lib -SOURCEPATH ../shared -SOURCE tmslog.cpp - - -LIBRARY msmanclient.lib efsrv.lib euser.lib - - -// MACRO _TESTAPP_DEBUG_PRINT_ +// MACRO _TESTAPP_DEBUG_PRINT_ CAPABILITY ALL -UID 0 0x10285B2E +UID 0 0x10285B2E SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msformat.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msformat.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msformat.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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,7 +23,6 @@ #include "cmsdrive.h" #include "tmsprintdrive.h" -#include "tmslog.h" extern CMsDrive* msDrive; diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msformat.mmp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msformat.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msformat.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -14,33 +14,30 @@ // Test format of Mass Storage is successful // -TARGET t_msformat.exe +TARGET t_msformat.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../client +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../client -SOURCEPATH . -SOURCE rfsydebug.cpp -SOURCE ttestutils.cpp -SOURCE cmsdrive.cpp -SOURCE tmsprintdrive.cpp -SOURCE t_msmain.cpp -SOURCE t_msformat.cpp +SOURCEPATH . +SOURCE rfsydebug.cpp +SOURCE ttestutils.cpp +SOURCE cmsdrive.cpp +SOURCE tmsprintdrive.cpp +SOURCE t_msmain.cpp +SOURCE t_msformat.cpp -SOURCEPATH ../shared -SOURCE tmslog.cpp - -LIBRARY msmanclient.lib efsrv.lib euser.lib +LIBRARY msmanclient.lib efsrv.lib euser.lib -// MACRO _TESTAPP_DEBUG_PRINT_ +// MACRO _TESTAPP_DEBUG_PRINT_ CAPABILITY ALL -UID 0 0x10285B2E +UID 0 0x10285B2E SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msmain.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msmain.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msmain.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -26,13 +26,12 @@ #include "rusbhostsession.h" #include "rusbotgsession.h" #include "cmsdrive.h" -#include "tmslog.h" /* -OTG Platform configuration -Define for H4 and undefine for Navi Engine +OTG Platform configuration +Define for H4 and undefine for Navi Engine */ -#define _OTG_CONFIG +#define _OTG_CONFIG extern RTest test; extern RFs fsSession; @@ -44,8 +43,6 @@ GLDEF_C void MainL() { - __MSFNSLOG - TInt err; CleanupClosePushL(fsSession); User::LeaveIfError(fsSession.Connect()); @@ -70,7 +67,7 @@ TRequestStatus status; test.Printf(_L("Waiting for hub inserted event...\n")); usbOtgSession.NotifyChange(change, status); - + User::WaitForRequest(status); User::LeaveIfError(status.Int()); @@ -135,7 +132,7 @@ test(EFalse); } - + test.Printf(_L("Destroying sessions...\n")); test.Printf(_L("Destroying USB Host session...\n")); CleanupStack::PopAndDestroy(&usbHostSession); @@ -154,16 +151,16 @@ GLDEF_C TInt E32Main() - { + { CTrapCleanup* cleanup = CTrapCleanup::New(); - __UHEAP_MARK; + __UHEAP_MARK; test.Title(); test.Start(_L("Starting tests...")); - TTime timerC; - timerC.HomeTime(); + TTime timerC; + timerC.HomeTime(); - TRAPD(err, MainL()); + TRAPD(err, MainL()); test(err == KErrNone); TTime endTimeC; @@ -173,10 +170,10 @@ test(err == KErrNone); test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int()); - test.End(); - test.Close(); - __UHEAP_MARKEND; - delete cleanup; - return KErrNone; - } + test.End(); + test.Close(); + __UHEAP_MARKEND; + delete cleanup; + return KErrNone; + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msman.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msman.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msman.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -24,7 +24,6 @@ #include #include "tmsprintdrive.h" -#include "tmslog.h" #include "cmsdrive.h" diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msman.mmp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msman.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msman.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -14,33 +14,30 @@ // Utility to mount connected USB device as a Mass Storage drive. // -TARGET t_msman.exe +TARGET t_msman.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../client +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../client -SOURCEPATH . -SOURCE rfsydebug.cpp -SOURCE ttestutils.cpp -SOURCE cmsdrive.cpp -SOURCE tmsprintdrive.cpp -SOURCE t_msmain.cpp -SOURCE t_msman.cpp +SOURCEPATH . +SOURCE rfsydebug.cpp +SOURCE ttestutils.cpp +SOURCE cmsdrive.cpp +SOURCE tmsprintdrive.cpp +SOURCE t_msmain.cpp +SOURCE t_msman.cpp -SOURCEPATH ../shared -SOURCE tmslog.cpp - -LIBRARY msmanclient.lib efsrv.lib euser.lib +LIBRARY msmanclient.lib efsrv.lib euser.lib -// MACRO _TESTAPP_DEBUG_PRINT_ +// MACRO _TESTAPP_DEBUG_PRINT_ CAPABILITY ALL -UID 0 0x10285B2E +UID 0 0x10285B2E SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msrmb.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msrmb.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msrmb.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -27,7 +27,6 @@ #include "tmsprintdrive.h" #include "ttestutils.h" #include "cblockdevicetester.h" -#include "tmslog.h" extern CMsDrive* msDrive; diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msrmb.mmp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msrmb.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msrmb.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -33,9 +33,6 @@ SOURCE t_msmain.cpp SOURCE t_msrmb.cpp -SOURCEPATH ../shared -SOURCE tmslog.cpp - SOURCEPATH ../../../fileutils/src SOURCE f32_test_utils.cpp diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_mssbcerr.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_mssbcerr.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_mssbcerr.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -28,7 +28,6 @@ #include "cmsdrive.h" #include "tmsprintdrive.h" #include "ttestutils.h" -#include "tmslog.h" extern CMsDrive* msDrive; @@ -57,19 +56,17 @@ CTestSbcErr* CTestSbcErr::NewL() { - __MSFNSLOG - CTestSbcErr* r = new (ELeave) CTestSbcErr(); - CleanupStack::PushL(r); + CTestSbcErr* r = new (ELeave) CTestSbcErr(); + CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CTestSbcErr::ConstructL() { - __MSFNLOG TInt driveNumber = msDrive->DriveNumber(); iSbcErrTester = CSbcErrTester::NewL(driveNumber); } @@ -77,21 +74,18 @@ CTestSbcErr::CTestSbcErr() { - __MSFNLOG } CTestSbcErr::~CTestSbcErr() { - __MSFNLOG delete iSbcErrTester; } void CTestSbcErr::tTest1() { - __MSFNLOG TInt res; test.Start(_L("tTest1\n")); @@ -109,7 +103,6 @@ void CTestSbcErr::tTest2() { - __MSFNLOG TInt res; test.Start(_L("tTest2\n")); @@ -138,7 +131,6 @@ void CTestSbcErr::tTest3() { - __MSFNLOG TInt res; test.Start(_L("tTest3\n")); diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_mssbcerr.mmp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_mssbcerr.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_mssbcerr.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -15,39 +15,34 @@ // -TARGET t_mssbcerr.exe +TARGET t_mssbcerr.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../client -USERINCLUDE ../../../server +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../client +USERINCLUDE ../../../server -SOURCEPATH . -SOURCE rfsydebug.cpp -SOURCE cblockdevicetester.cpp -SOURCE ttestutils.cpp -SOURCE cmsdrive.cpp -SOURCE tmsprintdrive.cpp +SOURCEPATH . +SOURCE rfsydebug.cpp +SOURCE cblockdevicetester.cpp +SOURCE ttestutils.cpp +SOURCE cmsdrive.cpp +SOURCE tmsprintdrive.cpp -SOURCE t_msmain.cpp -SOURCE t_mssbcerr.cpp +SOURCE t_msmain.cpp +SOURCE t_mssbcerr.cpp + +LIBRARY msmanclient.lib efsrv.lib euser.lib -SOURCEPATH ../shared -SOURCE tmslog.cpp - - -LIBRARY msmanclient.lib efsrv.lib euser.lib - - -// MACRO _TESTAPP_DEBUG_PRINT_ +// MACRO _TESTAPP_DEBUG_PRINT_ CAPABILITY ALL -UID 0 0x10285B2E +UID 0 0x10285B2E SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_mssuspend.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_mssuspend.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_mssuspend.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -26,7 +26,6 @@ #include "cmsdrive.h" #include "tmsprintdrive.h" #include "ttestutils.h" -#include "tmslog.h" extern CMsDrive* msDrive; diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_mssuspend.mmp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_mssuspend.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_mssuspend.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -14,36 +14,31 @@ // Check that host enters suspend and resumes properly // -TARGET t_mssuspend.exe +TARGET t_mssuspend.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../client -USERINCLUDE ../../../server +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../client +USERINCLUDE ../../../server -SOURCEPATH . -SOURCE rfsydebug.cpp -SOURCE ttestutils.cpp -SOURCE cmsdrive.cpp -SOURCE tmsprintdrive.cpp -SOURCE t_msmain.cpp -SOURCE t_mssuspend.cpp +SOURCEPATH . +SOURCE rfsydebug.cpp +SOURCE ttestutils.cpp +SOURCE cmsdrive.cpp +SOURCE tmsprintdrive.cpp +SOURCE t_msmain.cpp +SOURCE t_mssuspend.cpp + +LIBRARY msmanclient.lib efsrv.lib euser.lib - -SOURCEPATH ../shared -SOURCE tmslog.cpp - -LIBRARY msmanclient.lib efsrv.lib euser.lib - - -//MACRO _TESTAPP_DEBUG_PRINT_ +//MACRO _TESTAPP_DEBUG_PRINT_ CAPABILITY ALL -UID 0 0x10285B2E +UID 0 0x10285B2E SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msvbus.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msvbus.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msvbus.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -30,7 +30,6 @@ #include "cmsdrive.h" #include "tmsprintdrive.h" #include "ttestutils.h" -#include "tmslog.h" RTest test(_L("T_MSVBUS")); RFs fsSession; @@ -96,8 +95,6 @@ GLDEF_C void MainL() { - __MSFNSLOG - TInt err; RUsbHostSession usbHostSession; @@ -132,16 +129,16 @@ GLDEF_C TInt E32Main() - { + { CTrapCleanup* cleanup = CTrapCleanup::New(); - __UHEAP_MARK; + __UHEAP_MARK; test.Title(); test.Start(_L("Starting tests...")); - TTime timerC; - timerC.HomeTime(); + TTime timerC; + timerC.HomeTime(); - TRAPD(err, MainL()); + TRAPD(err, MainL()); if (err != KErrNone) { @@ -155,9 +152,9 @@ test(err == KErrNone); test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int()); - test.End(); - test.Close(); - __UHEAP_MARKEND; - delete cleanup; - return KErrNone; - } + test.End(); + test.Close(); + __UHEAP_MARKEND; + delete cleanup; + return KErrNone; + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_msvbus.mmp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msvbus.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msvbus.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -15,34 +15,30 @@ // -TARGET t_msvbus.exe +TARGET t_msvbus.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../client -USERINCLUDE ../../../server +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../client +USERINCLUDE ../../../server -SOURCEPATH . -SOURCE rfsydebug.cpp -SOURCE ttestutils.cpp -SOURCE cmsdrive.cpp -SOURCE tmsprintdrive.cpp -SOURCE t_msvbus.cpp +SOURCEPATH . +SOURCE rfsydebug.cpp +SOURCE ttestutils.cpp +SOURCE cmsdrive.cpp +SOURCE tmsprintdrive.cpp +SOURCE t_msvbus.cpp + +LIBRARY msmanclient.lib efsrv.lib euser.lib -SOURCEPATH ../shared -SOURCE tmslog.cpp - -LIBRARY msmanclient.lib efsrv.lib euser.lib - - -MACRO _TESTAPP_DEBUG_PRINT_ +MACRO _TESTAPP_DEBUG_PRINT_ CAPABILITY ALL -UID 0 0x10285B2E +UID 0 0x10285B2E SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_mswrpr.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_mswrpr.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_mswrpr.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -27,7 +27,6 @@ #include "tmsprintdrive.h" #include "ttestutils.h" #include "cblockdevicetester.h" -#include "tmslog.h" extern CMsDrive* msDrive; diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/t_mswrpr.mmp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_mswrpr.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_mswrpr.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -14,37 +14,32 @@ // Check that host detects WRITE PROTECT status flag // -TARGET t_mswrpr.exe +TARGET t_mswrpr.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE . -USERINCLUDE ../shared -USERINCLUDE ../client -USERINCLUDE ../../../server +USERINCLUDE . +USERINCLUDE ../shared +USERINCLUDE ../client +USERINCLUDE ../../../server -SOURCEPATH . -SOURCE rfsydebug.cpp -SOURCE cblockdevicetester.cpp -SOURCE ttestutils.cpp -SOURCE cmsdrive.cpp -SOURCE tmsprintdrive.cpp -SOURCE t_msmain.cpp -SOURCE t_mswrpr.cpp +SOURCEPATH . +SOURCE rfsydebug.cpp +SOURCE cblockdevicetester.cpp +SOURCE ttestutils.cpp +SOURCE cmsdrive.cpp +SOURCE tmsprintdrive.cpp +SOURCE t_msmain.cpp +SOURCE t_mswrpr.cpp + +LIBRARY msmanclient.lib efsrv.lib euser.lib - -SOURCEPATH ../shared -SOURCE tmslog.cpp - -LIBRARY msmanclient.lib efsrv.lib euser.lib - - -// MACRO _TESTAPP_DEBUG_PRINT_ +// MACRO _TESTAPP_DEBUG_PRINT_ CAPABILITY ALL -UID 0 0x10285B2E +UID 0 0x10285B2E SMPSAFE diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/msman/test/ttestutils.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/ttestutils.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/msman/test/ttestutils.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // USB Host Mass Storage -// +// // @@ -26,7 +26,6 @@ #include "ttestutils.h" -#include "tmslog.h" #include "e32test.h" #include "e32debug.h" @@ -46,7 +45,6 @@ void TTestUtils::WaitForBusEventL() { - __MSFNSLOG _LIT_SECURITY_POLICY_PASS(KMsAllowAllPolicy); _LIT_SECURITY_POLICY_S0(KMsWritePolicy, KUsbmanSvrSid.iUid); @@ -74,7 +72,6 @@ TBool TTestUtils::WaitForConnectionStateEventL() { - __MSFNSLOG _LIT_SECURITY_POLICY_PASS(KMsAllowAllPolicy); _LIT_SECURITY_POLICY_S0(KMsWritePolicy, KUsbmanSvrSid.iUid); diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cmassstoragefilesystem.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cmassstoragefilesystem.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cmassstoragefilesystem.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // CMassStorageFileSystem implementation. -// +// // @@ -34,7 +34,6 @@ #include "cmassstoragefilesystem.h" #include "cmassstoragemountcb.h" #include "debug.h" -#include "msdebug.h" #include "massstorage.h" _LIT(KMsFsyName, "MassStorageFileSystem"); @@ -45,40 +44,36 @@ LOCAL_D const TInt KMsFsyMinorVersionNumber=0; CMassStorageFileSystem::CMassStorageFileSystem() - { - __MSFNLOG - } + { + } CMassStorageFileSystem::~CMassStorageFileSystem() - { - __MSFNLOG - //Kill the controller thread if it exists - delete iMassStorageController; - iMediaChangedStatusList.Close(); - RThread thread; - TInt err = thread.Open(KMsThreadName); - if (err == KErrNone) - { - thread.Kill(1); //Parameter is irrelevant - } - thread.Close(); - iDriveMap.Close(); - } + { + //Kill the controller thread if it exists + delete iMassStorageController; + iMediaChangedStatusList.Close(); + RThread thread; + TInt err = thread.Open(KMsThreadName); + if (err == KErrNone) + { + thread.Kill(1); //Parameter is irrelevant + } + thread.Close(); + iDriveMap.Close(); + } CMassStorageFileSystem* CMassStorageFileSystem::NewL() - { - __MSFNSLOG - CMassStorageFileSystem* self = new (ELeave) CMassStorageFileSystem(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } + { + CMassStorageFileSystem* self = new (ELeave) CMassStorageFileSystem(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } void CMassStorageFileSystem::ConstructL() - { - __MSFNLOG - } + { + } /** Set the file system version and name @@ -86,45 +81,43 @@ @return Any of the standard Symbian error codes. */ TInt CMassStorageFileSystem::Install() - { - __MSFNLOG - iVersion=TVersion(KMsFsyMajorVersionNumber, KMsFsyMinorVersionNumber, KF32BuildVersionNumber); - TInt err = SetName(&KMsFsyName); - return err; - } + { + iVersion=TVersion(KMsFsyMajorVersionNumber, KMsFsyMinorVersionNumber, KF32BuildVersionNumber); + TInt err = SetName(&KMsFsyName); + return err; + } TInt CMassStorageFileSystem::Remove() - { - __MSFNLOG - TInt err = KErrNone; - if (iInstalled) - { - // Try connecting to the server to send a shutdown message. - // - If the class controller has a session in use, this will return KErrInUse - RUsbMassStorage usbMs; - err = usbMs.Connect(); - if(err == KErrNone) - { - err = usbMs.Shutdown(); - usbMs.Close(); + { + TInt err = KErrNone; + if (iInstalled) + { + // Try connecting to the server to send a shutdown message. + // - If the class controller has a session in use, this will return KErrInUse + RUsbMassStorage usbMs; + err = usbMs.Connect(); + if(err == KErrNone) + { + err = usbMs.Shutdown(); + usbMs.Close(); - if(err == KErrNone) - { - User::WaitForRequest(iThreadStat); - err = iThreadStat.Int(); - } - else - { - __PRINT1(_L("CMassStorageFileSystem::Remove Shutdown Error %d\n"),err); - } - } - else - { - __PRINT1(_L("CMassStorageFileSystem::Remove Connect Error %d\n"),err); - } - } - return(err); - } + if(err == KErrNone) + { + User::WaitForRequest(iThreadStat); + err = iThreadStat.Int(); + } + else + { + __PRINT1(_L("CMassStorageFileSystem::Remove Shutdown Error %d\n"),err); + } + } + else + { + __PRINT1(_L("CMassStorageFileSystem::Remove Connect Error %d\n"),err); + } + } + return(err); + } /** Creates a new Mass Storage mount object. @@ -133,14 +126,13 @@ @leave KErrNotReady if the Mass Storage controller is not running. */ CMountCB* CMassStorageFileSystem::NewMountL() const - { - __MSFNSLOG - if (!iRunning) - { - User::Leave(KErrNotReady); - } - return CMassStorageMountCB::NewL(iDriveMap); - } + { + if (!iRunning) + { + User::Leave(KErrNotReady); + } + return CMassStorageMountCB::NewL(iDriveMap); + } /** Sets the media attributes and type in the aInfo parameter to those of the specified drive. @@ -149,18 +141,17 @@ @param aDriveNumber The number of the drive to get the information from. */ void CMassStorageFileSystem::DriveInfo(TDriveInfo& aInfo, TInt aDriveNumber) const - { - __MSFNSLOG - TLocalDriveCapsV2Buf caps; - if (!IsValidLocalDriveMapping(aDriveNumber)) - { - return; - } - GetLocalDrive(aDriveNumber).Caps(caps); - aInfo.iMediaAtt=caps().iMediaAtt; + { + TLocalDriveCapsV2Buf caps; + if (!IsValidLocalDriveMapping(aDriveNumber)) + { + return; + } + GetLocalDrive(aDriveNumber).Caps(caps); + aInfo.iMediaAtt=caps().iMediaAtt; aInfo.iType = ::EMediaNotPresent; // Media is not available to the file system - aInfo.iDriveAtt=caps().iDriveAtt; - } + aInfo.iDriveAtt=caps().iDriveAtt; + } /** Returns a reference to the Mass Storage controller. @@ -168,68 +159,65 @@ @return Reference to the Mass Storage controller. */ CUsbMassStorageController& CMassStorageFileSystem::Controller() - { - __MSFNLOG - return *iMassStorageController; - } + { + return *iMassStorageController; + } /** Fill iMsDrives with a mapping of lun->drive number for supported mass storage drives */ TInt CMassStorageFileSystem::EnumerateMsDrivesL() - { - __MSFNLOG - iDriveMap.Reset(); - TInt driveCount = 0; + { + iDriveMap.Reset(); + TInt driveCount = 0; - TLocalDriveCapsV2Buf caps; + TLocalDriveCapsV2Buf caps; - for (TInt i = EDriveC; i < KMaxDrives; i++) - { - caps.FillZ(); + for (TInt i = EDriveC; i < KMaxDrives; i++) + { + caps.FillZ(); - if (IsValidLocalDriveMapping(i)) - { - TInt err = GetLocalDrive(i).Caps(caps); - TInt locDrvNum = DriveNumberToLocalDriveNumber(i); - __PRINT2(_L("Caps: err=%d, att=%d\n"), err, caps().iDriveAtt); + if (IsValidLocalDriveMapping(i)) + { + TInt err = GetLocalDrive(i).Caps(caps); + TInt locDrvNum = DriveNumberToLocalDriveNumber(i); + __PRINT2(_L("Caps: err=%d, att=%d\n"), err, caps().iDriveAtt); - TBool isRemovable = err==KErrNotReady || (caps().iDriveAtt & KDriveAttRemovable); - __PRINT2(_L("EnumerateMsDrives: Drive %c: is %sremovable\n"), - 'A'+i-EDriveA, - isRemovable?_S(""):_S("NOT ")); + TBool isRemovable = err==KErrNotReady || (caps().iDriveAtt & KDriveAttRemovable); + __PRINT2(_L("EnumerateMsDrives: Drive %c: is %sremovable\n"), + 'A'+i-EDriveA, + isRemovable?_S(""):_S("NOT ")); - if (isRemovable) - { - // - // STF: Connect to the local drive here. This gives us the media changed flag, and - // our own TBusLocalDrive object for use by the proxy drive and controller. + if (isRemovable) + { + // + // STF: Connect to the local drive here. This gives us the media changed flag, and + // our own TBusLocalDrive object for use by the proxy drive and controller. // TMediaChangedStatus mediaChanged; iMediaChangedStatusList.AppendL(mediaChanged); TBool& mediaChangedRef = iMediaChangedStatusList[driveCount].iMediaChanged; - TInt err = iMediaChangedStatusList[driveCount].iLocalDrive.Connect(locDrvNum, mediaChangedRef); - if (err == KErrNone) - { - iDriveMap.Append(static_cast (i)); - } - driveCount++; - } - } - } + TInt err = iMediaChangedStatusList[driveCount].iLocalDrive.Connect(locDrvNum, mediaChangedRef); + if (err == KErrNone) + { + iDriveMap.Append(static_cast (i)); + } + driveCount++; + } + } + } - __PRINT1(_L("EnumerateMsDrives Out, %d MS drives found\n"), driveCount); - return driveCount; - } + __PRINT1(_L("EnumerateMsDrives Out, %d MS drives found\n"), driveCount); + return driveCount; + } TBool CMassStorageFileSystem::IsExtensionSupported() const - { - __MSFNSLOG - return ETrue; - } + { + return ETrue; + } /** Creates a TrapCleanup and ActiveScheduler and initializes the Mass Storage controller. @@ -238,82 +226,79 @@ @return Any of the standard Symbian error codes. */ TInt CMassStorageFileSystem::InitThread() - { - __MSFNLOG - - //Give the thread a name so we can kill it later - User::RenameThread(KMsThreadName); + { + //Give the thread a name so we can kill it later + User::RenameThread(KMsThreadName); - CTrapCleanup* cleanup = CTrapCleanup::New(); - if (cleanup == NULL) - { - return KErrNoMemory; - } + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (cleanup == NULL) + { + return KErrNoMemory; + } - TRAPD(err, InitThreadL()); + TRAPD(err, InitThreadL()); - delete cleanup; + delete cleanup; - __PRINT1(_L("CMassStorageFileSystem::InitThread Out, error=%d\n"), err); - return err; - } + __PRINT1(_L("CMassStorageFileSystem::InitThread Out, error=%d\n"), err); + return err; + } TInt CMassStorageFileSystem::InitThreadL() - { - __MSFNLOG - RSemaphore gSemThreadReady; - gSemThreadReady.OpenGlobal(KMsFsysSemName); + { + RSemaphore gSemThreadReady; + gSemThreadReady.OpenGlobal(KMsFsysSemName); - // Determine which drives are available for Mass Storage. - // (this also creates a local TBusLocalDrive for use by the drive controller) - EnumerateMsDrivesL(); + // Determine which drives are available for Mass Storage. + // (this also creates a local TBusLocalDrive for use by the drive controller) + EnumerateMsDrivesL(); - CActiveScheduler* sched = new (ELeave) CActiveScheduler; - if (sched == NULL) - { - gSemThreadReady.Signal(); - User::Leave(KErrNoMemory); - } - CleanupStack::PushL(sched); - CActiveScheduler::Install(sched); + CActiveScheduler* sched = new (ELeave) CActiveScheduler; + if (sched == NULL) + { + gSemThreadReady.Signal(); + User::Leave(KErrNoMemory); + } + CleanupStack::PushL(sched); + CActiveScheduler::Install(sched); - iMassStorageController = CUsbMassStorageController::NewL(); - if (iMassStorageController == NULL) - { - gSemThreadReady.Signal(); - User::Leave(KErrNoMemory); - } + iMassStorageController = CUsbMassStorageController::NewL(); + if (iMassStorageController == NULL) + { + gSemThreadReady.Signal(); + User::Leave(KErrNoMemory); + } - __PRINT(_L("CMassStorageFileSystem::InitThread: Creating Mass Storage Controller\n")); - TRAPD(err, iMassStorageController->CreateL(iDriveMap)); - if (err != KErrNone) - { - gSemThreadReady.Signal(); - CActiveScheduler::Install(NULL); - User::Leave(err); - } + __PRINT(_L("CMassStorageFileSystem::InitThread: Creating Mass Storage Controller\n")); + TRAPD(err, iMassStorageController->CreateL(iDriveMap)); + if (err != KErrNone) + { + gSemThreadReady.Signal(); + CActiveScheduler::Install(NULL); + User::Leave(err); + } - CleanupStack::Pop(sched); + CleanupStack::Pop(sched); - iRunning = ETrue; - gSemThreadReady.Signal(); - gSemThreadReady.Close(); - CActiveScheduler::Start(); + iRunning = ETrue; + gSemThreadReady.Signal(); + gSemThreadReady.Close(); + CActiveScheduler::Start(); //========= stop thread ================ - delete iMassStorageController; - iMassStorageController = NULL; + delete iMassStorageController; + iMassStorageController = NULL; - for (TInt i=0; i < iMediaChangedStatusList.Count(); i++) - { + for (TInt i=0; i < iMediaChangedStatusList.Count(); i++) + { iMediaChangedStatusList[i].iLocalDrive.Disconnect(); - } - iMediaChangedStatusList.Reset(); + } + iMediaChangedStatusList.Reset(); - delete sched; - iRunning = EFalse; - return KErrNone; - } + delete sched; + iRunning = EFalse; + return KErrNone; + } /** Not supported in Mass Storage file system. @@ -321,11 +306,10 @@ @leave KErrNotReady */ CFileCB* CMassStorageFileSystem::NewFileL() const - { - __MSFNSLOG - User::Leave(KErrNotReady); - return NULL; - } + { + User::Leave(KErrNotReady); + return NULL; + } /** Not supported in Mass Storage file system. @@ -333,11 +317,10 @@ @leave KErrNotReady */ CDirCB* CMassStorageFileSystem::NewDirL() const - { - __MSFNSLOG - User::Leave(KErrNotReady); - return NULL; - } + { + User::Leave(KErrNotReady); + return NULL; + } /** Not supported in Mass Storage file system. @@ -345,11 +328,10 @@ @leave KErrNotReady */ CFormatCB* CMassStorageFileSystem::NewFormatL() const - { - __MSFNSLOG - User::Leave(KErrNotReady); - return NULL; - } + { + User::Leave(KErrNotReady); + return NULL; + } /** Not supported in Mass Storage file system. @@ -357,10 +339,9 @@ @return KErrNotSupported */ TInt CMassStorageFileSystem::DefaultPath(TDes& /*aPath*/) const - { - __MSFNSLOG - return KErrNotSupported; - } + { + return KErrNotSupported; + } /** Not supported in Mass Storage file system. @@ -368,66 +349,65 @@ @return KErrNotSupported */ TInt CMassStorageFileSystem::DriveList(TDriveList& /*aList*/) const - { - __MSFNSLOG - return KErrNotSupported; - } + { + return KErrNotSupported; + } /** Thread entry point. */ LOCAL_C TInt MsInitThreadFn(TAny* aPtr) - { - User::SetCritical(User::ESystemCritical); - ((CMassStorageFileSystem*)aPtr)->InitThread(); - //Rename the thread so we can create a new one with the same original name later - User::RenameThread(KMsDeadThreadName); - return KErrNone; - } + { + User::SetCritical(User::ESystemCritical); + ((CMassStorageFileSystem*)aPtr)->InitThread(); + //Rename the thread so we can create a new one with the same original name later + User::RenameThread(KMsDeadThreadName); + return KErrNone; + } /** Standard entry point for file systems. Creates a new file system object and starts a new thread for the Mass Storage controller. */ extern "C" EXPORT_C CFileSystem* CreateFileSystem() - { - __PRINT(_L("CMassStorageFileSystem::CreateFileSystem In\n")); - RSemaphore gSemThreadReady; - TInt err = gSemThreadReady.CreateGlobal(KMsFsysSemName, 0); - if (err != KErrNone) - { - __PRINT1(_L("CMassStorageFileSystem::CreateFileSystem Out Semaphore Error %d\n"),err); - return NULL; - } + { + __PRINT(_L("CMassStorageFileSystem::CreateFileSystem In\n")); + RSemaphore gSemThreadReady; + TInt err = gSemThreadReady.CreateGlobal(KMsFsysSemName, 0); + if (err != KErrNone) + { + __PRINT1(_L("CMassStorageFileSystem::CreateFileSystem Out Semaphore Error %d\n"),err); + return NULL; + } - CFileSystem* msFsys = NULL; - TRAP(err, msFsys = CMassStorageFileSystem::NewL()); - if (err != KErrNone) - { - __PRINT1(_L("CMassStorageFileSystem::CreateFileSystem Out MSFS Error %d\n"),err); - gSemThreadReady.Close(); - return NULL; - } + CFileSystem* msFsys = NULL; + TRAP(err, msFsys = CMassStorageFileSystem::NewL()); + if (err != KErrNone) + { + __PRINT1(_L("CMassStorageFileSystem::CreateFileSystem Out MSFS Error %d\n"),err); + gSemThreadReady.Close(); + return NULL; + } - RThread msThread; - __PRINT(_L("CMassStorageFileSystem::CreateFileSystem: Creating Mass Storage thread\n")); - err = msThread.Create(KMsThreadName, MsInitThreadFn, KDefaultStackSize, NULL, msFsys); - if (err != KErrNone) - { - __PRINT1(_L("CMassStorageFileSystem::CreateFileSystem Out Thread Error %d\n"),err); - gSemThreadReady.Close(); - return msFsys; - } - ((CMassStorageFileSystem*)msFsys)->iInstalled=ETrue; + RThread msThread; + __PRINT(_L("CMassStorageFileSystem::CreateFileSystem: Creating Mass Storage thread\n")); + err = msThread.Create(KMsThreadName, MsInitThreadFn, KDefaultStackSize, NULL, msFsys); + if (err != KErrNone) + { + __PRINT1(_L("CMassStorageFileSystem::CreateFileSystem Out Thread Error %d\n"),err); + gSemThreadReady.Close(); + return msFsys; + } + ((CMassStorageFileSystem*)msFsys)->iInstalled=ETrue; - msThread.Logon(((CMassStorageFileSystem*)msFsys)->iThreadStat); - msThread.Resume(); - gSemThreadReady.Wait(); - gSemThreadReady.Close(); - msThread.Close(); + msThread.Logon(((CMassStorageFileSystem*)msFsys)->iThreadStat); + msThread.Resume(); + gSemThreadReady.Wait(); + gSemThreadReady.Close(); + msThread.Close(); - __PRINT(_L("CMassStorageFileSystem::CreateFileSystem Out Clean\n")); + __PRINT(_L("CMassStorageFileSystem::CreateFileSystem Out Clean\n")); - return msFsys; - } + return msFsys; + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cmassstoragemountcb.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cmassstoragemountcb.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cmassstoragemountcb.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // CMassStorageMountCB implementation. -// +// // @@ -37,13 +37,13 @@ CMassStorageMountCB::CMassStorageMountCB(const TLunToDriveMap& aDriveMapping) : iDriveMapping(aDriveMapping) - { - } + { + } CMassStorageMountCB* CMassStorageMountCB::NewL(const TLunToDriveMap& aDriveMapping) - { - return new (ELeave) CMassStorageMountCB(aDriveMapping); - } + { + return new (ELeave) CMassStorageMountCB(aDriveMapping); + } /** Checks that the drive number is supported. @@ -51,18 +51,17 @@ @leave KErrNotReady The drive number is not supported. */ TInt CMassStorageMountCB::CheckDriveNumberL() - { - __FNLOG("CMassStorageMountCB::CheckDriveNumberL"); - TInt driveNumber; - driveNumber = Drive().DriveNumber(); - if (!IsValidLocalDriveMapping(driveNumber)) - { - __PRINT1(_L("CMassStorageMountCB::CheckDriveNumberL: Drive number %d not supported"), driveNumber); - User::Leave(KErrNotReady); - } - __PRINT1(_L("CMassStorageMountCB::CheckDriveNumberL: Drive number = %d"), driveNumber); - return driveNumber; - } + { + TInt driveNumber; + driveNumber = Drive().DriveNumber(); + if (!IsValidLocalDriveMapping(driveNumber)) + { + __PRINT1(_L("CMassStorageMountCB::CheckDriveNumberL: Drive number %d not supported"), driveNumber); + User::Leave(KErrNotReady); + } + __PRINT1(_L("CMassStorageMountCB::CheckDriveNumberL: Drive number = %d"), driveNumber); + return driveNumber; + } /** Registers the drive with the Mass Storage drive manager. @@ -70,56 +69,54 @@ @leave KErrNotSupported The drive is not compatible with Mass Storage. */ void CMassStorageMountCB::MountL(TBool /*aForceMount*/) - { - __FNLOG("CMassStorageMountCB::MountL"); + { + CheckDriveNumberL(); + CMassStorageFileSystem& msFsys = *reinterpret_cast(Drive().GetFSys()); - CheckDriveNumberL(); - CMassStorageFileSystem& msFsys = *reinterpret_cast(Drive().GetFSys()); - - TInt lun = DriveNumberToLun(Drive().DriveNumber()); + TInt lun = DriveNumberToLun(Drive().DriveNumber()); - if(lun < 0) - { - // This is not a supported Mass Storage drive - User::Leave(KErrNotSupported); - } + if(lun < 0) + { + // This is not a supported Mass Storage drive + User::Leave(KErrNotSupported); + } - TBusLocalDrive& localDrive = msFsys.iMediaChangedStatusList[lun].iLocalDrive; + TBusLocalDrive& localDrive = msFsys.iMediaChangedStatusList[lun].iLocalDrive; - TInt err = CreateLocalDrive(localDrive); - User::LeaveIfError(err); + TInt err = CreateLocalDrive(localDrive); + User::LeaveIfError(err); - CProxyDrive* proxyDrive = LocalDrive(); + CProxyDrive* proxyDrive = LocalDrive(); - TLocalDriveCapsV2Buf caps; - err = localDrive.Caps(caps); + TLocalDriveCapsV2Buf caps; + err = localDrive.Caps(caps); - //Make sure file system is FAT and removable - if (err == KErrNone) - { - err = KErrNotSupported; - if ((caps().iDriveAtt & KDriveAttRemovable) == KDriveAttRemovable) - { - if (caps().iType != EMediaNotPresent) - { - err = KErrNone; - } - } - } + //Make sure file system is FAT and removable + if (err == KErrNone) + { + err = KErrNotSupported; + if ((caps().iDriveAtt & KDriveAttRemovable) == KDriveAttRemovable) + { + if (caps().iType != EMediaNotPresent) + { + err = KErrNone; + } + } + } - if (err != KErrNone && err != KErrNotReady) - { - __PRINT1(_L("CMassStorageMountCB::MountL: Drive is not compatible with Mass Storage, err=%d"), err); - User::Leave(err); - } + if (err != KErrNone && err != KErrNotReady) + { + __PRINT1(_L("CMassStorageMountCB::MountL: Drive is not compatible with Mass Storage, err=%d"), err); + User::Leave(err); + } - __PRINT(_L("CMassStorageMountCB::MountL: Registering drive")); - // Set media changed to true so that Win2K doesn't used cached drive data - TBool& mediaChanged = msFsys.iMediaChangedStatusList[lun].iMediaChanged; + __PRINT(_L("CMassStorageMountCB::MountL: Registering drive")); + // Set media changed to true so that Win2K doesn't used cached drive data + TBool& mediaChanged = msFsys.iMediaChangedStatusList[lun].iMediaChanged; mediaChanged = ETrue; - msFsys.Controller().DriveManager().RegisterDriveL(*proxyDrive, mediaChanged, lun); - SetVolumeName(_L("MassStorage").AllocL()); - } + msFsys.Controller().DriveManager().RegisterDriveL(*proxyDrive, mediaChanged, lun); + SetVolumeName(_L("MassStorage").AllocL()); + } /** Returns the LUN that corresponds to the specified drive number. @@ -127,39 +124,37 @@ @param aDriveNumber The drive number. */ TInt CMassStorageMountCB::DriveNumberToLun(TInt aDriveNumber) - { - __FNLOG("CMassStorageMountCB::DriveNumberToLun"); - TInt lun = -1; - for (TInt i = 0; i < iDriveMapping.Count(); i++) - { - if (iDriveMapping[i] == aDriveNumber) - { - lun = i; - break; - } - } - __PRINT2(_L("CMassStorageMountCB::DriveNumberToLun: Drive %d maps to LUN %d"), aDriveNumber, lun); - return lun; - } + { + TInt lun = -1; + for (TInt i = 0; i < iDriveMapping.Count(); i++) + { + if (iDriveMapping[i] == aDriveNumber) + { + lun = i; + break; + } + } + __PRINT2(_L("CMassStorageMountCB::DriveNumberToLun: Drive %d maps to LUN %d"), aDriveNumber, lun); + return lun; + } /** Deregisters the drive from the Drive Manager. */ void CMassStorageMountCB::Dismounted() - { - __FNLOG("CMassStorageMountCB::Dismounted"); - TInt driveNumber = -1; - TRAPD(err, driveNumber = CheckDriveNumberL()); - if (err != KErrNone) - { - return; - } - __PRINT(_L("CMassStorageMountCB::Dismounted: Deregistering drive")); + { + TInt driveNumber = -1; + TRAPD(err, driveNumber = CheckDriveNumberL()); + if (err != KErrNone) + { + return; + } + __PRINT(_L("CMassStorageMountCB::Dismounted: Deregistering drive")); CMassStorageFileSystem& msFsys = *reinterpret_cast(Drive().GetFSys()); - msFsys.Controller().DriveManager().DeregisterDrive(DriveNumberToLun(driveNumber)); + msFsys.Controller().DriveManager().DeregisterDrive(DriveNumberToLun(driveNumber)); - DismountedLocalDrive(); - } + DismountedLocalDrive(); + } /** Unlocks the drive with the specified password, optionally storing the password for later use. @@ -168,196 +163,194 @@ @param aStore True if the password is to be stored. */ TInt CMassStorageMountCB::Unlock(TMediaPassword& aPassword, TBool aStore) - { - __FNLOG("CMassStorageMountCB::Unlock"); - TInt driveNumber = -1; - TRAPD(err, driveNumber = CheckDriveNumberL()); - if (err != KErrNone) - { - return err; - } - TBusLocalDrive& localDrive=GetLocalDrive(driveNumber); - if(localDrive.Status() == KErrLocked) - { - localDrive.Status() = KErrNotReady; - } - TInt r = localDrive.Unlock(aPassword, aStore); - if(r == KErrNone && aStore) - { - WritePasswordData(); - } - return(r); - } + { + TInt driveNumber = -1; + TRAPD(err, driveNumber = CheckDriveNumberL()); + if (err != KErrNone) + { + return err; + } + TBusLocalDrive& localDrive=GetLocalDrive(driveNumber); + if(localDrive.Status() == KErrLocked) + { + localDrive.Status() = KErrNotReady; + } + TInt r = localDrive.Unlock(aPassword, aStore); + if(r == KErrNone && aStore) + { + WritePasswordData(); + } + return(r); + } /** Stores the password for the drive to the password file. */ void CMassStorageMountCB::WritePasswordData() - { - __FNLOG("CMassStorageMountCB::WritePasswordData"); - TBusLocalDrive& local=GetLocalDrive(Drive().DriveNumber()); - TInt length = local.PasswordStoreLengthInBytes(); - if(length==0) - { - TBuf mediaPWrdFile(KMediaPWrdFile); - mediaPWrdFile[0] = (TUint8) RFs::GetSystemDriveChar(); - WriteToDisk(mediaPWrdFile,_L8("")); - return; - } - HBufC8* hDes=HBufC8::New(length); - if(hDes==NULL) - { - return; - } - TPtr8 pDes=hDes->Des(); - TInt r=local.ReadPasswordData(pDes); - if(r==KErrNone) - { - TBuf mediaPWrdFile(KMediaPWrdFile); - mediaPWrdFile[0] = (TUint8) RFs::GetSystemDriveChar(); - WriteToDisk(mediaPWrdFile,pDes); - } - delete hDes; - } + { + TBusLocalDrive& local=GetLocalDrive(Drive().DriveNumber()); + TInt length = local.PasswordStoreLengthInBytes(); + if(length==0) + { + TBuf mediaPWrdFile(KMediaPWrdFile); + mediaPWrdFile[0] = (TUint8) RFs::GetSystemDriveChar(); + WriteToDisk(mediaPWrdFile,_L8("")); + return; + } + HBufC8* hDes=HBufC8::New(length); + if(hDes==NULL) + { + return; + } + TPtr8 pDes=hDes->Des(); + TInt r=local.ReadPasswordData(pDes); + if(r==KErrNone) + { + TBuf mediaPWrdFile(KMediaPWrdFile); + mediaPWrdFile[0] = (TUint8) RFs::GetSystemDriveChar(); + WriteToDisk(mediaPWrdFile,pDes); + } + delete hDes; + } TInt CMassStorageMountCB::ReMount() - { + { RDebug::Printf("CMassStorageMountCB::ReMount()"); - return KErrNotReady; - } + return KErrNotReady; + } void CMassStorageMountCB::VolumeL(TVolumeInfo& /*aVolume*/) const - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::SetVolumeL(TDes& /*aName*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::MkDirL(const TDesC& /*aName*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::RmDirL(const TDesC& /*aName*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::DeleteL(const TDesC& /*aName*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::RenameL(const TDesC& /*anOldName*/,const TDesC& /*anNewName*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::ReplaceL(const TDesC& /*anOldName*/,const TDesC& /*anNewName*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::EntryL(const TDesC& /*aName*/,TEntry& /*anEntry*/) const - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::SetEntryL(const TDesC& /*aName*/,const TTime& /*aTime*/,TUint /*aSetAttMask*/,TUint /*aClearAttMask*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::FileOpenL(const TDesC& /*aName*/,TUint /*aMode*/,TFileOpen /*anOpen*/,CFileCB* /*aFile*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::DirOpenL(const TDesC& /*aName*/,CDirCB* /*aDir*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::RawReadL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aTrg*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) const - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::RawWriteL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aSrc*/,TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::GetShortNameL(const TDesC& /*aLongName*/,TDes& /*aShortName*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } void CMassStorageMountCB::GetLongNameL(const TDesC& /*aShorName*/,TDes& /*aLongName*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } #if defined(_DEBUG) TInt CMassStorageMountCB::ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2) // // Debug function // - { - if(aCommand>=(KMaxTInt/2)) - return LocalDrive()->ControlIO(aMessage,aCommand-(KMaxTInt/2),aParam1,aParam2); - else - return KErrNotSupported; - } + { + if(aCommand>=(KMaxTInt/2)) + return LocalDrive()->ControlIO(aMessage,aCommand-(KMaxTInt/2),aParam1,aParam2); + else + return KErrNotSupported; + } #else TInt CMassStorageMountCB::ControlIO(const RMessagePtr2& /*aMessage*/,TInt /*aCommand*/,TAny* /*aParam1*/,TAny* /*aParam2*/) - {return(KErrNotSupported);} + {return(KErrNotSupported);} #endif void CMassStorageMountCB::ReadSectionL(const TDesC& /*aName*/,TInt /*aPos*/,TAny* /*aTrg*/,TInt /*aLength*/,const RMessagePtr2& /*aMessage*/) - { - User::Leave(KErrNotReady); - } + { + User::Leave(KErrNotReady); + } /** Returns ETrue if aNum is a power of two */ TBool CMassStorageMountCB::IsPowerOfTwo(TInt aNum) - { + { - if (aNum==0) - return(EFalse); + if (aNum==0) + return(EFalse); - while(aNum) - { - if (aNum & 0x01) - { - if (aNum>>1) - return EFalse; - break; - } - aNum>>=1; - } - return ETrue; - } + while(aNum) + { + if (aNum & 0x01) + { + if (aNum>>1) + return EFalse; + break; + } + aNum>>=1; + } + return ETrue; + } /** Returns the position of the highest bit in aNum or -1 if aNum == 0 */ TInt CMassStorageMountCB::Log2(TInt aNum) - { + { - TInt res=-1; - while(aNum) - { - res++; - aNum>>=1; - } - return(res); - } + TInt res=-1; + while(aNum) + { + res++; + aNum>>=1; + } + return(res); + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cusbmassstoragecontroller.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cusbmassstoragecontroller.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cusbmassstoragecontroller.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // CUsbMassStorageController implementation. -// +// // @@ -40,19 +40,15 @@ #include "cusbmassstorageserver.h" #include "cusbmassstoragecontroller.h" #include "debug.h" -#include "msdebug.h" - - CUsbMassStorageController* CUsbMassStorageController::NewL() { - __MSFNSLOG - CUsbMassStorageController* self = new (ELeave) CUsbMassStorageController(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; + CUsbMassStorageController* self = new (ELeave) CUsbMassStorageController(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; } @@ -62,26 +58,25 @@ void CUsbMassStorageController::ConstructL() - { + { #ifdef MSDC_TESTMODE // TestParser for modifying client behaviour to create BOT 13 Case device // exceptions conditions __TESTMODEPRINT("Test Mode is active"); iTestParser = new (ELeave) TTestParser; #endif - } + } /** Destructor */ CUsbMassStorageController::~CUsbMassStorageController() - { - __MSFNLOG - delete iServer; - delete iProtocol; - delete iTransport; - delete iDriveManager; - } + { + delete iServer; + delete iProtocol; + delete iTransport; + delete iDriveManager; + } /** Creates the drive manager, transport, protocol and server @@ -89,28 +84,27 @@ @param aMaxDrives Maximum number of Mass Storage drives supported. */ void CUsbMassStorageController::CreateL(const TLunToDriveMap& aDriveMapping) - { - __MSFNLOG - //Create and init drive manager - iDriveManager = CDriveManager::NewL(aDriveMapping); + { + //Create and init drive manager + iDriveManager = CDriveManager::NewL(aDriveMapping); - //Create transport and protocol and initialize them - __PRINT(_L("CUsbMassStorageController::CreateL: Creating transport and protocol")); + //Create transport and protocol and initialize them + __PRINT(_L("CUsbMassStorageController::CreateL: Creating transport and protocol")); #ifdef MSDC_TESTMODE - iTransport = CBulkOnlyTransport::NewL(aDriveMapping.Count(), *this, iTestParser); - iProtocol = CScsiServerProtocol::NewL(*iDriveManager, iTestParser); + iTransport = CBulkOnlyTransport::NewL(aDriveMapping.Count(), *this, iTestParser); + iProtocol = CScsiServerProtocol::NewL(*iDriveManager, iTestParser); #else - iTransport = CBulkOnlyTransport::NewL(aDriveMapping.Count(), *this); - iProtocol = CScsiServerProtocol::NewL(*iDriveManager); + iTransport = CBulkOnlyTransport::NewL(aDriveMapping.Count(), *this); + iProtocol = CScsiServerProtocol::NewL(*iDriveManager); #endif - iTransport->RegisterProtocol(*iProtocol); - iProtocol->RegisterTransport(iTransport); + iTransport->RegisterProtocol(*iProtocol); + iProtocol->RegisterTransport(iTransport); - //Create and start server - __PRINT(_L("CUsbMassStorageController::CreateL: Creating server")); - iServer = CUsbMassStorageServer::NewLC(*this); - CleanupStack::Pop(iServer); - } + //Create and start server + __PRINT(_L("CUsbMassStorageController::CreateL: Creating server")); + iServer = CUsbMassStorageServer::NewLC(*this); + CleanupStack::Pop(iServer); + } /** Returns a reference to the drive manager @@ -118,10 +112,9 @@ @return A reference to the drive manager */ CDriveManager& CUsbMassStorageController::DriveManager() - { - __MSFNLOG - return *iDriveManager; - } + { + return *iDriveManager; + } /** Starts the transport and initializes the protocol. @@ -129,57 +122,54 @@ @param aConfig Reference to Mass Storage configuration data */ TInt CUsbMassStorageController::Start(const TMassStorageConfig& aConfig) - { - __MSFNLOG - //Save this value for use in the Reset method. - iConfig = aConfig; - TInt err = KErrNotReady; - if (iProtocol && iTransport) - { - __PRINT(_L("CUsbMassStorageController::Start: Starting")); - iProtocol->SetParameters(aConfig); - err = iTransport->Start(); - } - return err; - } + { + //Save this value for use in the Reset method. + iConfig = aConfig; + TInt err = KErrNotReady; + if (iProtocol && iTransport) + { + __PRINT(_L("CUsbMassStorageController::Start: Starting")); + iProtocol->SetParameters(aConfig); + err = iTransport->Start(); + } + return err; + } /** Stops the transport. */ TInt CUsbMassStorageController::Stop() - { - __MSFNLOG - TInt err = KErrNotReady; - if (iTransport) - { - __PRINT(_L("CUsbMassStorageController::Stop: Stopping")); - err = iTransport->Stop(); - } + { + TInt err = KErrNotReady; + if (iTransport) + { + __PRINT(_L("CUsbMassStorageController::Stop: Stopping")); + err = iTransport->Stop(); + } - iDriveManager->SetCritical(CDriveManager::KAllLuns, EFalse); //unset critical - return err; - } + iDriveManager->SetCritical(CDriveManager::KAllLuns, EFalse); //unset critical + return err; + } /** Delete the transport and protocol and start new ones. */ void CUsbMassStorageController::Reset() - { - __MSFNLOG - delete iProtocol; - iProtocol = NULL; + { + delete iProtocol; + iProtocol = NULL; - //Create transport and protocol and initialize them - __PRINT(_L("CUsbMassStorageController::Reset: Creating protocol")); + //Create transport and protocol and initialize them + __PRINT(_L("CUsbMassStorageController::Reset: Creating protocol")); #ifdef MSDC_TESTMODE - TRAPD(err,iProtocol = CScsiServerProtocol::NewL(*iDriveManager, iTestParser)); + TRAPD(err,iProtocol = CScsiServerProtocol::NewL(*iDriveManager, iTestParser)); #else - TRAPD(err,iProtocol = CScsiServerProtocol::NewL(*iDriveManager)); + TRAPD(err,iProtocol = CScsiServerProtocol::NewL(*iDriveManager)); #endif - err = err; - __ASSERT_DEBUG(err==KErrNone, User::Invariant()); - iTransport->RegisterProtocol(*iProtocol); - iProtocol->RegisterTransport(iTransport); + err = err; + __ASSERT_DEBUG(err==KErrNone, User::Invariant()); + iTransport->RegisterProtocol(*iProtocol); + iProtocol->RegisterTransport(iTransport); iProtocol->SetParameters(iConfig); - } + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cusbmassstoragesession.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cusbmassstoragesession.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/cusbmassstoragesession.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // Implements a Session of a Symbian OS server for the RUsbMassStorage API -// +// // @@ -33,136 +33,127 @@ #include "cusbmassstorageserver.h" #include "debug.h" -#include "msdebug.h" /** Construct a Symbian OS session object. - @param aServer Service the session will be a member of - @param aMessage The message from the client. - @return A new CUsbMassStorageSession object + @param aServer Service the session will be a member of + @param aMessage The message from the client. + @return A new CUsbMassStorageSession object */ CUsbMassStorageSession* CUsbMassStorageSession::NewL(CUsbMassStorageServer& aServer) - { - __MSFNSLOG - CUsbMassStorageSession* r = new (ELeave) CUsbMassStorageSession(aServer); - CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; - } + { + CUsbMassStorageSession* r = new (ELeave) CUsbMassStorageSession(aServer); + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; + } /** Constructor. - @param aServer Service the session will be a member of + @param aServer Service the session will be a member of */ CUsbMassStorageSession::CUsbMassStorageSession(CUsbMassStorageServer& aServer) - : iUsbMsServer(aServer) - { - __MSFNLOG - } + : iUsbMsServer(aServer) + { + } /** 2nd Phase Construction. */ void CUsbMassStorageSession::ConstructL() - { - __MSFNLOG - iUsbMsServer.IncrementSessionCount(); + { + iUsbMsServer.IncrementSessionCount(); if (iUsbMsServer.SessionCount() > 1) { __PRINT1(_L("\tiSessionCount: %d\n"), iUsbMsServer.SessionCount()); // Only one session is allowed User::Leave(KErrInUse); } - } + } /** Destructor. */ CUsbMassStorageSession::~CUsbMassStorageSession() - { - __MSFNLOG - iUsbMsServer.DecrementSessionCount(); - } + { + iUsbMsServer.DecrementSessionCount(); + } /** Called when a message is received from the client. - @param aMessage Message received from the client + @param aMessage Message received from the client */ void CUsbMassStorageSession::ServiceL(const RMessage2& aMessage) - { - __MSFNLOG - DispatchMessageL(aMessage); - } + { + DispatchMessageL(aMessage); + } /** Handles the request (in the form of a the message) received from the client @internalTechnology - @param aMessage The received message + @param aMessage The received message */ void CUsbMassStorageSession::DispatchMessageL(const RMessage2& aMessage) - { - __MSFNLOG - TInt ret = KErrNone; + { + TInt ret = KErrNone; - switch (aMessage.Function()) - { - case EUsbMsStart: - ret = Start(aMessage); - break; - case EUsbMsStop: - ret = Stop(); - break; - case EUsbMsShutdown: - ret = Shutdown(); - break; + switch (aMessage.Function()) + { + case EUsbMsStart: + ret = Start(aMessage); + break; + case EUsbMsStop: + ret = Stop(); + break; + case EUsbMsShutdown: + ret = Shutdown(); + break; - default: - aMessage.Panic(KUsbMsCliPncCat, EUsbMsPanicIllegalIPC); - break; - } + default: + aMessage.Panic(KUsbMsCliPncCat, EUsbMsPanicIllegalIPC); + break; + } - aMessage.Complete(ret); - } + aMessage.Complete(ret); + } /** Client request to start the device. - @return Any error that occurred or KErrNone + @return Any error that occurred or KErrNone */ TInt CUsbMassStorageSession::Start(const RMessage2& aMessage) - { - __MSFNLOG - __PRINT(_L("CUsbMassStorageSession::Start\n")); + { + __PRINT(_L("CUsbMassStorageSession::Start\n")); - TMassStorageConfig msConfig; - TRAPD(err, GetMsConfigL(aMessage, msConfig)); - if (err != KErrNone) - { - __PRINT(_L("Failed to get mass storage configuration data\n")); - return err; - } + TMassStorageConfig msConfig; + TRAPD(err, GetMsConfigL(aMessage, msConfig)); + if (err != KErrNone) + { + __PRINT(_L("Failed to get mass storage configuration data\n")); + return err; + } - return iUsbMsServer.Controller().Start(msConfig); - } + return iUsbMsServer.Controller().Start(msConfig); + } /** Client request to stop the device. - @return Any error that occurred or KErrNone + @return Any error that occurred or KErrNone */ TInt CUsbMassStorageSession::Stop() { - __MSFNLOG TInt err = iUsbMsServer.Controller().Stop(); - return err; - } + return err; + } /** Client request to shut down the server @@ -171,18 +162,16 @@ */ TInt CUsbMassStorageSession::Shutdown() { - __MSFNLOG CActiveScheduler::Stop(); - return KErrNone; - } + return KErrNone; + } /** Get mass storage configuration data from the received message */ void CUsbMassStorageSession::GetMsConfigL(const RMessage2& aMessage, TMassStorageConfig& aMsStorage) - { - __MSFNLOG - aMessage.ReadL(0,aMsStorage.iVendorId); - aMessage.ReadL(1,aMsStorage.iProductId); - aMessage.ReadL(2,aMsStorage.iProductRev); - } + { + aMessage.ReadL(0,aMsStorage.iVendorId); + aMessage.ReadL(1,aMsStorage.iProductId); + aMessage.ReadL(2,aMsStorage.iProductRev); + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/drivemanager.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/drivemanager.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/drivemanager.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -12,7 +12,7 @@ // // Description: // Class implementation of CDriveManager and CMassStorageDrive. -// +// // @@ -32,7 +32,6 @@ #include "drivepublisher.h" #include "drivemanager.h" #include "debug.h" -#include "msdebug.h" void TMediaParams::Init(TLocalDriveCapsV4& aCaps) @@ -70,57 +69,55 @@ TInt TLocalDriveRef::Read(const TInt64& aPos, TInt aLength, TDes8& aBuf, TBool aWholeMedia) - { - __MSFNLOG - - TInt err = KErrUnknown; // never return this + { + TInt err = KErrUnknown; // never return this - if(aWholeMedia) - { - err = iProxyDrive.Read(aPos, aLength, &aBuf, KLocalMessageHandle, 0, RLocalDrive::ELocDrvWholeMedia); - } - else - { - err = iProxyDrive.Read(aPos, aLength, aBuf); - } + if(aWholeMedia) + { + err = iProxyDrive.Read(aPos, aLength, &aBuf, KLocalMessageHandle, 0, RLocalDrive::ELocDrvWholeMedia); + } + else + { + err = iProxyDrive.Read(aPos, aLength, aBuf); + } - if (err == KErrLocked) - { - SetDriveState(TLocalDriveRef::ELocked); - } + if (err == KErrLocked) + { + SetDriveState(TLocalDriveRef::ELocked); + } - return err; - } + return err; + } TInt TLocalDriveRef::Write(const TInt64& aPos, TDesC8& aBuf, TBool aWholeMedia) { - TInt err = KErrNone; + TInt err = KErrNone; - TDriveState oldState = iDriveState; - if (oldState != EActive) + TDriveState oldState = iDriveState; + if (oldState != EActive) { - // SCSI hasn't called SetCritical - SetDriveState(EActive); - } + // SCSI hasn't called SetCritical + SetDriveState(EActive); + } - if (aWholeMedia) - { - err = iProxyDrive.Write(aPos, aBuf.Length(), &aBuf, KLocalMessageHandle, 0, RLocalDrive::ELocDrvWholeMedia); - } - else - { - err = iProxyDrive.Write(aPos,aBuf); - } + if (aWholeMedia) + { + err = iProxyDrive.Write(aPos, aBuf.Length(), &aBuf, KLocalMessageHandle, 0, RLocalDrive::ELocDrvWholeMedia); + } + else + { + err = iProxyDrive.Write(aPos,aBuf); + } - if (err == KErrLocked) - { - SetDriveState(ELocked); - } - else if (oldState != EActive) - { - SetDriveState(oldState); - } + if (err == KErrLocked) + { + SetDriveState(ELocked); + } + else if (oldState != EActive) + { + SetDriveState(oldState); + } return err; } @@ -131,15 +128,14 @@ @param aReset If true, the Media Changed flag is reset to EFalse. */ TBool TLocalDriveRef::IsMediaChanged(TBool aReset) - { - __MSFNLOG - TBool mediaChanged = iMediaChanged; - if (aReset) + { + TBool mediaChanged = iMediaChanged; + if (aReset) { - iMediaChanged = EFalse; - } - return mediaChanged; - } + iMediaChanged = EFalse; + } + return mediaChanged; + } /** @@ -148,19 +144,18 @@ @param aCritical ETrue for Active, EFalse for Idle */ TInt TLocalDriveRef::SetCritical(TBool aCritical) - { - __MSFNLOG - TInt err = KErrNone; + { + TInt err = KErrNone; if (iDriveState == EMediaNotPresent) - { - err = KErrNotReady; - } - else - { + { + err = KErrNotReady; + } + else + { SetDriveState(aCritical ? EActive : EIdle); - } - return err; - } + } + return err; + } /** @@ -170,23 +165,22 @@ @param aInfo */ TInt TLocalDriveRef::Caps(TLocalDriveCapsV4& aInfo) - { - __MSFNLOG - TLocalDriveCapsV4Buf buf; - buf.FillZ(); + { + TLocalDriveCapsV4Buf buf; + buf.FillZ(); - __PRINT(_L("CMassStorageDrive::DoCaps calling Caps\n")); - TInt err = iProxyDrive.Caps(buf); - __PRINT1(_L("CMassStorageDrive::DoCaps: Caps returned %d\n"), err); + __PRINT(_L("CMassStorageDrive::DoCaps calling Caps\n")); + TInt err = iProxyDrive.Caps(buf); + __PRINT1(_L("CMassStorageDrive::DoCaps: Caps returned %d\n"), err); - if (err == KErrNone) - { - // Invoke function call operator to cast to TLocalDriveCapsV4& - aInfo = buf(); - } + if (err == KErrNone) + { + // Invoke function call operator to cast to TLocalDriveCapsV4& + aInfo = buf(); + } - return err; - } + return err; + } /////////////////////////////////////////////////////////////////////////////// @@ -195,68 +189,63 @@ @param aCritSec A Critical Section object shared by all drives. @param aDrives Reference to the list of CMassStorageDrive objects. @param aDriveMap Reference to array mapping lun to drive number for supported - mass storage drives. + mass storage drives. @post Object is fully constructed */ CMassStorageDrive* CMassStorageDrive::NewL(RCriticalSection& aCritSec, RDriveStateChangedPublisher& aDriveStateChangedPublisher) { - __MSFNSLOG - CMassStorageDrive* self = new (ELeave) CMassStorageDrive(aCritSec, aDriveStateChangedPublisher); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; + CMassStorageDrive* self = new (ELeave) CMassStorageDrive(aCritSec, aDriveStateChangedPublisher); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; } CMassStorageDrive::CMassStorageDrive(RCriticalSection& aCritSec, - RDriveStateChangedPublisher& aDriveStateChangedPublisher) + RDriveStateChangedPublisher& aDriveStateChangedPublisher) : iCritSec(aCritSec), - iMountState(EDisconnected), - iDriveStateChangedPublisher(aDriveStateChangedPublisher) - { - __MSFNLOG - } + iMountState(EDisconnected), + iDriveStateChangedPublisher(aDriveStateChangedPublisher) + { + } void CMassStorageDrive::ConstructL() { - __MSFNLOG iDriveMediaErrorPublisher = new (ELeave) RDriveMediaErrorPublisher(); } CMassStorageDrive::~CMassStorageDrive() - { - __MSFNLOG + { delete iDriveMediaErrorPublisher; - delete iLocalDrive; - } + delete iLocalDrive; + } /** Read from the target drive unit. @return KErrNone on success, otherwise system wide error code */ TInt CMassStorageDrive::Read(const TInt64& aPos, TInt aLength, TDes8& aBuf, TBool aWholeMedia) - { - __MSFNLOG + { - TInt err = KErrUnknown; // never return this - iCritSec.Wait(); + TInt err = KErrUnknown; // never return this + iCritSec.Wait(); - if(iMountState != EConnected) - { - err = KErrDisconnected; - } - else - { + if(iMountState != EConnected) + { + err = KErrDisconnected; + } + else + { err = iLocalDrive->Read(aPos, aLength, aBuf, aWholeMedia); - } + } - iCritSec.Signal(); - return err; - } + iCritSec.Signal(); + return err; + } /** @@ -264,25 +253,23 @@ @return KErrNone on success, otherwise system wide error code */ TInt CMassStorageDrive::Write(const TInt64& aPos, TDesC8& aBuf, TBool aWholeMedia) - { - __MSFNLOG - - TInt err = KErrNone; - iCritSec.Wait(); + { + TInt err = KErrNone; + iCritSec.Wait(); - if (iMountState != EConnected) - { - err = KErrDisconnected; - } - else - { - __ASSERT_DEBUG(iLocalDrive, User::Invariant()); + if (iMountState != EConnected) + { + err = KErrDisconnected; + } + else + { + __ASSERT_DEBUG(iLocalDrive, User::Invariant()); err = iLocalDrive->Write(aPos, aBuf, aWholeMedia); - } + } - iCritSec.Signal(); - return err; - } + iCritSec.Signal(); + return err; + } /** @@ -292,16 +279,15 @@ @param aInfo */ TInt CMassStorageDrive::DoCaps(TLocalDriveCapsV4& aInfo) - { - __MSFNLOG + { TInt err = KErrDisMounted; if (iLocalDrive) { err = iLocalDrive->Caps(aInfo); } - return err; - } + return err; + } /** @@ -310,23 +296,21 @@ Note: User notification is not implemented, instead we abort and dismount. */ TInt CMassStorageDrive::HandleCriticalError() - { - __MSFNLOG - TRAPD(err, iDriveMediaErrorPublisher->PublishErrorL(ETrue)); + { + TRAPD(err, iDriveMediaErrorPublisher->PublishErrorL(ETrue)); // ignore leave err = err; - return KErrAbort; - } + return KErrAbort; + } TInt CMassStorageDrive::ClearCriticalError() - { - __MSFNLOG - TRAPD(err, iDriveMediaErrorPublisher->PublishErrorL(EFalse)); + { + TRAPD(err, iDriveMediaErrorPublisher->PublishErrorL(EFalse)); // ignore leave err = err; - return KErrNone; - } + return KErrNone; + } /** @@ -335,22 +319,20 @@ @param aReset If true, the Media Changed flag is reset to EFalse. */ TBool CMassStorageDrive::IsMediaChanged(TBool aReset) - { - __MSFNLOG - - iCritSec.Wait(); + { + iCritSec.Wait(); - TBool mediaChanged = EFalse; - if (iLocalDrive) - { - mediaChanged = iLocalDrive->IsMediaChanged(aReset); + TBool mediaChanged = EFalse; + if (iLocalDrive) + { + mediaChanged = iLocalDrive->IsMediaChanged(aReset); } - iCritSec.Signal(); + iCritSec.Signal(); - __PRINT1(_L("CMassStorageDrive::IsMediaChanged: returning %d\n"), mediaChanged); - return mediaChanged; - } + __PRINT1(_L("CMassStorageDrive::IsMediaChanged: returning %d\n"), mediaChanged); + return mediaChanged; + } /** Set the Drive State to Active or Idle. @@ -358,19 +340,17 @@ @param aCritical ETrue for Active, EFalse for Idle */ TInt CMassStorageDrive::SetCritical(TBool aCritical) - { - __MSFNLOG + { + TInt err = KErrDisMounted; + iCritSec.Wait(); + if (iLocalDrive) + { + err = iLocalDrive->SetCritical(aCritical); + } - TInt err = KErrDisMounted; - iCritSec.Wait(); - if (iLocalDrive) - { - err = iLocalDrive->SetCritical(aCritical); - } - - iCritSec.Signal(); - return err; - } + iCritSec.Signal(); + return err; + } /** Set the mount state @@ -378,24 +358,23 @@ void CMassStorageDrive::SetMountConnectedL(CProxyDrive& aProxyDrive, TBool& aMediaChanged, RDriveStateChangedPublisher& aDriveStateChangedPublisher) - { - __MSFNLOG - TLocalDriveRef* localDrive = NULL; + { + TLocalDriveRef* localDrive = NULL; - __PRINT(_L("SetMountConnectedL entering critical section\n")); - iCritSec.Wait(); // note: signalled in SetMountState + __PRINT(_L("SetMountConnectedL entering critical section\n")); + iCritSec.Wait(); // note: signalled in SetMountState - TRAPD(err, localDrive = new (ELeave) TLocalDriveRef(aProxyDrive, + TRAPD(err, localDrive = new (ELeave) TLocalDriveRef(aProxyDrive, aMediaChanged, aDriveStateChangedPublisher)); - if (err) - { - iCritSec.Signal(); - User::Leave(err); - } - iLocalDrive = localDrive; - SetMountState(EConnected, ETrue); - } + if (err) + { + iCritSec.Signal(); + User::Leave(err); + } + iLocalDrive = localDrive; + SetMountState(EConnected, ETrue); + } /** @return KErrNone @@ -403,144 +382,140 @@ @param aLocalDrive Only provide this if aNewState is EConnected. */ void CMassStorageDrive::SetMountState(TMountState aNewState, TBool aCriticalSection/*=EFalse*/) - { - __MSFNLOG - if(iMountState == aNewState) - { - __PRINT(_L("SetMountState: No change\n")); - } - else - { - // If called from SetMountConnected, already in critical section, + { + if(iMountState == aNewState) + { + __PRINT(_L("SetMountState: No change\n")); + } + else + { + // If called from SetMountConnected, already in critical section, // otherwise, must enter it here. if (!aCriticalSection) { - iCritSec.Wait(); + iCritSec.Wait(); } - switch(aNewState) - { - case EDisconnected: - delete iLocalDrive; - iLocalDrive = NULL; - break; + switch(aNewState) + { + case EDisconnected: + delete iLocalDrive; + iLocalDrive = NULL; + break; - case EConnected: - case EDisconnecting: - case EConnecting: - // Do not change iLocalDrive for these state changes - break; - } + case EConnected: + case EDisconnecting: + case EConnecting: + // Do not change iLocalDrive for these state changes + break; + } - iMountState = aNewState; - __PRINT1(_L("SetMountState: state=%d\n"), iMountState); + iMountState = aNewState; + __PRINT1(_L("SetMountState: state=%d\n"), iMountState); - iDriveStateChangedPublisher.DriveStateChanged(); - iCritSec.Signal(); - __PRINT(_L("SetMountState has left the critical section\n")); - } - } + iDriveStateChangedPublisher.DriveStateChanged(); + iCritSec.Signal(); + __PRINT(_L("SetMountState has left the critical section\n")); + } + } /** @return Current drive media state */ TLocalDriveRef::TDriveState CMassStorageDrive::DriveState() const - { - __MSFNSLOG - return iLocalDrive ? iLocalDrive->DriveState() : TLocalDriveRef::EErrDisMounted; - } + { + return iLocalDrive ? iLocalDrive->DriveState() : TLocalDriveRef::EErrDisMounted; + } /** Check for media not present, and return the drive state. @return Current drive media state */ TLocalDriveRef::TDriveState CMassStorageDrive::CheckDriveState() - { - __MSFNLOG - TLocalDriveRef::TDriveState state = TLocalDriveRef::EErrDisMounted; - iCritSec.Wait(); + { + TLocalDriveRef::TDriveState state = TLocalDriveRef::EErrDisMounted; + iCritSec.Wait(); - if (iLocalDrive) - { - TInt err = KErrGeneral; + if (iLocalDrive) + { + TInt err = KErrGeneral; TLocalDriveCapsV4 caps; - FOREVER - { - // Initialise in case Caps() fails - caps.iType = ::EMediaNotPresent; - err = DoCaps(caps); + FOREVER + { + // Initialise in case Caps() fails + caps.iType = ::EMediaNotPresent; + err = DoCaps(caps); - __PRINTERR(_L("CheckDriveState: DoCaps err=%d\n"), err); - if (err == KErrNotReady || (err == KErrNone && caps.iType == ::EMediaNotPresent)) - { - __PRINT(_L("CheckDriveState: detected MediaNotPresent\n")); + __PRINTERR(_L("CheckDriveState: DoCaps err=%d\n"), err); + if (err == KErrNotReady || (err == KErrNone && caps.iType == ::EMediaNotPresent)) + { + __PRINT(_L("CheckDriveState: detected MediaNotPresent\n")); - SetDriveState(TLocalDriveRef::EMediaNotPresent); + SetDriveState(TLocalDriveRef::EMediaNotPresent); - if (HandleCriticalError() == KErrAbort) - break; - } - else - { - ClearCriticalError(); - break; - } - } + if (HandleCriticalError() == KErrAbort) + break; + } + else + { + ClearCriticalError(); + break; + } + } - if (err == KErrNone && caps.iType != ::EMediaNotPresent) - { + if (err == KErrNone && caps.iType != ::EMediaNotPresent) + { iMediaParams.Init(caps); TLocalDriveRef::TDriveState driveState = TLocalDriveRef::EIdle; - if (iLocalDrive->DriveState() == TLocalDriveRef::EMediaNotPresent) - { - __PRINT(_L("CheckDriveState: detected media inserted\n")); - } - else if (iLocalDrive->DriveState() == TLocalDriveRef::ELocked && - !(caps.iMediaAtt & KMediaAttLocked)) - { - __PRINT(_L("CheckDriveState: detected media unlocked\n")); - } - else if (caps.iMediaAtt & KMediaAttLocked) - { - __PRINT(_L("CheckDriveState: detected media locked\n")); - driveState = TLocalDriveRef::ELocked; - } + if (iLocalDrive->DriveState() == TLocalDriveRef::EMediaNotPresent) + { + __PRINT(_L("CheckDriveState: detected media inserted\n")); + } + else if (iLocalDrive->DriveState() == TLocalDriveRef::ELocked && + !(caps.iMediaAtt & KMediaAttLocked)) + { + __PRINT(_L("CheckDriveState: detected media unlocked\n")); + } + else if (caps.iMediaAtt & KMediaAttLocked) + { + __PRINT(_L("CheckDriveState: detected media locked\n")); + driveState = TLocalDriveRef::ELocked; + } SetDriveState(driveState); - } + } - // Get the current state - state = iLocalDrive->DriveState(); - } + // Get the current state + state = iLocalDrive->DriveState(); + } - iCritSec.Signal(); + iCritSec.Signal(); - return state; - } + return state; + } /** @param aNewState */ void CMassStorageDrive::SetDriveState(TLocalDriveRef::TDriveState aNewState) - { - __MSFNLOG - __ASSERT_DEBUG(aNewState == TLocalDriveRef::EIdle || + { + __ASSERT_DEBUG(aNewState == TLocalDriveRef::EIdle || (iMountState == EConnected && NULL != iLocalDrive) || (iMountState == EDisconnecting && NULL != iLocalDrive), User::Invariant()); - if (!iLocalDrive) - { - __PRINT(_L("SetDriveState: Drive not mounted.\n")); - } - else - { + if (!iLocalDrive) + { + __PRINT(_L("SetDriveState: Drive not mounted.\n")); + } + else + { iLocalDrive->SetDriveState(aNewState); - __PRINT2(_L("SetDriveState: %d->%d\n"), iLocalDrive->iDriveState, aNewState); - } - } + __PRINT2(_L("SetDriveState: %d->%d\n"), iLocalDrive->iDriveState, aNewState); + } + } ///////////////////////////////////////////////////////////////// @@ -548,61 +523,57 @@ /** Construct a CDriveManager object. @param aDriveMap Reference to array mapping lun to drive number for supported - mass storage drives. + mass storage drives. */ CDriveManager* CDriveManager::NewL(const TLunToDriveMap& aDriveMap) - { - __MSFNSLOG - __PRINT1(_L("CDriveManager::NewL - %d drives\n"), aDriveMap.Count()); + { + __PRINT1(_L("CDriveManager::NewL - %d drives\n"), aDriveMap.Count()); - CDriveManager* self = new (ELeave) CDriveManager(aDriveMap.Count() -1); - CleanupStack::PushL(self); - self->ConstructL(aDriveMap); - CleanupStack::Pop(); - return self; - } + CDriveManager* self = new (ELeave) CDriveManager(aDriveMap.Count() -1); + CleanupStack::PushL(self); + self->ConstructL(aDriveMap); + CleanupStack::Pop(); + return self; + } CDriveManager::CDriveManager(TLun aMaxLun) : iMaxLun(aMaxLun) - { - __MSFNLOG + { } /** Construct a CDriveManager object. */ void CDriveManager::ConstructL(const TLunToDriveMap& aDriveMap) - { - __MSFNLOG - User::LeaveIfError(iDriveCritSec.CreateLocal()); + { + User::LeaveIfError(iDriveCritSec.CreateLocal()); iDriveStateChangedPublisher = new (ELeave) RDriveStateChangedPublisher(iDrives, aDriveMap); iDrives.Reserve(iMaxLun + 1); - for (TLun lun = 0; lun < iMaxLun + 1; lun++) - { - iDrives.Append(CMassStorageDrive::NewL(iDriveCritSec, + for (TLun lun = 0; lun < iMaxLun + 1; lun++) + { + iDrives.Append(CMassStorageDrive::NewL(iDriveCritSec, *iDriveStateChangedPublisher)); - } + } - // Publish initial drive state - if (iDrives.Count() > 0) - { - iDriveStateChangedPublisher->DriveStateChanged(); - } - } + // Publish initial drive state + if (iDrives.Count() > 0) + { + iDriveStateChangedPublisher->DriveStateChanged(); + } + } /** Destructor */ CDriveManager::~CDriveManager() - { - __MSFNLOG - iDrives.ResetAndDestroy(); - delete iDriveStateChangedPublisher; - iDriveCritSec.Close(); - } + { + iDrives.ResetAndDestroy(); + delete iDriveStateChangedPublisher; + iDriveCritSec.Close(); + } /** Set the mount state to Connected and specify the Proxy Drive. @@ -614,12 +585,11 @@ @post The Mount State will be Connected. */ void CDriveManager::RegisterDriveL(CProxyDrive& aProxyDrive, TBool& aMediaChanged, TLun aLun) - { - __MSFNLOG - __PRINT1(_L("Lun=%d \n"),aLun); - CMassStorageDrive* drive = Drive(aLun); - drive->SetMountConnectedL(aProxyDrive, aMediaChanged, *iDriveStateChangedPublisher); - } + { + __PRINT1(_L("Lun=%d \n"),aLun); + CMassStorageDrive* drive = Drive(aLun); + drive->SetMountConnectedL(aProxyDrive, aMediaChanged, *iDriveStateChangedPublisher); + } /** Set the mount state to Disconnected. @@ -628,11 +598,10 @@ @post The Mount State will be Disconnected. */ void CDriveManager::DeregisterDrive(TLun aLun) - { - __MSFNLOG + { CMassStorageDrive* drive = Drive(aLun); - drive->SetMountDisconnected(); - } + drive->SetMountDisconnected(); + } /** Return a pointer to the drive specified aLun, or NULL if aLun is invalid. @@ -642,11 +611,10 @@ @param aError KErrNone on success, KErrArgument if NULL is returned. */ CMassStorageDrive* CDriveManager::Drive(TLun aLun) const - { - __MSFNSLOG - __ASSERT_DEBUG(aLun < iDrives.Count(), User::Invariant()); + { + __ASSERT_DEBUG(aLun < iDrives.Count(), User::Invariant()); return iDrives[aLun]; - } + } /** Checks the Media Changed flag, and optionally resets it. @@ -655,11 +623,10 @@ @param aReset If true, the Media Changed flag is reset to EFalse. */ TBool CDriveManager::IsMediaChanged(TLun aLun, TBool aReset) - { - __MSFNLOG - CMassStorageDrive* drive = Drive(aLun); - return drive->IsMediaChanged(aReset); - } + { + CMassStorageDrive* drive = Drive(aLun); + return drive->IsMediaChanged(aReset); + } /** Set the Drive State to Active or Idle. @@ -669,30 +636,28 @@ @param aCritical ETrue for Active, EFalse for Idle */ TInt CDriveManager::SetCritical(TLun aLun, TBool aCritical) - { - __MSFNLOG - TInt err = KErrUnknown; // never return this + { + TInt err = KErrUnknown; // never return this - TLun i = aLun; - TLun cnt = aLun + 1; + TLun i = aLun; + TLun cnt = aLun + 1; - if (aLun == KAllLuns) - { - i = 0; - cnt = iMaxLun + 1; - } + if (aLun == KAllLuns) + { + i = 0; + cnt = iMaxLun + 1; + } - for(; i < cnt; i++) - { - CMassStorageDrive* drive = Drive(i); - err = drive->SetCritical(aCritical); - } - return err; - } + for(; i < cnt; i++) + { + CMassStorageDrive* drive = Drive(i); + err = drive->SetCritical(aCritical); + } + return err; + } void CDriveManager::Connect() - { - __FNLOG("CDriveManager::Connect"); + { TLun lun = iMaxLun; do { @@ -708,31 +673,29 @@ @post The Mount State will be Connected or Connecting. */ void CDriveManager::Connect(TLun aLun) - { - __MSFNLOG - CMassStorageDrive* drive = Drive(aLun); + { + CMassStorageDrive* drive = Drive(aLun); - __PRINT2(_L("CDriveManager::Connect lun=%d, mountState=%d\n"), aLun, drive->MountState()); + __PRINT2(_L("CDriveManager::Connect lun=%d, mountState=%d\n"), aLun, drive->MountState()); - switch(drive->MountState()) - { - case CMassStorageDrive::EDisconnected: - drive->SetMountConnecting(); - break; - case CMassStorageDrive::EDisconnecting: - drive->SetMountConnected(); - break; - case CMassStorageDrive::EConnected: - case CMassStorageDrive::EConnecting: + switch(drive->MountState()) + { + case CMassStorageDrive::EDisconnected: + drive->SetMountConnecting(); + break; + case CMassStorageDrive::EDisconnecting: + drive->SetMountConnected(); + break; + case CMassStorageDrive::EConnected: + case CMassStorageDrive::EConnecting: default: - // do nothing - break; - } - } + // do nothing + break; + } + } void CDriveManager::Disconnect() - { - __FNLOG("CDriveManager::Disconnect"); + { TLun lun = iMaxLun; do { @@ -748,20 +711,19 @@ @post The Mount State will be Disconnected or Disconnecting. */ void CDriveManager::Disconnect(TLun aLun) - { - __MSFNLOG - CMassStorageDrive* drive = Drive(aLun); - switch (drive->MountState()) - { - case CMassStorageDrive::EConnected: - drive->SetMountDisconnecting(); - break; - case CMassStorageDrive::EConnecting: - drive->SetMountDisconnected(); - break; - case CMassStorageDrive::EDisconnected: - case CMassStorageDrive::EDisconnecting: - // do nothing - break; - } - } + { + CMassStorageDrive* drive = Drive(aLun); + switch (drive->MountState()) + { + case CMassStorageDrive::EConnected: + drive->SetMountDisconnecting(); + break; + case CMassStorageDrive::EConnecting: + drive->SetMountDisconnected(); + break; + case CMassStorageDrive::EDisconnected: + case CMassStorageDrive::EDisconnecting: + // do nothing + break; + } + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/drivepublisher.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/drivepublisher.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/drivepublisher.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -20,7 +20,7 @@ // CUsbTransferPublisher, // CUsbReadTransferPublisher, // CUsbReadTransferPublisher. -// +// // @@ -42,39 +42,38 @@ #include "drivepublisher.h" #include "drivemanager.h" #include "debug.h" -#include "msdebug.h" // // Use Lookup table to translate from the internal pair of state variables // to the externally published drive state code. // -LOCAL_D const TUint8 table[][5] = +LOCAL_D const TUint8 table[][5] = { //TMountState=EDisconnected - {EUsbMsDriveState_Disconnected, - EUsbMsDriveState_Disconnected, - EUsbMsDriveState_Disconnected, - EUsbMsDriveState_Disconnected, - EUsbMsDriveState_Disconnected}, + {EUsbMsDriveState_Disconnected, + EUsbMsDriveState_Disconnected, + EUsbMsDriveState_Disconnected, + EUsbMsDriveState_Disconnected, + EUsbMsDriveState_Disconnected}, //TMountState=EConnecting - {EUsbMsDriveState_Connecting, - EUsbMsDriveState_Connecting, - EUsbMsDriveState_Connecting, - EUsbMsDriveState_Connecting, - EUsbMsDriveState_Connecting}, + {EUsbMsDriveState_Connecting, + EUsbMsDriveState_Connecting, + EUsbMsDriveState_Connecting, + EUsbMsDriveState_Connecting, + EUsbMsDriveState_Connecting}, //TMountState=EConnected - //EIdle,EActive,ELocked,EMediaNotPresent,EErrDisMounted - {EUsbMsDriveState_Connected, - EUsbMsDriveState_Active, - EUsbMsDriveState_Locked, - EUsbMsDriveState_MediaNotPresent, - EUsbMsDriveState_Removed}, + //EIdle,EActive,ELocked,EMediaNotPresent,EErrDisMounted + {EUsbMsDriveState_Connected, + EUsbMsDriveState_Active, + EUsbMsDriveState_Locked, + EUsbMsDriveState_MediaNotPresent, + EUsbMsDriveState_Removed}, //TMountState=EDisconnecting - {EUsbMsDriveState_Disconnecting, - EUsbMsDriveState_Disconnecting, - EUsbMsDriveState_Disconnecting, - EUsbMsDriveState_Disconnecting, - EUsbMsDriveState_Disconnecting} + {EUsbMsDriveState_Disconnecting, + EUsbMsDriveState_Disconnecting, + EUsbMsDriveState_Disconnecting, + EUsbMsDriveState_Disconnecting, + EUsbMsDriveState_Disconnecting} }; @@ -83,27 +82,25 @@ Constructor */ RDriveMediaErrorPublisher::RDriveMediaErrorPublisher() - { - __MSFNLOG - _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); - _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); + { + _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); + _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); - TInt result = RProperty::Define(EUsbMsDriveState_MediaError, RProperty::EInt, - KMassStorageReadPolicy, KMassStorageWritePolicy); + TInt result = RProperty::Define(EUsbMsDriveState_MediaError, RProperty::EInt, + KMassStorageReadPolicy, KMassStorageWritePolicy); - __ASSERT_DEBUG(result == KErrAlreadyExists || result == KErrNone, User::Invariant()); + __ASSERT_DEBUG(result == KErrAlreadyExists || result == KErrNone, User::Invariant()); - result = iMediaErrorProperty.Attach(KUsbMsDriveState_Category, EUsbMsDriveState_MediaError); - __ASSERT_DEBUG(result == KErrNone, User::Invariant()); - } + result = iMediaErrorProperty.Attach(KUsbMsDriveState_Category, EUsbMsDriveState_MediaError); + __ASSERT_DEBUG(result == KErrNone, User::Invariant()); + } RDriveMediaErrorPublisher::~RDriveMediaErrorPublisher() - { - __MSFNLOG - iMediaErrorProperty.Close(); - RProperty::Delete(KUsbMsDriveState_Category, EUsbMsDriveState_MediaError); - } + { + iMediaErrorProperty.Close(); + RProperty::Delete(KUsbMsDriveState_Category, EUsbMsDriveState_MediaError); + } /** Publishing method @@ -113,18 +110,17 @@ @param aError ETrue if drive media has an error else EFalse for no error */ void RDriveMediaErrorPublisher::PublishErrorL(TBool aError) - { - __MSFNLOG - __PRINT1(_L("<< RDriveMediaErrorPublisher::PublishError %x"), aError); + { + __PRINT1(_L("<< RDriveMediaErrorPublisher::PublishError %x"), aError); + + TInt oldValue; + iMediaErrorProperty.Get(oldValue); - TInt oldValue; - iMediaErrorProperty.Get(oldValue); - - if (oldValue != aError) - { - User::LeaveIfError(iMediaErrorProperty.Set(aError)); - } - } + if (oldValue != aError) + { + User::LeaveIfError(iMediaErrorProperty.Set(aError)); + } + } //---------------------------------------------------------------------------- /** @@ -134,29 +130,27 @@ @param aDriveMap */ RDriveStateChangedPublisher::RDriveStateChangedPublisher(const TMsDriveList& aDrives, - const TLunToDriveMap& aDriveMap) - : - iDrives(aDrives), - iDriveMap(aDriveMap) - { - __MSFNLOG - _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); - _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); + const TLunToDriveMap& aDriveMap) + : + iDrives(aDrives), + iDriveMap(aDriveMap) + { + _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); + _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); - TInt result = RProperty::Define(KUsbMsDriveState_Category, - EUsbMsDriveState_DriveStatus, RProperty::EByteArray, - KMassStorageReadPolicy, KMassStorageWritePolicy, - KUsbMsMaxDrives*2); - __ASSERT_DEBUG(result == KErrAlreadyExists || result == KErrNone, User::Invariant()); - result = result; // remove urel warning - } + TInt result = RProperty::Define(KUsbMsDriveState_Category, + EUsbMsDriveState_DriveStatus, RProperty::EByteArray, + KMassStorageReadPolicy, KMassStorageWritePolicy, + KUsbMsMaxDrives*2); + __ASSERT_DEBUG(result == KErrAlreadyExists || result == KErrNone, User::Invariant()); + result = result; // remove urel warning + } RDriveStateChangedPublisher::~RDriveStateChangedPublisher() - { - __MSFNLOG - RProperty::Delete(KUsbMsDriveState_Category, EUsbMsDriveState_DriveStatus); - } + { + RProperty::Delete(KUsbMsDriveState_Category, EUsbMsDriveState_DriveStatus); + } /** @@ -166,36 +160,35 @@ values encoded into one 32-bit word. */ void RDriveStateChangedPublisher::DriveStateChanged() - { - __MSFNLOG - TUsbMsDrivesStatus allDrivesStatus; + { + TUsbMsDrivesStatus allDrivesStatus; - for(TUint8 i = 0; i < iDrives.Count(); i++) - { - allDrivesStatus.Append(iDriveMap[i]); + for(TUint8 i = 0; i < iDrives.Count(); i++) + { + allDrivesStatus.Append(iDriveMap[i]); - CMassStorageDrive::TMountState ms = iDrives[i]->MountState(); - TLocalDriveRef::TDriveState ds = iDrives[i]->DriveState(); - TInt driveStatus = EUsbMsDriveState_Error; - if((TUint8)ds < sizeof(table[0]) && (TUint8)ms < sizeof(table)/sizeof(table[0])) - { - driveStatus = table[ms][ds]; - __PRINT3(_L("ms=%d ds=%d %d"), ms, ds, driveStatus); - } - allDrivesStatus.Append(driveStatus); - } + CMassStorageDrive::TMountState ms = iDrives[i]->MountState(); + TLocalDriveRef::TDriveState ds = iDrives[i]->DriveState(); + TInt driveStatus = EUsbMsDriveState_Error; + if((TUint8)ds < sizeof(table[0]) && (TUint8)ms < sizeof(table)/sizeof(table[0])) + { + driveStatus = table[ms][ds]; + __PRINT3(_L("ms=%d ds=%d %d"), ms, ds, driveStatus); + } + allDrivesStatus.Append(driveStatus); + } - __PRINT1(_L("Publishing EUsbMsDriveState_DriveStatus for %d drives\n"), - allDrivesStatus.Length()/2); + __PRINT1(_L("Publishing EUsbMsDriveState_DriveStatus for %d drives\n"), + allDrivesStatus.Length()/2); - if(KErrNone != RProperty::Set(KUsbMsDriveState_Category, - EUsbMsDriveState_DriveStatus, - allDrivesStatus)) - { - __ASSERT_DEBUG(EFalse,User::Invariant()); - } - } + if(KErrNone != RProperty::Set(KUsbMsDriveState_Category, + EUsbMsDriveState_DriveStatus, + allDrivesStatus)) + { + __ASSERT_DEBUG(EFalse,User::Invariant()); + } + } //---------------------------------------------------------------------------- @@ -209,53 +202,49 @@ CUsbTransferPublisher::CUsbTransferPublisher(TUsbMsDriveState_Subkey aSubKey, const TBytesTransferedList& aArray) : iSubKey(aSubKey), - iArray(aArray) - { - __MSFNLOG - } + iArray(aArray) + { + } void CUsbTransferPublisher::ConstructL() - { - __MSFNLOG + { + _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); + _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); - _LIT_SECURITY_POLICY_PASS(KMassStorageReadPolicy); - _LIT_SECURITY_POLICY_S0(KMassStorageWritePolicy, KUsbMsDriveState_Category.iUid); - - TInt r = RProperty::Define(iSubKey, RProperty::EByteArray, - KMassStorageReadPolicy, KMassStorageWritePolicy, - KUsbMsMaxDrives*sizeof(TInt)); + TInt r = RProperty::Define(iSubKey, RProperty::EByteArray, + KMassStorageReadPolicy, KMassStorageWritePolicy, + KUsbMsMaxDrives*sizeof(TInt)); - if (r != KErrAlreadyExists) - { - User::LeaveIfError(r); - } + if (r != KErrAlreadyExists) + { + User::LeaveIfError(r); + } - // Attach to the properties here. Only do this once, continuously attaching - // will currently cause a memory leak - User::LeaveIfError(iProperty.Attach(KUsbMsDriveState_Category, iSubKey)); + // Attach to the properties here. Only do this once, continuously attaching + // will currently cause a memory leak + User::LeaveIfError(iProperty.Attach(KUsbMsDriveState_Category, iSubKey)); - // Create the EDataTransferred timer - iTimer = CPeriodic::NewL(CActive::EPriorityStandard); - iTimerRunning = EFalse; - } + // Create the EDataTransferred timer + iTimer = CPeriodic::NewL(CActive::EPriorityStandard); + iTimerRunning = EFalse; + } /** Destructor */ CUsbTransferPublisher::~CUsbTransferPublisher() - { - __MSFNLOG - if(iTimer) - { - iTimer->Cancel(); - } - delete iTimer; - iProperty.Close(); + { + if(iTimer) + { + iTimer->Cancel(); + } + delete iTimer; + iProperty.Close(); - RProperty::Delete(KUsbMsDriveState_Category, iSubKey); - } + RProperty::Delete(KUsbMsDriveState_Category, iSubKey); + } /** @@ -266,11 +255,10 @@ @return not used in CPeriodic callback (see TCallback) */ TInt CUsbTransferPublisher::PublishDataTransferredEvent(TAny* obj) - { - __MSFNSLOG - static_cast(obj)->DoPublishDataTransferredEvent(); - return 1; - } + { + static_cast(obj)->DoPublishDataTransferredEvent(); + return 1; + } /** @@ -278,22 +266,21 @@ the last update. */ void CUsbTransferPublisher::DoPublishDataTransferredEvent() - { - __MSFNLOG - if (PublishDataTransferred()) - { - // some data has been transfered so reset the counter - iTimerCancelCnt = ETimerCancelDelay; - } + { + if (PublishDataTransferred()) + { + // some data has been transfered so reset the counter + iTimerCancelCnt = ETimerCancelDelay; + } - // Update the cancel count if no data was transferred the last - // (few) times this has been called - if (--iTimerCancelCnt == 0) - { - StopTimer(); - iTimerCancelCnt = ETimerCancelDelay; - } - } + // Update the cancel count if no data was transferred the last + // (few) times this has been called + if (--iTimerCancelCnt == 0) + { + StopTimer(); + iTimerCancelCnt = ETimerCancelDelay; + } + } /** @@ -301,43 +288,42 @@ the last update. */ TBool CUsbTransferPublisher::PublishDataTransferred() - { - __MSFNLOG - TUsbMsBytesTransferred bytesTransferred; - TBool dataTransferred = EFalse; + { + TUsbMsBytesTransferred bytesTransferred; + TBool dataTransferred = EFalse; + + for (TInt i = 0; i < iArray.Count(); i++) + { + bytesTransferred[i] = GetBytesTransferred(i); + } - for (TInt i = 0; i < iArray.Count(); i++) - { - bytesTransferred[i] = GetBytesTransferred(i); - } + // Update the properties only if they have changed + // (or if there's an error reading the old value.) + // Possible optimisation: keep a copy of the value + // as a member variable so we don't need the Get. + TUsbMsBytesTransferred oldValue; - // Update the properties only if they have changed - // (or if there's an error reading the old value.) - // Possible optimisation: keep a copy of the value - // as a member variable so we don't need the Get. - TUsbMsBytesTransferred oldValue; - - if ((iProperty.Get(oldValue) != KErrNone) || (oldValue != bytesTransferred)) - { + if ((iProperty.Get(oldValue) != KErrNone) || (oldValue != bytesTransferred)) + { #ifdef __PRINT3 - // trace of the bytes transferred - for (TInt j=0; j < iArray.Count(); j++) - { - if(oldValue[j] != bytesTransferred[j]) - { - __PRINT3(_L("CDrivePublisher: KBytes[%d] %d->%d\n"), j, oldValue[j], bytesTransferred[j]); - } - } + // trace of the bytes transferred + for (TInt j=0; j < iArray.Count(); j++) + { + if(oldValue[j] != bytesTransferred[j]) + { + __PRINT3(_L("CDrivePublisher: KBytes[%d] %d->%d\n"), j, oldValue[j], bytesTransferred[j]); + } + } #endif - if (KErrNone != iProperty.Set(bytesTransferred)) - { - __ASSERT_DEBUG(EFalse, User::Invariant()); - } - dataTransferred = ETrue; - } + if (KErrNone != iProperty.Set(bytesTransferred)) + { + __ASSERT_DEBUG(EFalse, User::Invariant()); + } + dataTransferred = ETrue; + } - return dataTransferred; - } + return dataTransferred; + } /** @@ -345,33 +331,31 @@ If the timer is not yet running then start it. */ void CUsbTransferPublisher::StartTimer() - { - __MSFNLOG - if (!iTimerRunning) - { - // EDataTransferred event every second - const TTimeIntervalMicroSeconds32 interval = 1 * 1000 * 1000; - TCallBack callback(PublishDataTransferredEvent, this); - __PRINT(_L("Starting timer")); - iTimer->Start(interval, interval, callback); - iTimerRunning = ETrue; - } - } + { + if (!iTimerRunning) + { + // EDataTransferred event every second + const TTimeIntervalMicroSeconds32 interval = 1 * 1000 * 1000; + TCallBack callback(PublishDataTransferredEvent, this); + __PRINT(_L("Starting timer")); + iTimer->Start(interval, interval, callback); + iTimerRunning = ETrue; + } + } /** Ensure that the Timer is stopped */ void CUsbTransferPublisher::StopTimer() - { - __MSFNLOG - if (iTimerRunning) - { - __PRINT(_L("Stopping timer")); - iTimer->Cancel(); - iTimerRunning = EFalse; - } - } + { + if (iTimerRunning) + { + __PRINT(_L("Stopping timer")); + iTimer->Cancel(); + iTimerRunning = EFalse; + } + } //---------------------------------------------------------------------------- @@ -381,21 +365,19 @@ @param aArray */ CUsbWriteTransferPublisher* CUsbWriteTransferPublisher::NewL(const TBytesTransferedList& aArray) - { - __MSFNSLOG - CUsbWriteTransferPublisher* self = new (ELeave) CUsbWriteTransferPublisher(aArray); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } + { + CUsbWriteTransferPublisher* self = new (ELeave) CUsbWriteTransferPublisher(aArray); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } CUsbWriteTransferPublisher::CUsbWriteTransferPublisher(const TBytesTransferedList& aArray) : CUsbTransferPublisher(EUsbMsDriveState_KBytesWritten, aArray) - { - __MSFNLOG - } + { + } //---------------------------------------------------------------------------- @@ -405,21 +387,19 @@ @param aArray */ CUsbReadTransferPublisher* CUsbReadTransferPublisher::NewL(const TBytesTransferedList& aArray) - { - __MSFNSLOG - CUsbReadTransferPublisher* self = new (ELeave) CUsbReadTransferPublisher(aArray); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } + { + CUsbReadTransferPublisher* self = new (ELeave) CUsbReadTransferPublisher(aArray); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } CUsbReadTransferPublisher::CUsbReadTransferPublisher(const TBytesTransferedList& aArray) : CUsbTransferPublisher(EUsbMsDriveState_KBytesRead, aArray) - { - __MSFNLOG - } + { + } /** Transfer function for the property @@ -430,5 +410,5 @@ */ TUint CUsbTransferPublisher::GetBytesTransferred(TLun aLun) const { - return I64LOW(iArray[aLun] / (TUint64)1000); + return I64LOW(iArray[aLun] / (TUint64)1000); } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/inc/debug.h --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/inc/debug.h Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/inc/debug.h Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -51,18 +51,6 @@ _LIT(KMsgIn, ">>%S\n"); _LIT(KMsgOut,"<<%S\n"); -class TMSLogFn -{ - protected: - TBuf<100> iName; - - public: - TMSLogFn(const TDesC& aName){iName = aName; RDebug::Print(KMsgIn, &iName);}; - ~TMSLogFn(){RDebug::Print(KMsgOut, &iName);}; -}; - -#define __FNLOG(name) TMSLogFn __fn_log__(_L(name)) - #else #define __PRINT(t) #define __PRINT1(t,a) @@ -73,7 +61,6 @@ #define __PRINT8BIT1(t,a) #define __PRINT1TEMP(t,a) #define __PRINTERR(txt,err) -#define __FNLOG(name) #endif diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/inc/msdebug.h --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/inc/msdebug.h Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -// Copyright (c) 2009 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" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// msdebug.cpp -// -// - - - -/** - @file - @internalTechnology -*/ - -#ifndef MSDEBUG_H -#define MSDEBUG_H - -//#define _MSFN_DEBUG_PRINT_ - -#if defined(_MSFN_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#define MSFN_TRACE_ENABLED -#endif - -#ifdef MSFN_TRACE_ENABLED -#include - - -/** -Logging function to be used with static functions. Prints the function string on -function entry and exit. -*/ -class TMsLogStaticFn - { -public: - static const TInt KLogBufferSize = 0xFF; - - TMsLogStaticFn(const TDesC8& aFunctionName); - - ~TMsLogStaticFn(); - -protected: - TBuf8 buf; - TPtrC8 iFunctionName; - }; - - -/** -Logging function which prints the function string on function entry and exit. -*/ -class TMsLogFn - { -public: - static const TInt KLogBufferSize = 0xFF; - TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer); - - ~TMsLogFn(); - -private: - TBuf8 buf; - TPtrC8 iFunctionName; - void* iThisPointer; - }; - - - -#define __MSFNLOG TMsLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this); -#define __MSFNSLOG TMsLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); -#else -#define __MSFNSLOG -#define __MSFNLOG -#endif - -#endif // MSDEBUG_H diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/msdebug.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/msdebug.cpp Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -// Copyright (c) 2009 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" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - - - -/** - @file - @internalTechnology -*/ - -#include "msdebug.h" - -#ifdef MSFN_TRACE_ENABLED - -_LIT8(KFnMsgSIn, ">>\t%S\r\n"); -_LIT8(KFnMsgSOut,"<<\t%S\r\n"); -_LIT8(KFnMsgIn, ">>[0x%08x]\t%S\r\n"); -_LIT8(KFnMsgOut,"<<[0x%08x]\t%S\r\n"); - -TMsLogStaticFn::TMsLogStaticFn(const TDesC8& aFunctionName) - { - iFunctionName.Set(aFunctionName); - buf.AppendFormat(KFnMsgSIn, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TMsLogStaticFn::~TMsLogStaticFn() - { - buf.Zero(); - buf.AppendFormat(KFnMsgSOut, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TMsLogFn::TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer) -: iThisPointer(aThisPointer) - { - iFunctionName.Set(aFunctionName); - buf.AppendFormat(KFnMsgIn, iThisPointer, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TMsLogFn::~TMsLogFn() - { - buf.Zero(); - buf.AppendFormat(KFnMsgOut, iThisPointer, &iFunctionName); - RDebug::RawPrint(buf); - }; - -#endif diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/cscsiserverprotocol.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/cscsiserverprotocol.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/cscsiserverprotocol.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -31,22 +31,20 @@ #include "testman.h" #include "cscsiserverprotocol.h" #include "debug.h" -#include "msdebug.h" TMediaWriteMan::TMediaWriteMan() : iActive(EFalse), iOffset(0), - iMediaWriteSize(KDefaultMediaWriteSize) + iMediaWriteSize(KDefaultMediaWriteSize) { } void TMediaWriteMan::ReportHighSpeedDevice() - { - __MSFNLOG - iMediaWriteSize = KHsMediaWriteSize; - __PRINT1(_L("HS Device reported: SCSI will use %d bytes disk write size"), iMediaWriteSize); - } + { + iMediaWriteSize = KHsMediaWriteSize; + __PRINT1(_L("HS Device reported: SCSI will use %d bytes disk write size"), iMediaWriteSize); + } TInt64 TMediaWriteMan::Start(TUint32 aLba, TUint32 aLength, TUint32 aBlockSize) @@ -55,7 +53,7 @@ iOffset = static_cast(aLba) * aBlockSize; iBytesRemain = aLength * aBlockSize; - TInt64 theEnd = iOffset + iBytesRemain; + TInt64 theEnd = iOffset + iBytesRemain; return theEnd; } @@ -81,8 +79,8 @@ TUint32 TMediaWriteMan::GetPacketLength() const { // KMaxBufSize or the MediaWriteSize, whichever is smallest. - TUint32 thisLength = (iBytesRemain > KMaxBufSize) ? KMaxBufSize : iBytesRemain; - thisLength = (thisLength > iMediaWriteSize) ? iMediaWriteSize : thisLength; + TUint32 thisLength = (iBytesRemain > KMaxBufSize) ? KMaxBufSize : iBytesRemain; + thisLength = (thisLength > iMediaWriteSize) ? iMediaWriteSize : thisLength; return thisLength; } @@ -93,25 +91,23 @@ @param aDriveManager reference to the drive manager object */ CScsiServerProtocol* CScsiServerProtocol::NewL(CDriveManager& aDriveManager) - { - __MSFNSLOG - CScsiServerProtocol* self = new (ELeave) CScsiServerProtocol(aDriveManager); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } + { + CScsiServerProtocol* self = new (ELeave) CScsiServerProtocol(aDriveManager); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } #ifdef MSDC_TESTMODE CScsiServerProtocol* CScsiServerProtocol::NewL(CDriveManager& aDriveManager, TTestParser* aTestParser) - { - __MSFNSLOG - CScsiServerProtocol* self = new (ELeave) CScsiServerProtocol(aDriveManager, aTestParser); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } + { + CScsiServerProtocol* self = new (ELeave) CScsiServerProtocol(aDriveManager, aTestParser); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } #endif @@ -122,51 +118,45 @@ */ CScsiServerProtocol::CScsiServerProtocol(CDriveManager& aDriveManager) : iDriveManager(aDriveManager) - { - __MSFNLOG - - iWriteTransferPublisher = CUsbWriteTransferPublisher::NewL(iBytesWritten); - iReadTransferPublisher = CUsbReadTransferPublisher::NewL(iBytesRead); + { + iWriteTransferPublisher = CUsbWriteTransferPublisher::NewL(iBytesWritten); + iReadTransferPublisher = CUsbReadTransferPublisher::NewL(iBytesRead); - for (TUint i = 0; i < KUsbMsMaxDrives; i++) - { - iBytesRead[i] = 0; - iBytesWritten[i] = 0; - } - } + for (TUint i = 0; i < KUsbMsMaxDrives; i++) + { + iBytesRead[i] = 0; + iBytesWritten[i] = 0; + } + } #ifdef MSDC_TESTMODE CScsiServerProtocol::CScsiServerProtocol(CDriveManager& aDriveManager, TTestParser* aTestParser) : iDriveManager(aDriveManager), iTestParser(aTestParser) - { - __MSFNLOG - - iWriteTransferPublisher = CUsbWriteTransferPublisher::NewL(iBytesWritten); - iReadTransferPublisher = CUsbReadTransferPublisher::NewL(iBytesRead); + { + iWriteTransferPublisher = CUsbWriteTransferPublisher::NewL(iBytesWritten); + iReadTransferPublisher = CUsbReadTransferPublisher::NewL(iBytesRead); - for (TUint i = 0; i < KUsbMsMaxDrives; i++) - { - iBytesRead[i] = 0; - iBytesWritten[i] = 0; - } - } + for (TUint i = 0; i < KUsbMsMaxDrives; i++) + { + iBytesRead[i] = 0; + iBytesWritten[i] = 0; + } + } #endif CScsiServerProtocol::~CScsiServerProtocol() - { - __MSFNLOG + { iDataBuf.Close(); - delete iWriteTransferPublisher; - delete iReadTransferPublisher; - } + delete iWriteTransferPublisher; + delete iReadTransferPublisher; + } void CScsiServerProtocol::ConstructL() - { - __MSFNLOG - } + { + } /** @@ -175,10 +165,9 @@ @param aTransport pointer to the transport object */ void CScsiServerProtocol::RegisterTransport(MDeviceTransport* aTransport) - { - __MSFNLOG - iTransport = aTransport; - } + { + iTransport = aTransport; + } /** @@ -191,17 +180,15 @@ */ void CScsiServerProtocol::ReportHighSpeedDevice() - { - __MSFNLOG + { iMediaWriteMan.ReportHighSpeedDevice(); - } + } void CScsiServerProtocol::SetParameters(const TMassStorageConfig& aConfig) - { - __MSFNLOG - iConfig = aConfig; - } + { + iConfig = aConfig; + } /** @@ -213,18 +200,17 @@ @return ETrue if command was decoded and executed successfully */ TBool CScsiServerProtocol::DecodePacket(TPtrC8& aData, TUint8 aLun) - { - __MSFNLOG + { TScsiServerReq* cdb = NULL; TRAPD(err, cdb = cdb->CreateL(static_cast(aData[0]), aData)); TBool decodeGood = EFalse; if (err == KErrNotSupported) - iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidCmdCode); - else if (err != KErrNone) - iSenseInfo.SetSense(TSenseInfo::EAbortedCommand, TSenseInfo::EInsufficientRes); + iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidCmdCode); + else if (err != KErrNone) + iSenseInfo.SetSense(TSenseInfo::EAbortedCommand, TSenseInfo::EInsufficientRes); else if (cdb->iNaca) // Check the CONTROL byte - iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); + iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); else if (cdb->iLink) iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); else @@ -291,12 +277,12 @@ } } __PRINT1(_L("DecodePacket result = %d"), iSenseInfo.SenseOk()); - decodeGood = iSenseInfo.SenseOk(); + decodeGood = iSenseInfo.SenseOk(); } delete cdb; return decodeGood; - } + } /** @@ -306,8 +292,7 @@ @return pointer to drive correspondent to LUN if drive mounted and ready, NULL otherwise */ CMassStorageDrive* CScsiServerProtocol::GetCheckDrive() - { - __MSFNLOG + { #ifdef MSDC_TESTMODE if (iTestParser && iTestParser->SenseError() != TTestParser::ETestSenseErrorNoSense) { @@ -332,44 +317,44 @@ } #endif - CMassStorageDrive* drive = iDriveManager.Drive(iLun); - CMassStorageDrive::TMountState mountState = drive->MountState(); + CMassStorageDrive* drive = iDriveManager.Drive(iLun); + CMassStorageDrive::TMountState mountState = drive->MountState(); - if (mountState == CMassStorageDrive::EDisconnected || mountState == CMassStorageDrive::EConnecting) - { - __PRINT(_L("Drive disconnected\n")); - iSenseInfo.SetSense(TSenseInfo::ENotReady, - TSenseInfo::EMediaNotPresent); - return NULL; - } + if (mountState == CMassStorageDrive::EDisconnected || mountState == CMassStorageDrive::EConnecting) + { + __PRINT(_L("Drive disconnected\n")); + iSenseInfo.SetSense(TSenseInfo::ENotReady, + TSenseInfo::EMediaNotPresent); + return NULL; + } - TLocalDriveRef::TDriveState state = drive->CheckDriveState(); - if (state == TLocalDriveRef::EMediaNotPresent || state == TLocalDriveRef::ELocked) - { - __PRINT1(_L("Media not present or locked. (state =0x%X)\n"),state); - iSenseInfo.SetSense(TSenseInfo::ENotReady, TSenseInfo::EMediaNotPresent); - return NULL; - } + TLocalDriveRef::TDriveState state = drive->CheckDriveState(); + if (state == TLocalDriveRef::EMediaNotPresent || state == TLocalDriveRef::ELocked) + { + __PRINT1(_L("Media not present or locked. (state =0x%X)\n"),state); + iSenseInfo.SetSense(TSenseInfo::ENotReady, TSenseInfo::EMediaNotPresent); + return NULL; + } - if (drive->IsMediaChanged(ETrue)) //reset "media changed" status - { - __PRINT(_L("Media was changed\n")); - // SAM-2 Section 5.9.5 Unit Attention Condition - iSenseInfo.SetSense(TSenseInfo::EUnitAttention, TSenseInfo::ENotReadyToReadyChange); - iDriveManager.Connect(iLun); //publish event to USB app - return NULL; - } + if (drive->IsMediaChanged(ETrue)) //reset "media changed" status + { + __PRINT(_L("Media was changed\n")); + // SAM-2 Section 5.9.5 Unit Attention Condition + iSenseInfo.SetSense(TSenseInfo::EUnitAttention, TSenseInfo::ENotReadyToReadyChange); + iDriveManager.Connect(iLun); //publish event to USB app + return NULL; + } - if (mountState == CMassStorageDrive::EDisconnecting) - { - __PRINT(_L("Drive disconnecting\n")); - iSenseInfo.SetSense(TSenseInfo::ENotReady, - TSenseInfo::EMediaNotPresent); - return NULL; - } + if (mountState == CMassStorageDrive::EDisconnecting) + { + __PRINT(_L("Drive disconnecting\n")); + iSenseInfo.SetSense(TSenseInfo::ENotReady, + TSenseInfo::EMediaNotPresent); + return NULL; + } - return drive; - } + return drive; + } /** @@ -379,10 +364,9 @@ @return ETrue if successful, */ TBool CScsiServerProtocol::HandleUnitReady() - { - __MSFNLOG - return GetCheckDrive() ? ETrue : EFalse; - } + { + return GetCheckDrive() ? ETrue : EFalse; + } /** @@ -391,10 +375,9 @@ @return ETrue if successful, */ TBool CScsiServerProtocol::HandleRequestSense(const TScsiServerReq& aRequest) - { - __MSFNLOG + { const TScsiServerRequestSenseReq request = static_cast(aRequest); - __PRINT1(_L("length = %d\n"), request.iAllocationLength); + __PRINT1(_L("length = %d\n"), request.iAllocationLength); TScsiServerRequestSenseResp requestSense; requestSense.iAllocationLength = request.iAllocationLength; @@ -403,16 +386,16 @@ requestSense.iSensePtr = &iSenseInfo; requestSense.Encode(iCommandBuf); - __PRINT4(_L("Response=0x%x Sense=0x%x, Additional=0x%x, Qualifier=0x%x\n"), - iCommandBuf[0], iCommandBuf[02], iCommandBuf[12], iCommandBuf[13]); + __PRINT4(_L("Response=0x%x Sense=0x%x, Additional=0x%x, Qualifier=0x%x\n"), + iCommandBuf[0], iCommandBuf[02], iCommandBuf[12], iCommandBuf[13]); - TPtrC8 writeBuf = iCommandBuf.Left(request.iAllocationLength); - iTransport->SetupDataIn(writeBuf); + TPtrC8 writeBuf = iCommandBuf.Left(request.iAllocationLength); + iTransport->SetupDataIn(writeBuf); - // clear the sense info - iSenseInfo.SetSense(TSenseInfo::ENoSense); - return ETrue; - } + // clear the sense info + iSenseInfo.SetSense(TSenseInfo::ENoSense); + return ETrue; + } /** @@ -422,15 +405,14 @@ @return ETrue if successful, */ TBool CScsiServerProtocol::HandleInquiry(const TScsiServerReq& aRequest) - { - __MSFNLOG + { const TScsiServerInquiryReq request = static_cast(aRequest); - if (request.iCmdDt || request.iEvpd || request.iPage || iLun >= KUsbMsMaxDrives) - { - iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); - return EFalse; - } + if (request.iCmdDt || request.iEvpd || request.iPage || iLun >= KUsbMsMaxDrives) + { + iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); + return EFalse; + } TScsiServerInquiryResp inquiry(iConfig); @@ -448,12 +430,12 @@ TUint length = inquiry.Length(); - TPtrC8 writeBuf = iCommandBuf.Left(length); - iTransport->SetupDataIn(writeBuf); + TPtrC8 writeBuf = iCommandBuf.Left(length); + iTransport->SetupDataIn(writeBuf); - iSenseInfo.SetSense(TSenseInfo::ENoSense); - return ETrue; - } + iSenseInfo.SetSense(TSenseInfo::ENoSense); + return ETrue; + } /** @@ -464,65 +446,63 @@ @return ETrue if successful, TFalse otherwise */ TBool CScsiServerProtocol::HandleStartStopUnit(const TScsiServerReq& aRequest) - { - __MSFNLOG - - const TScsiServerStartStopUnitReq request = static_cast(aRequest); + { + const TScsiServerStartStopUnitReq request = static_cast(aRequest); - if (request.iLoej) - { - if(request.iStart) //Start unit - { - iDriveManager.Connect(iLun); - __PRINT(_L("Load media\n")); + if (request.iLoej) + { + if(request.iStart) //Start unit + { + iDriveManager.Connect(iLun); + __PRINT(_L("Load media\n")); // rd/wr publisher - iBytesRead[iLun] = 0; - iBytesWritten[iLun] = 0; + iBytesRead[iLun] = 0; + iBytesWritten[iLun] = 0; - // publish the initial values - iWriteTransferPublisher->DoPublishDataTransferredEvent(); - iReadTransferPublisher->DoPublishDataTransferredEvent(); - } - else //Stop unit - { - iDriveManager.SetCritical(iLun, EFalse); - iDriveManager.Disconnect(iLun); - __PRINT(_L("Unload media\n")); - } - } + // publish the initial values + iWriteTransferPublisher->DoPublishDataTransferredEvent(); + iReadTransferPublisher->DoPublishDataTransferredEvent(); + } + else //Stop unit + { + iDriveManager.SetCritical(iLun, EFalse); + iDriveManager.Disconnect(iLun); + __PRINT(_L("Unload media\n")); + } + } - if (request.iImmed) - { - return ETrue; - } + if (request.iImmed) + { + return ETrue; + } - CMassStorageDrive* drive = iDriveManager.Drive(iLun); + CMassStorageDrive* drive = iDriveManager.Drive(iLun); - TInt timeLeft (20); // 1 sec timeout - CMassStorageDrive::TMountState mountState; + TInt timeLeft (20); // 1 sec timeout + CMassStorageDrive::TMountState mountState; - do - { - User::After(1000 * 50); // 50 mSec - --timeLeft; - mountState = drive->MountState(); + do + { + User::After(1000 * 50); // 50 mSec + --timeLeft; + mountState = drive->MountState(); - if ((!request.iStart && mountState != CMassStorageDrive::EConnected) - || - (request.iStart && - (mountState == CMassStorageDrive::EDisconnecting || + if ((!request.iStart && mountState != CMassStorageDrive::EConnected) + || + (request.iStart && + (mountState == CMassStorageDrive::EDisconnecting || mountState == CMassStorageDrive::EConnected))) - { - return ETrue; - } - } while (timeLeft>0); + { + return ETrue; + } + } while (timeLeft>0); - //timeout happend - iSenseInfo.SetSense(TSenseInfo::ENotReady, - TSenseInfo::EAscLogicalUnitDoesNotRespondToSelection); - return EFalse; - } + //timeout happend + iSenseInfo.SetSense(TSenseInfo::ENotReady, + TSenseInfo::EAscLogicalUnitDoesNotRespondToSelection); + return EFalse; + } /** @@ -533,28 +513,25 @@ @return ETrue if successful. */ TBool CScsiServerProtocol::HandlePreventMediaRemoval(const TScsiServerReq& aRequest) - { - __MSFNLOG - const TScsiServerPreventMediaRemovalReq& request = static_cast(aRequest); - __FNLOG("CScsiProtocol::HandlePreventMediaRemoval"); - CMassStorageDrive* drive = GetCheckDrive(); + { + const TScsiServerPreventMediaRemovalReq& request = static_cast(aRequest); + CMassStorageDrive* drive = GetCheckDrive(); - if (drive == NULL) - { - return EFalse; - } - iDriveManager.SetCritical(iLun, request.iPrevent); - return ETrue; - } + if (drive == NULL) + { + return EFalse; + } + iDriveManager.SetCritical(iLun, request.iPrevent); + return ETrue; + } /** Cancel active state, Invoked by transnport when it stops */ TInt CScsiServerProtocol::Cancel() - { - __MSFNLOG - iDriveManager.SetCritical(CDriveManager::KAllLuns, EFalse); - return KErrNone; - } + { + iDriveManager.SetCritical(CDriveManager::KAllLuns, EFalse); + return KErrNone; + } TBool CScsiServerProtocol::HandleReadFormatCapacities(const TScsiServerReq& aRequest) @@ -563,9 +540,8 @@ * * @return ETrue if successful, else a standard Symbian OS error code. */ - { - __MSFNLOG - const TScsiServerReadFormatCapacitiesReq& request = static_cast(aRequest); + { + const TScsiServerReadFormatCapacitiesReq& request = static_cast(aRequest); CMassStorageDrive* drive = NULL; for (TInt i = 0; i < 10; i++) @@ -578,21 +554,21 @@ User::After(100000); } - if (!drive) - { + if (!drive) + { return EFalse; - } + } - TUint32 numBlocks = I64LOW(drive->MediaParams().NumBlocks()); + TUint32 numBlocks = I64LOW(drive->MediaParams().NumBlocks()); TScsiServerReadFormatCapacitiesResp response(request.AllocationLength()); response.SetNumberBlocks(numBlocks); response.Encode(iCommandBuf); - TPtrC8 writeBuf = iCommandBuf; - iTransport->SetupDataIn(writeBuf); - return ETrue; - } + TPtrC8 writeBuf = iCommandBuf; + iTransport->SetupDataIn(writeBuf); + return ETrue; + } /** @@ -603,30 +579,29 @@ @return ETrue if successful. */ TBool CScsiServerProtocol::HandleReadCapacity10(const TScsiServerReq& aRequest) - { - __MSFNLOG - const TScsiServerReadCapacity10Req& request = static_cast(aRequest); - CMassStorageDrive* drive = GetCheckDrive(); - if (drive == NULL) - { - return EFalse; - } + { + const TScsiServerReadCapacity10Req& request = static_cast(aRequest); + CMassStorageDrive* drive = GetCheckDrive(); + if (drive == NULL) + { + return EFalse; + } - if (request.iPmi || request.iLogicalBlockAddress) //do not support partial medium indicator - { - iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); - return EFalse; - } + if (request.iPmi || request.iLogicalBlockAddress) //do not support partial medium indicator + { + iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); + return EFalse; + } TScsiServerReadCapacity10Resp response; response.Set(drive->MediaParams().BlockSize(), drive->MediaParams().NumBlocks()); response.Encode(iCommandBuf); - TPtrC8 writeBuf = iCommandBuf; - iTransport->SetupDataIn(writeBuf); + TPtrC8 writeBuf = iCommandBuf; + iTransport->SetupDataIn(writeBuf); - return KErrNone; - } + return KErrNone; + } /** @@ -637,42 +612,41 @@ @return ETrue if successful. */ TBool CScsiServerProtocol::HandleRead10(const TScsiServerReq& aRequest) - { - __MSFNLOG - const TScsiServerRead10Req& request = static_cast(aRequest); - CMassStorageDrive* drive = GetCheckDrive(); - if (drive == NULL) - { - return EFalse; - } + { + const TScsiServerRead10Req& request = static_cast(aRequest); + CMassStorageDrive* drive = GetCheckDrive(); + if (drive == NULL) + { + return EFalse; + } - if (request.iProtect) - { - iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); - return EFalse; - } + if (request.iProtect) + { + iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); + return EFalse; + } - if (!request.iTransferLength) - { - return ETrue; // do nothing - this is not an error - } + if (!request.iTransferLength) + { + return ETrue; // do nothing - this is not an error + } TUint32 blockSize = drive->MediaParams().BlockSize(); - const TInt64 bOffset = static_cast(request.iLogicalBlockAddress) * blockSize; - const TInt bLength = request.iTransferLength * blockSize; - const TInt64 theEnd = bOffset + bLength; + const TInt64 bOffset = static_cast(request.iLogicalBlockAddress) * blockSize; + const TInt bLength = request.iTransferLength * blockSize; + const TInt64 theEnd = bOffset + bLength; - if (theEnd > drive->MediaParams().Size()) //check if media big enough for this request - { - __PRINT(_L("err - Request ends out of media\n")); - iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::ELbaOutOfRange); - return EFalse; - } + if (theEnd > drive->MediaParams().Size()) //check if media big enough for this request + { + __PRINT(_L("err - Request ends out of media\n")); + iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::ELbaOutOfRange); + return EFalse; + } - // check if our buffer can hold requested data - if (iDataBuf.MaxLength() < bLength) - { + // check if our buffer can hold requested data + if (iDataBuf.MaxLength() < bLength) + { TRAPD(err,iDataBuf.ReAllocL(bLength)); if (err) { @@ -680,33 +654,33 @@ iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); return EFalse; } - } + } iDataBuf.SetLength(bLength); - TInt err = drive->Read(bOffset, bLength, iDataBuf); - if (err != KErrNone) - { - __PRINT1(_L("Read failed, err=%d\n"), err); - iSenseInfo.SetSense(TSenseInfo::ENotReady, TSenseInfo::EMediaNotPresent); - return EFalse; - } + TInt err = drive->Read(bOffset, bLength, iDataBuf); + if (err != KErrNone) + { + __PRINT1(_L("Read failed, err=%d\n"), err); + iSenseInfo.SetSense(TSenseInfo::ENotReady, TSenseInfo::EMediaNotPresent); + return EFalse; + } - TPtrC8 writeBuf = iDataBuf; + TPtrC8 writeBuf = iDataBuf; // rd publisher - iBytesRead[iLun] += writeBuf.Length(); - iReadTransferPublisher->StartTimer(); + iBytesRead[iLun] += writeBuf.Length(); + iReadTransferPublisher->StartTimer(); - // Set up data write to the host + // Set up data write to the host #ifdef MSDC_TESTMODE if (iTestParser) { TBool test = iTestParser->DInSearch(writeBuf); } #endif - iTransport->SetupDataIn(writeBuf); - return ETrue; - } + iTransport->SetupDataIn(writeBuf); + return ETrue; + } /** @@ -717,41 +691,40 @@ @return ETrue if successful. */ TBool CScsiServerProtocol::HandleWrite10(const TScsiServerReq& aRequest) - { - __MSFNLOG - const TScsiServerWrite10Req& request = static_cast(aRequest); - CMassStorageDrive* drive = GetCheckDrive(); - if (drive == NULL) - { - return EFalse; - } - if (request.iProtect) - { - iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); - return EFalse; - } + { + const TScsiServerWrite10Req& request = static_cast(aRequest); + CMassStorageDrive* drive = GetCheckDrive(); + if (drive == NULL) + { + return EFalse; + } + if (request.iProtect) + { + iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::EInvalidFieldInCdb); + return EFalse; + } - if (!request.iTransferLength) - { - return ETrue; // do nothing - this is not an error - } + if (!request.iTransferLength) + { + return ETrue; // do nothing - this is not an error + } const TMediaParams& params = drive->MediaParams(); - if (params.IsWriteProtected() || - params.IsLocked()) - { - iSenseInfo.SetSense(TSenseInfo::EDataProtection, TSenseInfo::EWriteProtected); - return EFalse; - } + if (params.IsWriteProtected() || + params.IsLocked()) + { + iSenseInfo.SetSense(TSenseInfo::EDataProtection, TSenseInfo::EWriteProtected); + return EFalse; + } TInt64 theEnd = iMediaWriteMan.Start(request.iLogicalBlockAddress, request.iTransferLength, params.BlockSize()); - if (theEnd > params.Size()) //check if media big enough for this request - { - __PRINT(_L("err - Request ends out of media\n")); - iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::ELbaOutOfRange); - return EFalse; - } + if (theEnd > params.Size()) //check if media big enough for this request + { + __PRINT(_L("err - Request ends out of media\n")); + iSenseInfo.SetSense(TSenseInfo::EIllegalRequest, TSenseInfo::ELbaOutOfRange); + return EFalse; + } TUint32 thisLength = iMediaWriteMan.GetPacketLength(); @@ -767,20 +740,19 @@ } } - iDataBuf.SetLength(thisLength); - TPtr8 readBuf = iDataBuf.LeftTPtr(iDataBuf.Length()); + iDataBuf.SetLength(thisLength); + TPtr8 readBuf = iDataBuf.LeftTPtr(iDataBuf.Length()); // wr publisher - iBytesWritten[iLun] += readBuf.Length(); - iWriteTransferPublisher->StartTimer(); - iTransport->SetupDataOut(readBuf); - return ETrue; - } + iBytesWritten[iLun] += readBuf.Length(); + iWriteTransferPublisher->StartTimer(); + iTransport->SetupDataOut(readBuf); + return ETrue; + } void CScsiServerProtocol::MediaWriteAbort() { - __MSFNLOG iMediaWriteMan.Reset(); iSenseInfo.SetSense(TSenseInfo::EAbortedCommand); } @@ -797,8 +769,7 @@ KErrNone if command processing is complete and was successful. */ TInt CScsiServerProtocol::MediaWritePacket(TUint& aBytesWritten) - { - __MSFNLOG + { aBytesWritten = 0; if (iMediaWriteMan.Active() == EFalse) { @@ -867,10 +838,10 @@ } #endif - const TInt64 bOffset = iMediaWriteMan.Offset(); + const TInt64 bOffset = iMediaWriteMan.Offset(); iMediaWriteMan.Reset(); - __PRINT1(_L("SCSI: writing %d bytes\n"), iDataBuf.Length()); + __PRINT1(_L("SCSI: writing %d bytes\n"), iDataBuf.Length()); TInt err = KErrNone; #ifdef MSDC_TESTMODE @@ -889,30 +860,30 @@ } #else // ********* Write data to the drive ******** - err = drive->Write(bOffset, iDataBuf); + err = drive->Write(bOffset, iDataBuf); #endif - if (err != KErrNone) - { - __PRINT1(_L("Error after write = 0x%X \n"), err); - iSenseInfo.SetSense(TSenseInfo::EAbortedCommand); - return KErrAbort; - } + if (err != KErrNone) + { + __PRINT1(_L("Error after write = 0x%X \n"), err); + iSenseInfo.SetSense(TSenseInfo::EAbortedCommand); + return KErrAbort; + } - TUint thisLength = iDataBuf.Length(); + TUint thisLength = iDataBuf.Length(); aBytesWritten = thisLength; iMediaWriteMan.SetOffset(bOffset, thisLength); - if (iMediaWriteMan.BytesRemain() == 0) + if (iMediaWriteMan.BytesRemain() == 0) { return iSenseInfo.SenseOk() ? KErrNone : KErrAbort; } // More data is expected - set up another request to read from the host const TUint32 nextPacketLength = iMediaWriteMan.NextPacket(); - TUint bytesAvail = iTransport->BytesAvailable() & ~(drive->MediaParams().BlockSize()-1); + TUint bytesAvail = iTransport->BytesAvailable() & ~(drive->MediaParams().BlockSize()-1); - TBool wait = EFalse; + TBool wait = EFalse; thisLength = nextPacketLength; if (bytesAvail) @@ -927,13 +898,13 @@ } } - thisLength = (thisLength > KMaxBufSize) ? KMaxBufSize : thisLength; + thisLength = (thisLength > KMaxBufSize) ? KMaxBufSize : thisLength; - iDataBuf.SetLength(thisLength); - TPtr8 readBuf = iDataBuf.LeftTPtr(iDataBuf.Length()); + iDataBuf.SetLength(thisLength); + TPtr8 readBuf = iDataBuf.LeftTPtr(iDataBuf.Length()); iTransport->SetupDataOut(readBuf); return wait ? KErrNotReady : KErrCompletion; - } + } /** @@ -942,29 +913,28 @@ @return ETrue if successful. */ TBool CScsiServerProtocol::HandleModeSense6(const TScsiServerReq& aRequest) - { - __MSFNLOG - const TScsiServerModeSense6Req& request = static_cast(aRequest); + { + const TScsiServerModeSense6Req& request = static_cast(aRequest); - TScsiServerModeSense6Resp response; + TScsiServerModeSense6Resp response; response.SetAllocationLength(request.iAllocationLength); - if (request.iPageCode != TScsiServerModeSense6Req::KAllPages || + if (request.iPageCode != TScsiServerModeSense6Req::KAllPages || request.iPageControl == TScsiServerModeSense6Req::EChangeableValues) - { - __PRINT(_L("TSenseInfo::EIllegalRequest,TSenseInfo::EInvalidFieldInCdb")); - iSenseInfo.SetSense(TSenseInfo::EIllegalRequest,TSenseInfo::EInvalidFieldInCdb); - return EFalse; - } - if (request.iPageControl != TScsiServerModeSense6Req::EDefaultValues) - { - //check if drive write protected - CMassStorageDrive* drive = GetCheckDrive(); - if (drive == NULL) - { - __PRINT(_L("drive == null")); - return EFalse; - } + { + __PRINT(_L("TSenseInfo::EIllegalRequest,TSenseInfo::EInvalidFieldInCdb")); + iSenseInfo.SetSense(TSenseInfo::EIllegalRequest,TSenseInfo::EInvalidFieldInCdb); + return EFalse; + } + if (request.iPageControl != TScsiServerModeSense6Req::EDefaultValues) + { + //check if drive write protected + CMassStorageDrive* drive = GetCheckDrive(); + if (drive == NULL) + { + __PRINT(_L("drive == null")); + return EFalse; + } #ifdef MSDC_TESTMODE if (iTestParser) @@ -978,7 +948,7 @@ response.Encode(iCommandBuf); - TPtrC8 writeBuf = iCommandBuf; - iTransport->SetupDataIn(writeBuf); - return iSenseInfo.SenseOk(); - } + TPtrC8 writeBuf = iCommandBuf; + iTransport->SetupDataIn(writeBuf); + return iSenseInfo.SenseOk(); + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/tscsiservercmds.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/tscsiservercmds.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/tscsiservercmds.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -27,17 +27,15 @@ #include "tscsiserverreq.h" #include "tscsiservercmds.h" #include "debug.h" -#include "msdebug.h" /** Default constructor for TSenseInfo */ TSrvSenseInfo::TSrvSenseInfo() { - __MSFNLOG iSenseCode = ENoSense; iAdditional = 0; - iQualifier = 0; + iQualifier = 0; } /** @@ -46,12 +44,11 @@ @param aSenseCode sense key */ void TSrvSenseInfo::SetSense(TSenseCode aSenseCode) - { - __MSFNLOG - iSenseCode = static_cast(aSenseCode); - iAdditional = 0; - iQualifier = 0; - } + { + iSenseCode = static_cast(aSenseCode); + iAdditional = 0; + iQualifier = 0; + } /** @@ -63,12 +60,11 @@ void TSrvSenseInfo::SetSense(TSenseCode aSenseCode, TAdditionalCode aAdditional) - { - __MSFNLOG - iSenseCode = static_cast(aSenseCode); - iAdditional = static_cast(aAdditional); - iQualifier = 0; - } + { + iSenseCode = static_cast(aSenseCode); + iAdditional = static_cast(aAdditional); + iQualifier = 0; + } /** @@ -81,28 +77,26 @@ void TSrvSenseInfo::SetSense(TSenseCode aSenseCode, TAdditionalCode aAdditional, TUint8 aQualifier) - { - __MSFNLOG - iSenseCode = static_cast(aSenseCode); - iAdditional = static_cast(aAdditional); - iQualifier = aQualifier; - } + { + iSenseCode = static_cast(aSenseCode); + iAdditional = static_cast(aAdditional); + iQualifier = aQualifier; + } // **** TEST UNIT READY **** // **** REQUEST SENSE **** void TScsiServerRequestSenseResp::Encode(TDes8& aBuffer) const { - __MSFNSLOG aBuffer.FillZ(KCommandLength); __PRINT(_L("->PROTOCOL(SCSI) REQUEST SENSE\n")); //additional sense length - aBuffer[07] = static_cast(KCommandLength - 8); + aBuffer[07] = static_cast(KCommandLength - 8); aBuffer[0] = iResponseCode; - aBuffer[02] = static_cast(iSensePtr->iSenseCode); - aBuffer[12] = iSensePtr->iAdditional; - aBuffer[13] = iSensePtr->iQualifier; + aBuffer[02] = static_cast(iSensePtr->iSenseCode); + aBuffer[12] = iSensePtr->iAdditional; + aBuffer[13] = iSensePtr->iQualifier; //truncate to Allocation Length of the Request TUint length = iAllocationLength < KCommandLength ? @@ -113,8 +107,7 @@ // **** INQUIRY **** void TScsiServerInquiryReq::DecodeL(const TDesC8& aPtr) { - __MSFNLOG - TScsiServerReq::DecodeL(aPtr); + TScsiServerReq::DecodeL(aPtr); iCmdDt = aPtr[1] & 0x2; iEvpd = aPtr[1] & 0x1; iPage = aPtr[2]; @@ -125,10 +118,9 @@ void TScsiServerInquiryResp::Encode(TDes8& aBuffer) const { - __MSFNSLOG __PRINT(_L("->PROTOCOL(SCSI) INQUIRY\n")); - aBuffer.FillZ(KResponseLength); + aBuffer.FillZ(KResponseLength); // MSB: RMB : Removable if (iRemovable) @@ -140,12 +132,12 @@ aBuffer[3] |= (iResponseDataFormat & 0x0F); // Additional Length - aBuffer[4] = 0x1F; + aBuffer[4] = 0x1F; // Vendor ID (Vendor Specific/Logged by T10) - TPtr8 vendorId(&aBuffer[8], 8, 8); - vendorId.Fill(' ', 8); - vendorId.Copy(iConfig.iVendorId); + TPtr8 vendorId(&aBuffer[8], 8, 8); + vendorId.Fill(' ', 8); + vendorId.Copy(iConfig.iVendorId); // Product ID (Vendor Specific) TPtr8 productId(&aBuffer[16], 16, 16); @@ -164,11 +156,10 @@ } -// **** MODE SENSE (6) **** +// **** MODE SENSE (6) **** void TScsiServerModeSense6Req::DecodeL(const TDesC8& aPtr) { - __MSFNLOG - TScsiServerReq::DecodeL(aPtr); + TScsiServerReq::DecodeL(aPtr); iPageCode = aPtr[2] & 0x3F; iPageControl = static_cast(aPtr[2] >> 6); iAllocationLength = aPtr[4]; @@ -178,7 +169,6 @@ void TScsiServerModeSense6Resp::Encode(TDes8& aBuffer) const { - __MSFNSLOG __PRINT(_L("->PROTOCOL(SCSI) MODE SENSE (6)\n")); // reserve 4 bytes for Length, Media type, Device-specific parameter and // Block descriptor length @@ -225,11 +215,10 @@ aBuffer.SetLength(length); } -// **** START STOP UNIT **** +// **** START STOP UNIT **** void TScsiServerStartStopUnitReq::DecodeL(const TDesC8& aPtr) { - __MSFNLOG - TScsiServerReq::DecodeL(aPtr); + TScsiServerReq::DecodeL(aPtr); const TUint8 KStartMask = 0x01; const TUint8 KImmedMask = 0x01; @@ -246,44 +235,41 @@ } -// **** PREVENT MEDIA REMOVAL **** +// **** PREVENT MEDIA REMOVAL **** void TScsiServerPreventMediaRemovalReq::DecodeL(const TDesC8& aPtr) { - __MSFNLOG - TScsiServerReq::DecodeL(aPtr); - iPrevent = aPtr[4] & 0x01; - __PRINT1(_L("<-PROTOCOL(SCSI) PREVENT MEDIA REMOVAL prevent = %d\n"), iPrevent); + TScsiServerReq::DecodeL(aPtr); + iPrevent = aPtr[4] & 0x01; + __PRINT1(_L("<-PROTOCOL(SCSI) PREVENT MEDIA REMOVAL prevent = %d\n"), iPrevent); } -// **** READ FORMAT CAPACITIES **** +// **** READ FORMAT CAPACITIES **** void TScsiServerReadFormatCapacitiesReq::DecodeL(const TDesC8& aPtr) { - __MSFNLOG - TScsiServerReq::DecodeL(aPtr); + TScsiServerReq::DecodeL(aPtr); const TUint8* ptr = aPtr.Ptr(); iAllocationLength = BigEndian::Get32(ptr+7); - __PRINT(_L("<-PROTOCOL(SCSI) READ FORMAT CAPACITIES\n")); + __PRINT(_L("<-PROTOCOL(SCSI) READ FORMAT CAPACITIES\n")); } void TScsiServerReadFormatCapacitiesResp::Encode(TDes8& aBuffer) const { - __MSFNSLOG - __PRINT(_L("->PROTOCOL(SCSI) READ FORMAT CAPACITIES\n")); - aBuffer.FillZ(KResponseLength); - aBuffer[3] = 0x08; // Capacity List Length + __PRINT(_L("->PROTOCOL(SCSI) READ FORMAT CAPACITIES\n")); + aBuffer.FillZ(KResponseLength); + aBuffer[3] = 0x08; // Capacity List Length - aBuffer[4] = static_cast(iNumberBlocks >> 24); // Number of blocks - aBuffer[5] = static_cast(iNumberBlocks >> 16); // - aBuffer[6] = static_cast(iNumberBlocks >> 8); // - aBuffer[7] = static_cast(iNumberBlocks); // + aBuffer[4] = static_cast(iNumberBlocks >> 24); // Number of blocks + aBuffer[5] = static_cast(iNumberBlocks >> 16); // + aBuffer[6] = static_cast(iNumberBlocks >> 8); // + aBuffer[7] = static_cast(iNumberBlocks); // - aBuffer[8] = 0x02; // Formatted size + aBuffer[8] = 0x02; // Formatted size - aBuffer[9] = 0x00; // 512 Byte Blocks - aBuffer[10] = 0x02; // - aBuffer[11] = 0x00; // + aBuffer[9] = 0x00; // 512 Byte Blocks + aBuffer[10] = 0x02; // + aBuffer[11] = 0x00; // // Truncate to Allocation Length of the Request // Truncate to Allocation Length of the Request @@ -293,21 +279,19 @@ } -// **** READ CAPACITY (10) **** +// **** READ CAPACITY (10) **** void TScsiServerReadCapacity10Req::DecodeL(const TDesC8& aPtr) { - __MSFNLOG - TScsiServerReq::DecodeL(aPtr); + TScsiServerReq::DecodeL(aPtr); iPmi = aPtr[8] & 0x01; const TUint8* ptr = aPtr.Ptr(); - iLogicalBlockAddress = BigEndian::Get32(ptr+2); + iLogicalBlockAddress = BigEndian::Get32(ptr+2); __PRINT(_L("<-PROTOCOL(SCSI) READ CAPACITY (10)\n")); } void TScsiServerReadCapacity10Resp::Encode(TDes8& aBuffer) const { - __MSFNSLOG aBuffer.FillZ(KCommandLength); __PRINT3(_L("->PROTOCOL(SCSI) READ CAPACITY (10) Block size=0x%X, NumBlocks=0x%08X%08X\n"), @@ -331,7 +315,7 @@ aBuffer[0] = aBuffer[1] = aBuffer[2] = aBuffer[3] = 0xFF; } - // Block Size + // Block Size aBuffer[4] = static_cast(iBlockSize >> 24); aBuffer[5] = static_cast(iBlockSize >> 16); aBuffer[6] = static_cast(iBlockSize >> 8); @@ -339,32 +323,30 @@ } -// **** RdWr10 **** +// **** RdWr10 **** void TScsiServerRdWr10Req::DecodeL(const TDesC8& aDes) { - __MSFNLOG - TScsiServerReq::DecodeL(aDes); + TScsiServerReq::DecodeL(aDes); // PROTECT - iProtect = aDes[1] >> 5; + iProtect = aDes[1] >> 5; const TUint8* ptr = aDes.Ptr(); // LOGICAL BLOCK ADDRESS - iLogicalBlockAddress = BigEndian::Get32(ptr+2); + iLogicalBlockAddress = BigEndian::Get32(ptr+2); // TRANSFER LENGTH - iTransferLength = BigEndian::Get16(ptr+7); + iTransferLength = BigEndian::Get16(ptr+7); - __PRINT2(_L("<-PROTOCOL(SCSI) RD/WR (10) : LBA = %x, Length = %x (blocks)\n"), + __PRINT2(_L("<-PROTOCOL(SCSI) RD/WR (10) : LBA = %x, Length = %x (blocks)\n"), iLogicalBlockAddress, iTransferLength); } -// **** READ (10) **** -// **** WRITE (10) **** -// **** VERIFY (10) **** +// **** READ (10) **** +// **** WRITE (10) **** +// **** VERIFY (10) **** void TScsiServerVerify10Req::DecodeL(const TDesC8& aPtr) { - __MSFNLOG - TScsiServerRdWr10Req::DecodeL(aPtr); - iBytchk = aPtr[1] & 0x02 ? ETrue : EFalse; + TScsiServerRdWr10Req::DecodeL(aPtr); + iBytchk = aPtr[1] & 0x02 ? ETrue : EFalse; } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/tscsiserverreq.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/tscsiserverreq.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/protocol/tscsiserverreq.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -24,12 +24,10 @@ #include "tscsiserverreq.h" #include "tscsiservercmds.h" #include "debug.h" -#include "msdebug.h" TScsiServerReq* TScsiServerReq::CreateL(TScsiServerReq::TOperationCode aOperationCode, TDesC8& aDes) { - __MSFNSLOG TScsiServerReq* req = NULL; __SCSIPRINT1(_L("SCSI CMD 0x%x"), aOperationCode); @@ -107,9 +105,8 @@ void TScsiServerReq::DecodeL(const TDesC8& aPtr) { - __MSFNLOG // OPERATION CODE - iOperationCode = static_cast(aPtr[0]); + iOperationCode = static_cast(aPtr[0]); // CONTROL byte TInt length = 0; diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/botcontrolinterface.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/botcontrolinterface.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/botcontrolinterface.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -35,10 +35,7 @@ #include "cusbmassstoragecontroller.h" #include "botcontrolinterface.h" - - #include "debug.h" -#include "msdebug.h" TTestConfig::TTestConfig() : iTestMode(ENone) @@ -53,21 +50,19 @@ @param aParent reference to the CBulkOnlyTransport */ CBotControlInterface* CBotControlInterface::NewL(CBulkOnlyTransport& aParent) - { - __MSFNSLOG - CBotControlInterface* self = new(ELeave) CBotControlInterface(aParent); - CleanupStack::PushL(self); - self->ConstructL(); - CActiveScheduler::Add(self); - CleanupStack::Pop(); - return self; - } + { + CBotControlInterface* self = new(ELeave) CBotControlInterface(aParent); + CleanupStack::PushL(self); + self->ConstructL(); + CActiveScheduler::Add(self); + CleanupStack::Pop(); + return self; + } void CBotControlInterface::ConstructL() - { - __MSFNLOG - } + { + } /** @@ -76,169 +71,161 @@ @param aParent reference to the CBulkOnlyTransport */ CBotControlInterface::CBotControlInterface(CBulkOnlyTransport& aParent): - CActive(EPriorityStandard), - iParent(aParent), - iCurrentState(ENone) - { - __MSFNLOG - } + CActive(EPriorityStandard), + iParent(aParent), + iCurrentState(ENone) + { + } /** d'tor */ CBotControlInterface::~CBotControlInterface() - { - __MSFNLOG - Cancel(); - } + { + Cancel(); + } /** Called by CBulkOnlyTransportStart to start control interface */ TInt CBotControlInterface::Start() - { - __MSFNLOG + { if (IsActive()) { __PRINT(_L("Still active\n")); return KErrServerBusy; } - ReadEp0Data(); - return KErrNone; - } + ReadEp0Data(); + return KErrNone; + } /** Called by CBulkOnlyTransportStart to stop control interface */ void CBotControlInterface::Stop() - { - __MSFNLOG - if (!IsActive()) - { - __PRINT(_L("Not active\n")); - return; - } + { + if (!IsActive()) + { + __PRINT(_L("Not active\n")); + return; + } - __PRINT(_L("\nStopping...\n")); - iCurrentState = ENone; - Cancel(); - } + __PRINT(_L("\nStopping...\n")); + iCurrentState = ENone; + Cancel(); + } /** Cancel outstanding request (if any) */ void CBotControlInterface::DoCancel() - { - __MSFNLOG - switch(iCurrentState) - { - case EReadEp0Data: - iParent.Ldd().ReadCancel(EEndpoint0); - break; - case ESendMaxLun: - iParent.Ldd().WriteCancel(EEndpoint0); - break; - default: - __PRINT(_L("\nWrong state !\n")); - __ASSERT_DEBUG(EFalse, User::Panic(KUsbMsClientPanicCat, EMsControlInterfaceBadState)); - } - } + { + switch(iCurrentState) + { + case EReadEp0Data: + iParent.Ldd().ReadCancel(EEndpoint0); + break; + case ESendMaxLun: + iParent.Ldd().WriteCancel(EEndpoint0); + break; + default: + __PRINT(_L("\nWrong state !\n")); + __ASSERT_DEBUG(EFalse, User::Panic(KUsbMsClientPanicCat, EMsControlInterfaceBadState)); + } + } /** Implement CBotControlInterface state machine */ void CBotControlInterface::RunL() - { - __MSFNLOG - if (iStatus != KErrNone) - { - __PRINT1(_L("Error %d in RunL\n"), iStatus.Int()); + { + if (iStatus != KErrNone) + { + __PRINT1(_L("Error %d in RunL\n"), iStatus.Int()); - //read EP0 again - ReadEp0Data(); - return; - } + //read EP0 again + ReadEp0Data(); + return; + } - switch (iCurrentState) - { - case ESendMaxLun: - ReadEp0Data(); - break; + switch (iCurrentState) + { + case ESendMaxLun: + ReadEp0Data(); + break; - case EReadEp0Data: - DecodeEp0Data(); - break; + case EReadEp0Data: + DecodeEp0Data(); + break; - default: - __PRINT(_L(" error: (Shouldn't end up here...)\n")); - __ASSERT_DEBUG(EFalse, User::Panic(KUsbMsClientPanicCat, EMsControlInterfaceBadState)); - break; - } - } + default: + __PRINT(_L(" error: (Shouldn't end up here...)\n")); + __ASSERT_DEBUG(EFalse, User::Panic(KUsbMsClientPanicCat, EMsControlInterfaceBadState)); + break; + } + } /** Post a read request to EEndpoint0 to read request header */ void CBotControlInterface::ReadEp0Data() - { - __MSFNLOG - iParent.Ldd().Read(iStatus, EEndpoint0, iData, KRequestHdrSize); - iCurrentState = EReadEp0Data; - SetActive(); - } + { + iParent.Ldd().Read(iStatus, EEndpoint0, iData, KRequestHdrSize); + iCurrentState = EReadEp0Data; + SetActive(); + } /** Decode request header and do appropriate action - get max LUN info or post a reset request */ void CBotControlInterface::DecodeEp0Data() - { - __MSFNLOG - TInt err = iRequestHeader.Decode(iData); - if (err != KErrNone) - return; + { + TInt err = iRequestHeader.Decode(iData); + if (err != KErrNone) + return; switch(iRequestHeader.iRequest) - { - // - // GET MAX LUN (0xFE) - // + { + // + // GET MAX LUN (0xFE) + // case TBotFunctionReqCb::EReqGetMaxLun: - { - __PRINT1(_L("DecodeEp0Data : 'Get Max LUN' Request MaxLun = %d"),iParent.MaxLun()); + { + __PRINT1(_L("DecodeEp0Data : 'Get Max LUN' Request MaxLun = %d"),iParent.MaxLun()); if ( iRequestHeader.iRequestType != 0xA1 //value from USB MS BOT spec || iRequestHeader.iIndex > 15 || iRequestHeader.iValue != 0 || iRequestHeader.iLength != 1) { - __PRINT(_L("GetMaxLun command packet check error")); + __PRINT(_L("GetMaxLun command packet check error")); iParent.Ldd().EndpointZeroRequestError(); ReadEp0Data(); //try to get another request } else { iData.FillZ(1); //Return only 1 byte to host - iData[0] = static_cast(iParent.MaxLun()); // Supported Units + iData[0] = static_cast(iParent.MaxLun()); // Supported Units iParent.Ldd().Write(iStatus, EEndpoint0, iData, 1); iCurrentState = ESendMaxLun; SetActive(); } - } + } break; - // - // RESET (0xFF) - // - case TBotFunctionReqCb::EReqReset: - { - __PRINT(_L("DecodeEp0Data : 'Mass Storage Reset' Request")); + // + // RESET (0xFF) + // + case TBotFunctionReqCb::EReqReset: + { + __PRINT(_L("DecodeEp0Data : 'Mass Storage Reset' Request")); __TESTMODEPRINT("------- BOT RESET ------"); if ( iRequestHeader.iRequestType != 0x21 //value from USB MS BOT spec @@ -246,7 +233,7 @@ || iRequestHeader.iValue != 0 || iRequestHeader.iLength != 0) { - __PRINT(_L("MSC Reset command packet check error")); + __PRINT(_L("MSC Reset command packet check error")); iParent.Ldd().EndpointZeroRequestError(); ReadEp0Data(); //try to get another request } @@ -257,14 +244,14 @@ iParent.HwStart(ETrue); iParent.Ldd().SendEp0StatusPacket(); } - } + } break; - // - // Unknown? - // - default: - __PRINT(_L("DecodeEp0Data : Unknown Request")); + // + // Unknown? + // + default: + __PRINT(_L("DecodeEp0Data : Unknown Request")); ReadEp0Data(); //try to get another request break; } - } + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/botmscserver.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/botmscserver.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/botmscserver.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -26,13 +26,10 @@ #include "testman.h" #include "botmscserver.h" #include "debug.h" -#include "msdebug.h" - - TDataTransferMan::TDataTransferMan() -: iReadBuf(NULL, 0), - iWriteBuf(NULL, 0) +: iReadBuf(NULL, 0), + iWriteBuf(NULL, 0) { } @@ -50,12 +47,11 @@ @param aData reference to the data buffer. */ void TDataTransferMan::SetModeDataOut(TPtr8& aData) - { - __MSFNLOG - __PRINT1(_L("Length = %d (bytes)\n"), aData.Length()); - iReadBuf.Set(aData); - iMode = EDataTransferOut; - } + { + __PRINT1(_L("Length = %d (bytes)\n"), aData.Length()); + iReadBuf.Set(aData); + iMode = EDataTransferOut; + } /** @@ -65,12 +61,11 @@ @param aData reference to the data buffer. */ void TDataTransferMan::SetModeDataIn(TPtrC8& aData) - { - __MSFNLOG - __PRINT1(_L("Length = %d (bytes)\n"), aData.Length()); - iWriteBuf.Set(aData); - iMode = EDataTransferIn; - } + { + __PRINT1(_L("Length = %d (bytes)\n"), aData.Length()); + iWriteBuf.Set(aData); + iMode = EDataTransferIn; + } TBotServerReq::TBotServerReq() @@ -80,7 +75,6 @@ void TBotServerReq::DecodeL(const TDesC8& aPtr) { - __MSFNLOG if (aPtr.Length() != KCbwLength) { User::Leave(KErrUnderflow); @@ -88,10 +82,10 @@ // Check reserved bits (must be zero) if ((aPtr[KCbwLunOffset] & 0xF0) || (aPtr[KCbwCbLengthOffset] & 0xE0)) - { - __PRINT(_L("Reserved bits not zero\n")); + { + __PRINT(_L("Reserved bits not zero\n")); User::Leave(KErrArgument); - } + } iSignature = LittleEndian::Get32(&aPtr[KCbwSignatureOffset]); iTag = LittleEndian::Get32(&aPtr[KCbwTagOffset]); @@ -103,7 +97,6 @@ TBool TBotServerReq::IsValidCbw() const { - __MSFNSLOG if (iSignature != 0x43425355) { return EFalse; @@ -115,7 +108,6 @@ TBool TBotServerReq::IsMeaningfulCbw(TInt aMaxLun) const { - __MSFNSLOG if (iLun > aMaxLun) { return EFalse; @@ -144,7 +136,7 @@ void TBotServerResp::EncodeL(TDes8& aBuffer) const { - TUint8* ptr = const_cast(aBuffer.Ptr()); + TUint8* ptr = const_cast(aBuffer.Ptr()); // dCBWSignature ptr += KCswSignatureOffset; @@ -240,32 +232,32 @@ */ TInt TBotServerFunctionReq::Decode(const TDesC8& aBuffer) - { - if (aBuffer.Length() < static_cast(KRequestHdrSize)) - { + { + if (aBuffer.Length() < static_cast(KRequestHdrSize)) + { __PRINT1(_L("TBotServerFunctionReq::Decode buffer invalid length %d"), aBuffer.Length()); - return KErrGeneral; - } + return KErrGeneral; + } - iRequestType = aBuffer[0]; - iRequest = static_cast(aBuffer[1]); - iValue = static_cast(aBuffer[2] + (aBuffer[3] << 8)); - iIndex = static_cast(aBuffer[4] + (aBuffer[5] << 8)); - iLength = static_cast(aBuffer[6] + (aBuffer[7] << 8)); + iRequestType = aBuffer[0]; + iRequest = static_cast(aBuffer[1]); + iValue = static_cast(aBuffer[2] + (aBuffer[3] << 8)); + iIndex = static_cast(aBuffer[4] + (aBuffer[5] << 8)); + iLength = static_cast(aBuffer[6] + (aBuffer[7] << 8)); __PRINT5(_L("type=%d request=%d value=%d index=%d length=%d"), iRequestType,iRequest,iValue,iIndex,iLength); - return KErrNone; - } + return KErrNone; + } /** This function determines whether data is required by the host in response to a message header. -@return TBool Flag indicating whether a data response required. +@return TBool Flag indicating whether a data response required. */ TBool TBotServerFunctionReq::IsDataResponseRequired() const - { - return (iRequestType & 0x80) ? ETrue : EFalse; - } + { + return (iRequestType & 0x80) ? ETrue : EFalse; + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/cbulkonlytransport.cpp --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/cbulkonlytransport.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/transport/cbulkonlytransport.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-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" @@ -36,7 +36,6 @@ #include "mstypes.h" #include "botcontrolinterface.h" #include "debug.h" -#include "msdebug.h" #include "cusbmassstorageserver.h" #include "cusbmassstoragecontroller.h" #include "drivemanager.h" @@ -55,37 +54,35 @@ */ CBulkOnlyTransport* CBulkOnlyTransport::NewL(TInt aNumDrives, CUsbMassStorageController& aController) - { - __MSFNSLOG - if (aNumDrives <=0 || static_cast(aNumDrives) > KUsbMsMaxDrives) - { - User::Leave(KErrArgument); - } - CBulkOnlyTransport* self = new(ELeave) CBulkOnlyTransport(aNumDrives, aController); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } + { + if (aNumDrives <=0 || static_cast(aNumDrives) > KUsbMsMaxDrives) + { + User::Leave(KErrArgument); + } + CBulkOnlyTransport* self = new(ELeave) CBulkOnlyTransport(aNumDrives, aController); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } #ifdef MSDC_TESTMODE CBulkOnlyTransport* CBulkOnlyTransport::NewL(TInt aNumDrives, CUsbMassStorageController& aController, TTestParser* aTestParser) - { - __MSFNSLOG - if (aNumDrives <=0 || static_cast(aNumDrives) > KUsbMsMaxDrives) - { - User::Leave(KErrArgument); - } - CBulkOnlyTransport* self = new(ELeave) CBulkOnlyTransport(aNumDrives, + { + if (aNumDrives <=0 || static_cast(aNumDrives) > KUsbMsMaxDrives) + { + User::Leave(KErrArgument); + } + CBulkOnlyTransport* self = new(ELeave) CBulkOnlyTransport(aNumDrives, aController, aTestParser); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } #endif @@ -96,26 +93,24 @@ */ CBulkOnlyTransport::CBulkOnlyTransport(TInt aNumDrives, CUsbMassStorageController& aController): - CActive(EPriorityStandard), - iMaxLun(aNumDrives-1), - iController(aController), - iStallAllowed(ETrue) - { - __MSFNLOG - } + CActive(EPriorityStandard), + iMaxLun(aNumDrives-1), + iController(aController), + iStallAllowed(ETrue) + { + } #ifdef MSDC_TESTMODE CBulkOnlyTransport::CBulkOnlyTransport(TInt aNumDrives, CUsbMassStorageController& aController, TTestParser* aTestParser) : CActive(EPriorityStandard), - iMaxLun(aNumDrives-1), - iController(aController), - iStallAllowed(ETrue), + iMaxLun(aNumDrives-1), + iController(aController), + iStallAllowed(ETrue), iTestParser(aTestParser) - { - __MSFNLOG - } + { + } #endif @@ -123,27 +118,25 @@ Constructs the CBulkOnlyTranspor object */ void CBulkOnlyTransport::ConstructL() - { - __MSFNLOG - iBotControlInterface = CBotControlInterface::NewL(*this); - iDeviceStateNotifier = CActiveDeviceStateNotifier::NewL(*this); - CActiveScheduler::Add(this); - } + { + iBotControlInterface = CBotControlInterface::NewL(*this); + iDeviceStateNotifier = CActiveDeviceStateNotifier::NewL(*this); + CActiveScheduler::Add(this); + } /** Destructor */ CBulkOnlyTransport::~CBulkOnlyTransport() - { - __MSFNLOG - if (iInterfaceConfigured) - { - Stop(); - } - delete iBotControlInterface; - delete iDeviceStateNotifier; - } + { + if (iInterfaceConfigured) + { + Stop(); + } + delete iBotControlInterface; + delete iDeviceStateNotifier; + } /** @@ -153,37 +146,36 @@ @return KErrNone if operation was completed successfully, errorcode otherwise */ TInt CBulkOnlyTransport::SetupConfigurationDescriptor(TBool aUnset) - { - __MSFNLOG - TInt ret(KErrNone); - TInt configDescriptorSize(0); + { + TInt ret(KErrNone); + TInt configDescriptorSize(0); - iLdd.GetConfigurationDescriptorSize(configDescriptorSize); - if (static_cast(configDescriptorSize) != KUsbDescSize_Config) - { - return KErrCorrupt; - } + iLdd.GetConfigurationDescriptorSize(configDescriptorSize); + if (static_cast(configDescriptorSize) != KUsbDescSize_Config) + { + return KErrCorrupt; + } - TBuf8 configDescriptor; - ret = iLdd.GetConfigurationDescriptor(configDescriptor); - if (ret != KErrNone) - { - return ret; - } + TBuf8 configDescriptor; + ret = iLdd.GetConfigurationDescriptor(configDescriptor); + if (ret != KErrNone) + { + return ret; + } - // I beleive that other fields setted up during LDD initialisation - if (aUnset) - { - --configDescriptor[KUsbNumInterfacesOffset]; - } - else - { - ++configDescriptor[KUsbNumInterfacesOffset]; - } - ret = iLdd.SetConfigurationDescriptor(configDescriptor); + // I beleive that other fields setted up during LDD initialisation + if (aUnset) + { + --configDescriptor[KUsbNumInterfacesOffset]; + } + else + { + ++configDescriptor[KUsbNumInterfacesOffset]; + } + ret = iLdd.SetConfigurationDescriptor(configDescriptor); - return ret; - } + return ret; + } /** @@ -192,100 +184,99 @@ @return KErrNone if operation was completed successfully, errorcode otherwise */ TInt CBulkOnlyTransport::SetupInterfaceDescriptors() - { - __MSFNLOG - // Device caps - TUsbDeviceCaps d_caps; - TInt ret = iLdd.DeviceCaps(d_caps); - if (ret != KErrNone) - { - return ret; - } - TInt totalEndpoints = d_caps().iTotalEndpoints; - if (totalEndpoints < KRequiredNumberOfEndpoints) - { - return KErrHardwareNotAvailable; - } + { + // Device caps + TUsbDeviceCaps d_caps; + TInt ret = iLdd.DeviceCaps(d_caps); + if (ret != KErrNone) + { + return ret; + } + TInt totalEndpoints = d_caps().iTotalEndpoints; + if (totalEndpoints < KRequiredNumberOfEndpoints) + { + return KErrHardwareNotAvailable; + } - // Endpoint caps - TUsbcEndpointData data[KUsbcMaxEndpoints]; - TPtr8 dataptr(reinterpret_cast(data), sizeof(data), sizeof(data)); - ret = iLdd.EndpointCaps(dataptr); - if (ret != KErrNone) - { - return ret; - } + // Endpoint caps + TUsbcEndpointData data[KUsbcMaxEndpoints]; + TPtr8 dataptr(reinterpret_cast(data), sizeof(data), sizeof(data)); + ret = iLdd.EndpointCaps(dataptr); + if (ret != KErrNone) + { + return ret; + } - // Set the active interface - TUsbcInterfaceInfoBuf ifc; - TInt ep_found = 0; - TBool foundBulkIN = EFalse; - TBool foundBulkOUT = EFalse; + // Set the active interface + TUsbcInterfaceInfoBuf ifc; + TInt ep_found = 0; + TBool foundBulkIN = EFalse; + TBool foundBulkOUT = EFalse; - for (TInt i = 0; i < totalEndpoints ; i++) - { - const TUsbcEndpointCaps* caps = &data[i].iCaps; - const TInt maxPacketSize = caps->MaxPacketSize(); - if (!foundBulkIN && - (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirIn)) == (KUsbEpTypeBulk | KUsbEpDirIn)) - { - // KInEndpoint is going to be our TX (IN, write) endpoint - ifc().iEndpointData[0].iType = KUsbEpTypeBulk; - if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) - ifc().iEndpointData[0].iFeatureWord1 = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering; - ifc().iEndpointData[0].iDir = KUsbEpDirIn; - ifc().iEndpointData[0].iSize = maxPacketSize; - ifc().iEndpointData[0].iInterval_Hs = 0; - foundBulkIN = ETrue; - if (++ep_found == KRequiredNumberOfEndpoints) - { - break; - } - continue; - } - if (!foundBulkOUT && - (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirOut)) == (KUsbEpTypeBulk | KUsbEpDirOut)) - { - // KOutEndpoint is going to be our RX (OUT, read) endpoint - ifc().iEndpointData[1].iType = KUsbEpTypeBulk; - if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) - ifc().iEndpointData[1].iFeatureWord1 = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering; - ifc().iEndpointData[1].iDir = KUsbEpDirOut; - ifc().iEndpointData[1].iSize = maxPacketSize; - ifc().iEndpointData[1].iInterval_Hs = 0; - foundBulkOUT = ETrue; - if (++ep_found == KRequiredNumberOfEndpoints) - { - break; - } - continue; - } - } - if (ep_found != KRequiredNumberOfEndpoints) - { - return KErrHardwareNotAvailable; - } + for (TInt i = 0; i < totalEndpoints ; i++) + { + const TUsbcEndpointCaps* caps = &data[i].iCaps; + const TInt maxPacketSize = caps->MaxPacketSize(); + if (!foundBulkIN && + (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirIn)) == (KUsbEpTypeBulk | KUsbEpDirIn)) + { + // KInEndpoint is going to be our TX (IN, write) endpoint + ifc().iEndpointData[0].iType = KUsbEpTypeBulk; + if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) + ifc().iEndpointData[0].iFeatureWord1 = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering; + ifc().iEndpointData[0].iDir = KUsbEpDirIn; + ifc().iEndpointData[0].iSize = maxPacketSize; + ifc().iEndpointData[0].iInterval_Hs = 0; + foundBulkIN = ETrue; + if (++ep_found == KRequiredNumberOfEndpoints) + { + break; + } + continue; + } + if (!foundBulkOUT && + (caps->iTypesAndDir & (KUsbEpTypeBulk | KUsbEpDirOut)) == (KUsbEpTypeBulk | KUsbEpDirOut)) + { + // KOutEndpoint is going to be our RX (OUT, read) endpoint + ifc().iEndpointData[1].iType = KUsbEpTypeBulk; + if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) == KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) + ifc().iEndpointData[1].iFeatureWord1 = KUsbcEndpointInfoFeatureWord1_DMA|KUsbcEndpointInfoFeatureWord1_DoubleBuffering; + ifc().iEndpointData[1].iDir = KUsbEpDirOut; + ifc().iEndpointData[1].iSize = maxPacketSize; + ifc().iEndpointData[1].iInterval_Hs = 0; + foundBulkOUT = ETrue; + if (++ep_found == KRequiredNumberOfEndpoints) + { + break; + } + continue; + } + } + if (ep_found != KRequiredNumberOfEndpoints) + { + return KErrHardwareNotAvailable; + } - _LIT16(string, "USB Mass Storage Interface"); - ifc().iString = const_cast(&string); - ifc().iTotalEndpointsUsed = KRequiredNumberOfEndpoints; - ifc().iClass.iClassNum = 0x08; // Mass Storage - ifc().iClass.iSubClassNum = 0x06; // SCSI Transparent Command Set - ifc().iClass.iProtocolNum = 0x50; // Bulk Only Transport + _LIT16(string, "USB Mass Storage Interface"); + ifc().iString = const_cast(&string); + ifc().iTotalEndpointsUsed = KRequiredNumberOfEndpoints; + ifc().iClass.iClassNum = 0x08; // Mass Storage + ifc().iClass.iSubClassNum = 0x06; // SCSI Transparent Command Set + ifc().iClass.iProtocolNum = 0x50; // Bulk Only Transport - TUint bandwidth_priority = (EUsbcBandwidthOUTDefault | EUsbcBandwidthINDefault); - if (d_caps().iHighSpeed) - { - // If this device supports USB High-speed, then we request 64KB buffers - // (otherwise the default 4KB ones will do). - bandwidth_priority = (EUsbcBandwidthOUTPlus2 | EUsbcBandwidthINPlus2); - // Also, tell the Protocol about it, because it might want to do some - // optimizing too. - iProtocol->ReportHighSpeedDevice(); - } - ret = iLdd.SetInterface(0, ifc, bandwidth_priority); - return ret; - } + TUint bandwidth_priority = (EUsbcBandwidthOUTDefault | EUsbcBandwidthINDefault); + if (d_caps().iHighSpeed) + { + // If this device supports USB High-speed, then we request 64KB buffers + // (otherwise the default 4KB ones will do). + bandwidth_priority = (EUsbcBandwidthOUTPlus2 | EUsbcBandwidthINPlus2); + // Also, tell the Protocol about it, because it might want to do some + // optimizing too. + iProtocol->ReportHighSpeedDevice(); + } + ret = iLdd.SetInterface(0, ifc, bandwidth_priority); + return ret; + } /** @@ -295,7 +286,6 @@ */ void CBulkOnlyTransport::SetupDataOut(TPtr8& aData) { - __MSFNLOG iDataTransferMan.SetModeDataOut(aData); } @@ -305,52 +295,49 @@ @param aData reference to the data buffer. */ void CBulkOnlyTransport::SetupDataIn(TPtrC8& aData) - { + { iDataTransferMan.SetModeDataIn(aData); - } + } TInt CBulkOnlyTransport::Start() - { - __MSFNLOG - TInt err = KErrNone; + { + TInt err = KErrNone; - if (!iProtocol) - { - return KErrBadHandle; //protocol should be set up before start - } + if (!iProtocol) + { + return KErrBadHandle; //protocol should be set up before start + } - if (IsActive()) - { - __PRINT(_L("CBulkOnlyTransport::Start - active before start!\n")); - return KErrInUse; - } + if (IsActive()) + { + __PRINT(_L("CBulkOnlyTransport::Start - active before start!\n")); + return KErrInUse; + } - if ((err = iLdd.Open(0)) != KErrNone || - (err = SetupConfigurationDescriptor()) != KErrNone || - (err = SetupInterfaceDescriptors()) != KErrNone ) - { - __PRINT(_L("CBulkOnlyTransport::Start - Error during descriptors setup!\n")); - return err; - } + if ((err = iLdd.Open(0)) != KErrNone || + (err = SetupConfigurationDescriptor()) != KErrNone || + (err = SetupInterfaceDescriptors()) != KErrNone ) + { + __PRINT(_L("CBulkOnlyTransport::Start - Error during descriptors setup!\n")); + return err; + } - iDeviceStateNotifier->Activate(); // activate notifier wich will wait until USB became configured - TUsbcDeviceState deviceStatus = EUsbcDeviceStateDefault; - err = iLdd.DeviceStatus(deviceStatus); - __PRINT1(_L("CBulkOnlyTransport::Start - Device status = %d\n"), deviceStatus); - if (err == KErrNone && deviceStatus == EUsbcDeviceStateConfigured) - { - __PRINT(_L("CBulkOnlyTransport::Start - Starting bulk only transport\n")); - err = HwStart(); - } - iInterfaceConfigured = ETrue; - return err; - } + iDeviceStateNotifier->Activate(); // activate notifier wich will wait until USB became configured + TUsbcDeviceState deviceStatus = EUsbcDeviceStateDefault; + err = iLdd.DeviceStatus(deviceStatus); + __PRINT1(_L("CBulkOnlyTransport::Start - Device status = %d\n"), deviceStatus); + if (err == KErrNone && deviceStatus == EUsbcDeviceStateConfigured) + { + __PRINT(_L("CBulkOnlyTransport::Start - Starting bulk only transport\n")); + err = HwStart(); + } + iInterfaceConfigured = ETrue; + return err; + } TInt CBulkOnlyTransport::HwStart(TBool aDiscard) - { - __MSFNLOG - + { TInt lun = MaxLun(); do { @@ -358,112 +345,108 @@ } while(--lun >= 0); - TInt res = iBotControlInterface->Start() ; + TInt res = iBotControlInterface->Start() ; - iCurrentState = ENone; + iCurrentState = ENone; iDataTransferMan.Init(); - iStarted = ETrue; + iStarted = ETrue; - TUsbDeviceCaps d_caps; - TInt ret = iLdd.DeviceCaps(d_caps); - if (ret == KErrNone) - { - if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) - { - // Set up DMA if possible (errors are non-critical) - TInt err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDMA); - if (err != KErrNone) - { - __PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err); - } - err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDMA); - if (err != KErrNone) - { - __PRINT1(_L("Set DMA on IN endpoint failed with error code: %d"), err); - } + TUsbDeviceCaps d_caps; + TInt ret = iLdd.DeviceCaps(d_caps); + if (ret == KErrNone) + { + if((d_caps().iFeatureWord1 & KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) != KUsbDevCapsFeatureWord1_EndpointResourceAllocV2) + { + // Set up DMA if possible (errors are non-critical) + TInt err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDMA); + if (err != KErrNone) + { + __PRINT1(_L("Set DMA on OUT endpoint failed with error code: %d"), err); + } + err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDMA); + if (err != KErrNone) + { + __PRINT1(_L("Set DMA on IN endpoint failed with error code: %d"), err); + } - // Set up Double Buffering if possible (errors are non-critical) - err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDoubleBuffering); - if (err != KErrNone) - { - __PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err); - } - err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDoubleBuffering); - if (err != KErrNone) - { - __PRINT1(_L("Set Double Buffering on IN endpoint failed with error code: %d"), err); - } - } - } + // Set up Double Buffering if possible (errors are non-critical) + err = iLdd.AllocateEndpointResource(KOutEndpoint, EUsbcEndpointResourceDoubleBuffering); + if (err != KErrNone) + { + __PRINT1(_L("Set Double Buffering on OUT endpoint failed with error code: %d"), err); + } + err = iLdd.AllocateEndpointResource(KInEndpoint, EUsbcEndpointResourceDoubleBuffering); + if (err != KErrNone) + { + __PRINT1(_L("Set Double Buffering on IN endpoint failed with error code: %d"), err); + } + } + } if (aDiscard) - { - TInt bytes; - const TInt err = iLdd.QueryReceiveBuffer(KOutEndpoint, bytes); - if (err != KErrNone || bytes <= 0) - { - __PRINT1(_L("Error: err=%d bytes=%d"), bytes); - } - else - { - __PRINT1(_L("RxBuffer has %d bytes"), bytes); - FlushDataOut(bytes); - } - } + { + TInt bytes; + const TInt err = iLdd.QueryReceiveBuffer(KOutEndpoint, bytes); + if (err != KErrNone || bytes <= 0) + { + __PRINT1(_L("Error: err=%d bytes=%d"), bytes); + } + else + { + __PRINT1(_L("RxBuffer has %d bytes"), bytes); + FlushDataOut(bytes); + } + } - ClientReadCbw(); - return res; - } + ClientReadCbw(); + return res; + } void CBulkOnlyTransport::HwStop() - { - __MSFNLOG - if (iStarted) - { + { + if (iStarted) + { iController.DriveManager().Disconnect(); - Cancel(); - iBotControlInterface->Cancel(); - iProtocol->Cancel(); - iStarted = EFalse; - } - } + Cancel(); + iBotControlInterface->Cancel(); + iProtocol->Cancel(); + iStarted = EFalse; + } + } void CBulkOnlyTransport::HwSuspend() - { - __MSFNLOG + { iController.DriveManager().Disconnect(); - } + } void CBulkOnlyTransport::HwResume() - { - __MSFNLOG + { iController.DriveManager().Connect(); - } + } /** Stops the Bulk Only Transport */ TInt CBulkOnlyTransport::Stop() - { - __MSFNLOG - iBotControlInterface->Cancel(); - iDeviceStateNotifier->Cancel(); - Cancel(); - if (iInterfaceConfigured) - { - iLdd.ReleaseInterface(0); - SetupConfigurationDescriptor(ETrue); - iLdd.Close(); - } - iCurrentState = ENone; - iInterfaceConfigured = EFalse; + { + iBotControlInterface->Cancel(); + iDeviceStateNotifier->Cancel(); + Cancel(); + if (iInterfaceConfigured) + { + iLdd.ReleaseInterface(0); + SetupConfigurationDescriptor(ETrue); + iLdd.Close(); + } + iCurrentState = ENone; + iInterfaceConfigured = EFalse; - return KErrNone; - } + return KErrNone; + } /** @@ -471,40 +454,36 @@ @param aLength The number of bytes to read from the host. */ void CBulkOnlyTransport::ClientReadCbw() - { - __MSFNLOG - if (IsActive()) - { - __PRINT(_L("Still active\n")); - __ASSERT_DEBUG(EFalse, User::Panic(KUsbMsClientPanicCat, EMsBulkOnlyStillActive)); - return; - } + { + if (IsActive()) + { + __PRINT(_L("Still active\n")); + __ASSERT_DEBUG(EFalse, User::Panic(KUsbMsClientPanicCat, EMsBulkOnlyStillActive)); + return; + } ReadCbw(); } void CBulkOnlyTransport::ReadCbw() - { - __MSFNLOG - iCbwBuf.SetMax(); - iLdd.ReadUntilShort(iStatus, KOutEndpoint, iCbwBuf, iCbwBuf.Length()); - iCurrentState = EWaitForCBW; - SetActive(); - } + { + iCbwBuf.SetMax(); + iLdd.ReadUntilShort(iStatus, KOutEndpoint, iCbwBuf, iCbwBuf.Length()); + iCurrentState = EWaitForCBW; + SetActive(); + } void CBulkOnlyTransport::DoCancel() - { - __MSFNLOG - iLdd.WriteCancel(KInEndpoint); - iLdd.ReadCancel(KOutEndpoint); - } + { + iLdd.WriteCancel(KInEndpoint); + iLdd.ReadCancel(KOutEndpoint); + } void CBulkOnlyTransport::Activate(TInt aReason) { - __MSFNLOG SetActive(); TRequestStatus* r = &iStatus; User::RequestComplete(r, aReason); @@ -512,17 +491,16 @@ void CBulkOnlyTransport::RunL() - { - __MSFNLOG - if (iStatus != KErrNone) - { - __PRINT1(_L("Error %d in RunL, halt endpoints \n"), iStatus.Int()); - SetPermError(); //halt endpoints for reset recovery - return; - } + { + if (iStatus != KErrNone) + { + __PRINT1(_L("Error %d in RunL, halt endpoints \n"), iStatus.Int()); + SetPermError(); //halt endpoints for reset recovery + return; + } - switch (iCurrentState) - { + switch (iCurrentState) + { case EWaitForCBW: __PRINT(_L("EWaitForCBW")); TRAPD(err, DecodeCbwL()); @@ -538,17 +516,17 @@ SetPermError(); return; } - break; + break; case EHandleDataIn: { __PRINT(_L("EHandleDataIn")); iDataTransferMan.SetModeNoData(); - if (iDataTransferMan.iDataResidue && iStallAllowed) - { - StallEndpointAndWaitForClear(KInEndpoint); - } + if (iDataTransferMan.iDataResidue && iStallAllowed) + { + StallEndpointAndWaitForClear(KInEndpoint); + } #ifdef MSDC_TESTMODE if (iTestParser && iTestParser->Enabled()) { @@ -560,17 +538,17 @@ } } #endif - SendCsw(iCbwTag, iDataTransferMan.iDataResidue, iCmdStatus); + SendCsw(iCbwTag, iDataTransferMan.iDataResidue, iCmdStatus); } - break; + break; - case EHandleDataOut: - { + case EHandleDataOut: + { TUint bytesWritten; TInt ret = iProtocol->MediaWritePacket(bytesWritten); iDataTransferMan.iDataResidue -= bytesWritten; - switch(ret) + switch(ret) { case KErrCompletion: { @@ -667,22 +645,22 @@ break; // KErrNone } // switch } - break; // EReadingData + break; // EReadingData - case ESendingCSW: - __PRINT(_L("ESendingCSW")); - ReadCbw(); - break; + case ESendingCSW: + __PRINT(_L("ESendingCSW")); + ReadCbw(); + break; case EPermErr: - __PRINT(_L("EPermErr")); - StallEndpointAndWaitForClear(KInEndpoint); + __PRINT(_L("EPermErr")); + StallEndpointAndWaitForClear(KInEndpoint); break; default: - SetPermError(); // unexpected state - } - } + SetPermError(); // unexpected state + } + } /** @@ -694,8 +672,7 @@ */ void CBulkOnlyTransport::DecodeCbwL() - { - __MSFNLOG + { TBotServerReq req; req.DecodeL(iCbwBuf); @@ -705,10 +682,10 @@ } TPtrC8 aData(&iCbwBuf[TBotCbw::KCbwCbOffset], TBotCbw::KMaxCbwcbLength); - //aData.Set(&iCbwBuf[TBotCbw::KCbwCbOffset], TBotCbw::KMaxCbwcbLength); + //aData.Set(&iCbwBuf[TBotCbw::KCbwCbOffset], TBotCbw::KMaxCbwcbLength); TUint8 lun = req.Lun(); - iCbwTag = req.Tag(); + iCbwTag = req.Tag(); TUint32 hostDataLength = req.DataTransferLength(); iDataTransferMan.SetHostDataLen(hostDataLength); @@ -717,68 +694,68 @@ __PRINT4(_L("lun =%d, hostDataLength=%d, CBWtag = 0x%X\n, dataToHost=%d\n"), lun, hostDataLength, iCbwTag, dataToHost); - ////////////////////////////////////////////// - TBool ret = iProtocol->DecodePacket(aData, lun); - ////////////////////////////////////////////// + ////////////////////////////////////////////// + TBool ret = iProtocol->DecodePacket(aData, lun); + ////////////////////////////////////////////// - iStallAllowed = ETrue; + iStallAllowed = ETrue; - if (!ret) - { - __PRINT(_L("Command Failed\n")); - iCmdStatus = TBotCsw::ECommandFailed; - } - else - { - __PRINT(_L("Command Passed\n")); - iCmdStatus = TBotCsw::ECommandPassed; - } + if (!ret) + { + __PRINT(_L("Command Failed\n")); + iCmdStatus = TBotCsw::ECommandFailed; + } + else + { + __PRINT(_L("Command Passed\n")); + iCmdStatus = TBotCsw::ECommandPassed; + } - if (hostDataLength) // Host expected data transfer - { - if (dataToHost == TBotServerReq::EDataIn) // send data to host - { + if (hostDataLength) // Host expected data transfer + { + if (dataToHost == TBotServerReq::EDataIn) // send data to host + { if (!iDataTransferMan.IsModeDataIn()) - { - __PRINT(_L("Write buffer was not setup\n")); + { + __PRINT(_L("Write buffer was not setup\n")); - if (hostDataLength <= KBOTMaxBufSize) - { - // Case 4 or 8" - iBuf.FillZ(hostDataLength); - iLdd.Write(iStatus, KInEndpoint, iBuf, hostDataLength); - SetActive(); - iCurrentState = EHandleDataIn; - iStallAllowed = EFalse; - if (iDataTransferMan.IsModeDataOut()) - { + if (hostDataLength <= KBOTMaxBufSize) + { + // Case 4 or 8" + iBuf.FillZ(hostDataLength); + iLdd.Write(iStatus, KInEndpoint, iBuf, hostDataLength); + SetActive(); + iCurrentState = EHandleDataIn; + iStallAllowed = EFalse; + if (iDataTransferMan.IsModeDataOut()) + { //read buffer WAS set up - case (8) - iCmdStatus = TBotCsw::EPhaseError; - } - return; - } - else - { + iCmdStatus = TBotCsw::EPhaseError; + } + return; + } + else + { // Use next block instead of StallEndpointAndWaitForClear(KInEndpoint); FlushDataIn(hostDataLength); - } + } - if (iDataTransferMan.IsModeDataOut()) - { + if (iDataTransferMan.IsModeDataOut()) + { //read buffer WAS set up - case (8) - SendCsw(iCbwTag, hostDataLength, TBotCsw::EPhaseError); - //don't care to reset any flag - should get reset recovery - } - else - { + SendCsw(iCbwTag, hostDataLength, TBotCsw::EPhaseError); + //don't care to reset any flag - should get reset recovery + } + else + { // case (4) - SendCsw(iCbwTag, hostDataLength, iCmdStatus); - } - return; - } + SendCsw(iCbwTag, hostDataLength, iCmdStatus); + } + return; + } //================== - TInt deviceDataLength = iDataTransferMan.iWriteBuf.Length(); + TInt deviceDataLength = iDataTransferMan.iWriteBuf.Length(); iDataTransferMan.iDataResidue = hostDataLength - deviceDataLength; #ifdef MSDC_TESTMODE @@ -823,8 +800,8 @@ } } #endif - if (deviceDataLength < hostDataLength && hostDataLength <= KBOTMaxBufSize) - { + if (deviceDataLength < hostDataLength && hostDataLength <= KBOTMaxBufSize) + { // do not pad // iStallAllowed = ETrue; // __PRINT1(_L("iBuf.Length=%d\n"),iBuf.Length()); @@ -842,11 +819,11 @@ SetActive(); iCurrentState = EHandleDataIn; - return; - } + return; + } - if (deviceDataLength == hostDataLength) - { + if (deviceDataLength == hostDataLength) + { //case (6)[==] #ifdef MSDC_TESTMODE if (iTestParser && iTestParser->Enabled()) @@ -860,49 +837,49 @@ } #endif - DataInWriteRequest(deviceDataLength); - return; - } - else if (deviceDataLength < hostDataLength) - { + DataInWriteRequest(deviceDataLength); + return; + } + else if (deviceDataLength < hostDataLength) + { //case (5)[<] - DataInWriteRequest(deviceDataLength, ETrue); // Send ZLP - return; - } - else - { + DataInWriteRequest(deviceDataLength, ETrue); // Send ZLP + return; + } + else + { // deviceDataLength > hostDataLength - case (7) - iCmdStatus = TBotCsw::EPhaseError; - iDataTransferMan.iDataResidue = 0; - DataInWriteRequest(hostDataLength); - return; - } - } - else // read data from host - { - if (!iDataTransferMan.IsModeDataOut()) - { - __PRINT(_L("Read buffer was not setup\n")); + iCmdStatus = TBotCsw::EPhaseError; + iDataTransferMan.iDataResidue = 0; + DataInWriteRequest(hostDataLength); + return; + } + } + else // read data from host + { + if (!iDataTransferMan.IsModeDataOut()) + { + __PRINT(_L("Read buffer was not setup\n")); // Use next block instead of StallEndpointAndWaitForClear(KOutEndpoint); FlushDataOut(hostDataLength); - if (iDataTransferMan.IsModeDataIn()) - { + if (iDataTransferMan.IsModeDataIn()) + { //case (10) - SendCsw(iCbwTag, hostDataLength, TBotCsw::EPhaseError); - } - else - { + SendCsw(iCbwTag, hostDataLength, TBotCsw::EPhaseError); + } + else + { // case (9) - SendCsw(iCbwTag, hostDataLength, iCmdStatus); - } - return; - } + SendCsw(iCbwTag, hostDataLength, iCmdStatus); + } + return; + } - TInt deviceDataLength = iDataTransferMan.iReadBuf.Length(); + TInt deviceDataLength = iDataTransferMan.iReadBuf.Length(); - if (deviceDataLength <= hostDataLength) - { + if (deviceDataLength <= hostDataLength) + { // case (11) and (12) #ifdef MSDC_TESTMODE TBool done = EFalse; @@ -928,12 +905,12 @@ DataOutReadRequest(deviceDataLength); } #else - DataOutReadRequest(deviceDataLength); + DataOutReadRequest(deviceDataLength); #endif - return; - } - else - { + return; + } + else + { // case (13) /** * Comment following line in order to pass compliant test. @@ -941,7 +918,7 @@ * total of dCBWDataTransferLength." * Here we choose to ignore incoming data. */ - //StallEndpointAndWaitForClear(KOutEndpoint); //Stall Out endpoint + //StallEndpointAndWaitForClear(KOutEndpoint); //Stall Out endpoint if (iDataTransferMan.IsModeDataOut()) { iDataTransferMan.SetModeNoData(); @@ -950,21 +927,21 @@ iProtocol->MediaWriteAbort(); } SendCsw(iCbwTag, hostDataLength, TBotCsw::EPhaseError); - return; - } - } - } - else // Host expected no data transfer - { - __PRINT(_L("No data transfer expected\n")); - iDataTransferMan.iDataResidue = 0; - if (!iDataTransferMan.IsModeNoData()) - { + return; + } + } + } + else // Host expected no data transfer + { + __PRINT(_L("No data transfer expected\n")); + iDataTransferMan.iDataResidue = 0; + if (!iDataTransferMan.IsModeNoData()) + { // case (2) and (3) - SendCsw(iCbwTag, 0, TBotCsw::EPhaseError); - } - else - { + SendCsw(iCbwTag, 0, TBotCsw::EPhaseError); + } + else + { //case (1) #ifdef MSDC_TESTMODE if (iTestParser && iTestParser->Enabled()) @@ -984,10 +961,10 @@ } } #endif - SendCsw(iCbwTag, 0, iCmdStatus); - } - } - } + SendCsw(iCbwTag, 0, iCmdStatus); + } + } + } /** @@ -995,11 +972,10 @@ Used when protocol wants to force host to initiate a reset recovery. */ void CBulkOnlyTransport::SetPermError() - { - __MSFNLOG + { iCurrentState = EPermErr; Activate(KErrNone); - } + } /** @@ -1008,13 +984,12 @@ @param aLength amount of data (in bytes) to be send to host */ void CBulkOnlyTransport::DataInWriteRequest(TUint aLength, TBool aZlpRequired) - { - __MSFNLOG - iLdd.Write(iStatus, KInEndpoint, iDataTransferMan.iWriteBuf, aLength, aZlpRequired); + { + iLdd.Write(iStatus, KInEndpoint, iDataTransferMan.iWriteBuf, aLength, aZlpRequired); iDataTransferMan.iTransportResidue -= aLength; - iCurrentState = EHandleDataIn; - SetActive(); - } + iCurrentState = EHandleDataIn; + SetActive(); + } /** @@ -1023,13 +998,12 @@ @param aLength amount of data (in bytes) to be received from the host */ void CBulkOnlyTransport::DataOutReadRequest(TUint aLength) - { - __MSFNLOG - iLdd.Read(iStatus, KOutEndpoint, iDataTransferMan.iReadBuf, aLength); - iDataTransferMan.iTransportResidue -= aLength; - iCurrentState = EHandleDataOut; + { + iLdd.Read(iStatus, KOutEndpoint, iDataTransferMan.iReadBuf, aLength); + iDataTransferMan.iTransportResidue -= aLength; + iCurrentState = EHandleDataOut; SetActive(); - } + } /** @@ -1041,9 +1015,8 @@ @param aStatus indicates the success or failure of the command. */ void CBulkOnlyTransport::SendCsw(TUint aTag, TUint32 aDataResidue, TBotCsw::TCswStatus aStatus) - { - __MSFNLOG - __PRINT2(_L("DataResidue = %d, Status = %d \n"), aDataResidue, aStatus); + { + __PRINT2(_L("DataResidue = %d, Status = %d \n"), aDataResidue, aStatus); iCsw.SetLength(TBotCsw::KCswLength); TBotServerResp resp(iCbwTag, aDataResidue, aStatus); #ifdef MSDC_TESTMODE @@ -1051,10 +1024,10 @@ #else resp.EncodeL(iCsw); #endif - iLdd.Write(iStatus, KInEndpoint, iCsw, TBotCsw::KCswLength); - iCurrentState = ESendingCSW; - SetActive(); - } + iLdd.Write(iStatus, KInEndpoint, iCsw, TBotCsw::KCswLength); + iCurrentState = ESendingCSW; + SetActive(); + } /** @@ -1063,10 +1036,9 @@ @param aProtocol reference to the protocol */ void CBulkOnlyTransport::RegisterProtocol(MServerProtocol& aProtocol) - { - __MSFNLOG - iProtocol = &aProtocol; - } + { + iProtocol = &aProtocol; + } /** @@ -1075,9 +1047,9 @@ @return reference to the controller which instantiate the CBulkOnlyTransport */ CUsbMassStorageController& CBulkOnlyTransport::Controller() - { - return iController; - } + { + return iController; + } /** @@ -1086,10 +1058,9 @@ 0 to a maximum LUN of 15 (Fh). */ TInt CBulkOnlyTransport::MaxLun() - { - __MSFNLOG - return iMaxLun; - } + { + return iMaxLun; + } /** @@ -1097,30 +1068,29 @@ @return reference to USB logical driver */ RDevUsbcClient& CBulkOnlyTransport::Ldd() - { - return iLdd; - } + { + return iLdd; + } void CBulkOnlyTransport::StallEndpointAndWaitForClear(TEndpointNumber aEndpoint) - { - __MSFNLOG - __ASSERT_DEBUG(aEndpoint != EEndpoint0, User::Panic(KUsbMsClientPanicCat, EMsWrongEndpoint)); + { + __ASSERT_DEBUG(aEndpoint != EEndpoint0, User::Panic(KUsbMsClientPanicCat, EMsWrongEndpoint)); - // Now stall this endpoint - __PRINT1(_L("Stalling endpoint %d"), aEndpoint); - __TESTMODEPRINT2("CBW Tag=0x%x: Stalling endpoint %d", iCbwTag, aEndpoint); - TInt r = iLdd.HaltEndpoint(aEndpoint); - if (r != KErrNone) - { - __PRINT2(_L("Error: stalling ep %d failed: %d"), aEndpoint, r); - } - TEndpointState ep_state; - TInt i = 0; - do - { - // Wait for 10ms before checking the ep status - User::After(10000); + // Now stall this endpoint + __PRINT1(_L("Stalling endpoint %d"), aEndpoint); + __TESTMODEPRINT2("CBW Tag=0x%x: Stalling endpoint %d", iCbwTag, aEndpoint); + TInt r = iLdd.HaltEndpoint(aEndpoint); + if (r != KErrNone) + { + __PRINT2(_L("Error: stalling ep %d failed: %d"), aEndpoint, r); + } + TEndpointState ep_state; + TInt i = 0; + do + { + // Wait for 10ms before checking the ep status + User::After(10000); if (aEndpoint == KInEndpoint) { @@ -1138,19 +1108,19 @@ } } - iLdd.EndpointStatus(aEndpoint, ep_state); - if (++i >= 550) - { - // 5.5 secs should be enough (see 9.2.6.1 Request Processing Timing) - __PRINT1(_L("Error: Checked for ep %d de-stall for 5.5s - giving up now"), aEndpoint); + iLdd.EndpointStatus(aEndpoint, ep_state); + if (++i >= 550) + { + // 5.5 secs should be enough (see 9.2.6.1 Request Processing Timing) + __PRINT1(_L("Error: Checked for ep %d de-stall for 5.5s - giving up now"), aEndpoint); __TESTMODEPRINT1("Error: Checked for ep %d de-stall for 5.5s - giving up now", aEndpoint); - // We can now only hope for a Reset Recovery - return; - } - } while ((ep_state == EEndpointStateStalled) && iStarted); - __PRINT2(_L("Checked for ep %d de-stall: %d time(s)"), aEndpoint, i); + // We can now only hope for a Reset Recovery + return; + } + } while ((ep_state == EEndpointStateStalled) && iStarted); + __PRINT2(_L("Checked for ep %d de-stall: %d time(s)"), aEndpoint, i); __TESTMODEPRINT2("Checked for ep %d de-stall: %d time(s)", aEndpoint, i); - } + } @@ -1160,56 +1130,54 @@ @return The number of bytes available in the read buffer */ TInt CBulkOnlyTransport::BytesAvailable() - { - __MSFNLOG - TInt bytes = 0; - TInt err = iLdd.QueryReceiveBuffer(KOutEndpoint, bytes); - if (err != KErrNone) - bytes = 0; - return bytes; - } + { + TInt bytes = 0; + TInt err = iLdd.QueryReceiveBuffer(KOutEndpoint, bytes); + if (err != KErrNone) + bytes = 0; + return bytes; + } /** * Read out rest data from KOutEndpoint and discard them */ void CBulkOnlyTransport::FlushDataOut(TInt aLength) - { - __MSFNLOG - iBuf.SetMax(); - TRequestStatus status; - while (aLength > 0) - { - iLdd.ReadOneOrMore(status, KOutEndpoint, iBuf, iBuf.Length()); - User::WaitForRequest(status); - TInt err = status.Int(); - if (err != KErrNone) - { - // Bad. - break; - } - aLength -= iBuf.Length(); - } - } + { + iBuf.SetMax(); + TRequestStatus status; + while (aLength > 0) + { + iLdd.ReadOneOrMore(status, KOutEndpoint, iBuf, iBuf.Length()); + User::WaitForRequest(status); + TInt err = status.Int(); + if (err != KErrNone) + { + // Bad. + break; + } + aLength -= iBuf.Length(); + } + } void CBulkOnlyTransport::FlushDataIn(TInt aLength) { - iBuf.SetMax(); - TInt c = 0; + iBuf.SetMax(); + TInt c = 0; TInt len; - TRequestStatus status; - while (c < aLength) - { + TRequestStatus status; + while (c < aLength) + { len = aLength - c; - if (len > KBOTMaxBufSize) - { - len = KBOTMaxBufSize; - } - iLdd.Write(status, KInEndpoint, iBuf, len); - User::WaitForRequest(status); - c += KBOTMaxBufSize; - } + if (len > KBOTMaxBufSize) + { + len = KBOTMaxBufSize; + } + iLdd.Write(status, KInEndpoint, iBuf, len); + User::WaitForRequest(status); + c += KBOTMaxBufSize; + } } // @@ -1217,126 +1185,119 @@ // CActiveDeviceStateNotifier::CActiveDeviceStateNotifier(CBulkOnlyTransport& aParent) : CActive(EPriorityStandard), - iParent(aParent), - iDeviceState(EUsbcNoState), - iOldDeviceState(EUsbcNoState) - { - __MSFNLOG - } + iParent(aParent), + iDeviceState(EUsbcNoState), + iOldDeviceState(EUsbcNoState) + { + } CActiveDeviceStateNotifier* CActiveDeviceStateNotifier::NewL(CBulkOnlyTransport& aParent) - { - __MSFNSLOG - CActiveDeviceStateNotifier* self = new (ELeave) CActiveDeviceStateNotifier(aParent); - CleanupStack::PushL(self); - self->ConstructL(); - CActiveScheduler::Add(self); - CleanupStack::Pop(); // self - return (self); - } + { + CActiveDeviceStateNotifier* self = new (ELeave) CActiveDeviceStateNotifier(aParent); + CleanupStack::PushL(self); + self->ConstructL(); + CActiveScheduler::Add(self); + CleanupStack::Pop(); // self + return (self); + } void CActiveDeviceStateNotifier::ConstructL() - { - __MSFNLOG - } + { + } CActiveDeviceStateNotifier::~CActiveDeviceStateNotifier() - { - __MSFNLOG - Cancel(); // base class - } + { + Cancel(); // base class + } void CActiveDeviceStateNotifier::DoCancel() /** * */ - { - __MSFNLOG - iParent.Ldd().AlternateDeviceStatusNotifyCancel(); - } + { + iParent.Ldd().AlternateDeviceStatusNotifyCancel(); + } void CActiveDeviceStateNotifier::RunL() /** * */ - { - __MSFNLOG - // This displays the device state. - // In a real world program, the user could take here appropriate action (cancel a - // transfer request or whatever). - if (!(iDeviceState & KUsbAlternateSetting)) - { - switch (iDeviceState) - { - case EUsbcDeviceStateUndefined: - __PRINT(_L("Device State notifier: Undefined\n")); - iParent.HwStop(); - break; - case EUsbcDeviceStateAttached: - __PRINT(_L("Device State notifier: Attached\n")); - iParent.HwStop(); - break; - case EUsbcDeviceStatePowered: - __PRINT(_L("Device State notifier: Powered\n")); - iParent.HwStop(); - break; - case EUsbcDeviceStateDefault: - __PRINT(_L("Device State notifier: Default\n")); - iParent.HwStop(); - break; - case EUsbcDeviceStateAddress: - __PRINT(_L("Device State notifier: Address\n")); - iParent.HwStop(); - break; - case EUsbcDeviceStateConfigured: - __PRINT(_L("Device State notifier: Configured\n")); - if (iOldDeviceState == EUsbcDeviceStateSuspended) - { - iParent.HwResume(); - } - else - { - iParent.HwStart(); - } - break; - case EUsbcDeviceStateSuspended: - __PRINT(_L("Device State notifier: Suspended\n")); - if (iOldDeviceState == EUsbcDeviceStateConfigured) - { - iParent.HwSuspend(); - } - break; - default: - __PRINT(_L("Device State notifier: ***BAD***\n")); - iParent.HwStop(); - break; - } - iOldDeviceState = iDeviceState; - } - else if (iDeviceState & KUsbAlternateSetting) - { - __PRINT1(_L("Device State notifier: Alternate interface setting has changed: now %d\n"), iDeviceState & ~KUsbAlternateSetting); - } - Activate(); - } + { + // This displays the device state. + // In a real world program, the user could take here appropriate action (cancel a + // transfer request or whatever). + if (!(iDeviceState & KUsbAlternateSetting)) + { + switch (iDeviceState) + { + case EUsbcDeviceStateUndefined: + __PRINT(_L("Device State notifier: Undefined\n")); + iParent.HwStop(); + break; + case EUsbcDeviceStateAttached: + __PRINT(_L("Device State notifier: Attached\n")); + iParent.HwStop(); + break; + case EUsbcDeviceStatePowered: + __PRINT(_L("Device State notifier: Powered\n")); + iParent.HwStop(); + break; + case EUsbcDeviceStateDefault: + __PRINT(_L("Device State notifier: Default\n")); + iParent.HwStop(); + break; + case EUsbcDeviceStateAddress: + __PRINT(_L("Device State notifier: Address\n")); + iParent.HwStop(); + break; + case EUsbcDeviceStateConfigured: + __PRINT(_L("Device State notifier: Configured\n")); + if (iOldDeviceState == EUsbcDeviceStateSuspended) + { + iParent.HwResume(); + } + else + { + iParent.HwStart(); + } + break; + case EUsbcDeviceStateSuspended: + __PRINT(_L("Device State notifier: Suspended\n")); + if (iOldDeviceState == EUsbcDeviceStateConfigured) + { + iParent.HwSuspend(); + } + break; + default: + __PRINT(_L("Device State notifier: ***BAD***\n")); + iParent.HwStop(); + break; + } + iOldDeviceState = iDeviceState; + } + else if (iDeviceState & KUsbAlternateSetting) + { + __PRINT1(_L("Device State notifier: Alternate interface setting has changed: now %d\n"), iDeviceState & ~KUsbAlternateSetting); + } + Activate(); + } void CActiveDeviceStateNotifier::Activate() /** * */ - { - __MSFNLOG - if (IsActive()) - { - __PRINT(_L("Still active\n")); - return; - } - iParent.Ldd().AlternateDeviceStatusNotify(iStatus, iDeviceState); - SetActive(); - } + { + if (IsActive()) + { + __PRINT(_L("Still active\n")); + return; + } + iParent.Ldd().AlternateDeviceStatusNotify(iStatus, iDeviceState); + SetActive(); + } diff -r 94f2adf59133 -r b2826f67641f kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/usbtestmsclient.mmh --- a/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/usbtestmsclient.mmh Tue Oct 26 11:12:58 2010 +0100 +++ b/kerneltest/f32test/shostmassstorage/testclient/usbtestmsclient/usbtestmsclient.mmh Tue Oct 26 12:49:20 2010 +0100 @@ -13,53 +13,52 @@ // Description: // -TARGETTYPE fsy +TARGETTYPE fsy OS_LAYER_SYSTEMINCLUDE_SYMBIAN #ifdef SYMBIAN_OLD_EXPORT_LOCATION SYMBIAN_BASE_SYSTEMINCLUDE(kernel) #endif -USERINCLUDE ./inc -USERINCLUDE ./transport/include -USERINCLUDE ./protocol/include +USERINCLUDE ./inc +USERINCLUDE ./transport/include +USERINCLUDE ./protocol/include -USERINCLUDE ./transport +USERINCLUDE ./transport -SOURCEPATH ./protocol -SOURCE cscsiserverprotocol.cpp -SOURCE tscsiserverreq.cpp -SOURCE tscsiservercmds.cpp -SOURCE testman.cpp +SOURCEPATH ./protocol +SOURCE cscsiserverprotocol.cpp +SOURCE tscsiserverreq.cpp +SOURCE tscsiservercmds.cpp +SOURCE testman.cpp -SOURCEPATH ./transport -SOURCE botcontrolinterface.cpp -SOURCE botmscserver.cpp -SOURCE cbulkonlytransport.cpp +SOURCEPATH ./transport +SOURCE botcontrolinterface.cpp +SOURCE botmscserver.cpp +SOURCE cbulkonlytransport.cpp -SOURCEPATH . -SOURCE cmassstoragefilesystem.cpp -SOURCE cmassstoragemountcb.cpp -SOURCE cusbmassstoragecontroller.cpp -SOURCE cusbmassstorageserver.cpp -SOURCE cusbmassstoragesession.cpp -SOURCE drivemanager.cpp -SOURCE drivepublisher.cpp -SOURCE msdebug.cpp +SOURCEPATH . +SOURCE cmassstoragefilesystem.cpp +SOURCE cmassstoragemountcb.cpp +SOURCE cusbmassstoragecontroller.cpp +SOURCE cusbmassstorageserver.cpp +SOURCE cusbmassstoragesession.cpp +SOURCE drivemanager.cpp +SOURCE drivepublisher.cpp -LIBRARY efile.lib efsrv.lib euser.lib +LIBRARY efile.lib efsrv.lib euser.lib START WINS -BASEADDRESS 0x61000000 +BASEADDRESS 0x61000000 END -UID 0 0x100000d6 //TODO reserve new UID +UID 0 0x100000d6 //TODO reserve new UID unpaged -#include "../../../userlibandfileserver/fileserver/group/f32caps.mmh" // Capabilities of File Server process -#include "../../../userlibandfileserver/fileserver/group/f32.mmh" // Generic definitions for the whole f32 component +#include "../../../userlibandfileserver/fileserver/group/f32caps.mmh" // Capabilities of File Server process +#include "../../../userlibandfileserver/fileserver/group/f32.mmh" // Generic definitions for the whole f32 component SMPSAFE diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/group/f32caps.mmh --- a/userlibandfileserver/fileserver/group/f32caps.mmh Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/group/f32caps.mmh Tue Oct 26 12:49:20 2010 +0100 @@ -18,4 +18,4 @@ // Capabilities of File Server process // -CAPABILITY TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD \ No newline at end of file +CAPABILITY TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/group/release.txt --- a/userlibandfileserver/fileserver/group/release.txt Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/group/release.txt Tue Oct 26 12:49:20 2010 +0100 @@ -1,3 +1,13 @@ +Version 2.00.4008 +================= +(Made by fadhliM 25/10/2010) + +1. migubarr, niccox + 1. Release Plan 590599 428-1323 Instrument File Server + REQ 428-1323 Instrument file server caching, media drivers and USB Mass Storage + SUB 417-76706 Instrument File Server caching + + Version 2.00.4007 ================= (Made by fadhliM 15/10/2010) diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/inc/f32dbg.h --- a/userlibandfileserver/fileserver/inc/f32dbg.h Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/inc/f32dbg.h Tue Oct 26 12:49:20 2010 +0100 @@ -195,6 +195,8 @@ const TInt KControlIoSimulateMemoryLow=KMaxTInt-28; const TInt KControlIoStopSimulateMemoryLow=KMaxTInt-29; +const TInt KControlIoHeapCellCount=KMaxTInt-30; + const TInt KNCDebugNotifierValue=-500000; // between 0 and 1 second GLREF_D TInt DebugNCNotifier; diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/inc/f32ver.h --- a/userlibandfileserver/fileserver/inc/f32ver.h Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/inc/f32ver.h Tue Oct 26 12:49:20 2010 +0100 @@ -58,6 +58,6 @@ @see TVersion */ -const TInt KF32BuildVersionNumber=4007; +const TInt KF32BuildVersionNumber=4008; // #endif diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/sfile/sf_cache_man.cpp --- a/userlibandfileserver/fileserver/sfile/sf_cache_man.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_cache_man.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -42,6 +42,10 @@ #include #endif +#ifdef OST_TRACE_COMPILER_IN_USE +#include "sf_cache_manTraces.h" +#endif + #define CACHE_NUM_TO_ADDR(n) (iBase + (n << iCacheLineSizeLog2)) #define ADDR_TO_CACHELINE_ADDR(a) ((((a - iBase) >> iCacheLineSizeLog2) << iCacheLineSizeLog2) + iBase) #define ADDR_TO_INDEX(a) ((a - iBase) >> iCacheLineSizeLog2) @@ -189,7 +193,7 @@ TInt r = UserHal::MemoryInfo(meminfo); __ASSERT_ALWAYS(r==KErrNone,Fault(EMemoryInfoFailed)); - iLowMemoryThreshold = (meminfo().iTotalRamInBytes * TGlobalFileCacheSettings::LowMemoryThreshold()) / 100; + iLowMemoryThreshold = (meminfo().iTotalRamInBytes / 100) * TGlobalFileCacheSettings::LowMemoryThreshold(); __CACHE_PRINT4(_L("CACHEMAN: totalRAM %d freeRAM %d KDefaultLowMemoryThresholdPercent %d iLowMemoryThreshold %d"), meminfo().iTotalRamInBytes, meminfo().iFreeRamInBytes, KDefaultLowMemoryThreshold, iLowMemoryThreshold); __CACHE_PRINT1(_L("CACHEMAN: iCacheSize %d"), iCacheSize); @@ -199,6 +203,13 @@ r = iChunk.Create(createInfo); User::LeaveIfError(r); +#ifdef OST_TRACE_COMPILER_IN_USE + TName chunkName = iChunk.Name(); + OstTraceData(TRACE_FILECACHE_MANAGER, FILECACHEMAN_CHUNK_NAME, "Chunk name %S", chunkName.Ptr(), chunkName.Length()<<1); + OstTraceExt5(TRACE_FILECACHE_MANAGER, FILECACHEMAN_CHUNK_PARM, + "totalRAM %d freeRAM %d KDefaultLowMemoryThresholdPercent %d iLowMemoryThreshold %d iCacheSize %d", + meminfo().iTotalRamInBytes, meminfo().iFreeRamInBytes, KDefaultLowMemoryThreshold, iLowMemoryThreshold, iCacheSize); +#endif // OST_TRACE_COMPILER_IN_USE TInt mm = UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemModelInfo, 0, 0) & EMemModelTypeMask; if (mm < EMemModelTypeFlexible) @@ -309,6 +320,7 @@ iStats.iFreeCount = iFreeQueue.Count(); iStats.iUsedCount = iUsedQueue.Count(); iStats.iLockedSegmentCount = iLockedSegmentCount; + iStats.iAllocatedSegmentCount = iAllocatedSegmentCount; iStats.iFilesOnClosedQueue = TClosedFileUtils::Count(); __ASSERT_DEBUG(iStats.iFreeCount >= 0, Fault(EInvalidStats)); __ASSERT_DEBUG(iStats.iUsedCount >= 0, Fault(EInvalidStats)); @@ -349,6 +361,7 @@ if (iMemoryLow || (meminfo().iFreeRamInBytes < iLowMemoryThreshold)) { __CACHE_PRINT(_L("CACHEMAN: free RAM below threshold !!!")); + OstTrace0(TRACE_FILECACHE_MANAGER, FILECACHEMAN_LOW_MEM, "Free RAM below threshold"); return KErrNoMemory; } @@ -361,6 +374,8 @@ if (SimulatedFailure(iAllocFailureCount)) { __CACHE_PRINT(_L("CACHEMAN: simulating allocation failure")); + OstTrace0(TRACE_FILECACHE_MANAGER, FILECACHEMAN_SIMULATING_ALLOC_FAILURE, "Simulating alloc failure"); + CacheUnlock(); return KErrNoMemory; } @@ -414,6 +429,8 @@ // Remove from free queue iFreeQueue.Remove(0); + OstTraceExt2(TRACE_FILECACHE_MANAGER, FILECACHEMAN_ALLOC_CACHELINE, "cachelines: free %d used %d", iFreeQueue.Count(), iUsedQueue.Count()); + // RChunk will lock segments initially unless explicitly unlocked cacheLine->iLockCount++; @@ -905,6 +922,7 @@ __ASSERT_ALWAYS(r == KErrNone, Fault(EAppendToFreeQueueFailed)); __CACHE_PRINT2(_L("CACHEMAN: FreeCacheLine, iFreeQueue %d iUsedQueue %d"), iFreeQueue.Count(), iUsedQueue.Count()); + OstTraceExt2(TRACE_FILECACHE_MANAGER, FILECACHEMAN_FREE_CACHELINE, "cachelines: free %d used %d", iFreeQueue.Count(), iUsedQueue.Count()); } @@ -984,6 +1002,8 @@ if (SimulatedFailure(iLockFailureCount)) { __CACHE_PRINT(_L("CACHEMAN: simulating lock failure")); + OstTrace0(TRACE_FILECACHE_MANAGER, FILECACHEMAN_SIMULATING_LOCK_FAILURE, "Simulating lock failure"); + r = KErrNotFound; } #endif @@ -991,10 +1011,14 @@ if (r == KErrNone) { iLockedSegmentCount+= aSegmentCount; + + OstTrace1(TRACE_FILECACHE_MANAGER, FILECACHEMAN_LOCK_SEGMENTS, "Locked segments %d", iLockedSegmentCount); } else { __CACHE_PRINT(_L("CACHEMAN: LOCK FAILED")); + OstTrace1(TRACE_FILECACHE_MANAGER, FILECACHEMAN_LOCK_FAILURE, "Failure r %d", r); + #if defined(_DEBUG) || defined(_DEBUG_RELEASE) iStats.iLockFailureCount++; #endif @@ -1012,6 +1036,8 @@ if (r == KErrNone) { iLockedSegmentCount-= aSegmentCount; + + OstTrace1(TRACE_FILECACHE_MANAGER, FILECACHEMAN_UNLOCK_SEGMENTS, "Locked segments %d", iLockedSegmentCount); } else { @@ -1027,6 +1053,8 @@ if (SimulatedFailure(iCommitFailureCount)) { __CACHE_PRINT(_L("CACHEMAN: simulating commit failure ")); + OstTrace0(TRACE_FILECACHE_MANAGER, FILECACHEMAN_SIMULATING_COMMIT_FAILURE, "Simulating commit failure"); + return KErrNoMemory; } #endif @@ -1038,13 +1066,15 @@ if (r == KErrNone) { iLockedSegmentCount+= aSegmentCount; -#if defined(_DEBUG) || defined(_DEBUG_RELEASE) - iStats.iAllocatedSegmentCount+= aSegmentCount; -#endif + iAllocatedSegmentCount+= aSegmentCount; + + OstTrace1(TRACE_FILECACHE_MANAGER, FILECACHEMAN_COMMIT_SEGMENTS, "Allocated segments %d", iAllocatedSegmentCount); } else { __CACHE_PRINT(_L("CACHEMAN: COMMIT FAILED")); + OstTrace1(TRACE_FILECACHE_MANAGER, FILECACHEMAN_COMMIT_FAILURE, "Failure r %d", r); + #if defined(_DEBUG) || defined(_DEBUG_RELEASE) iStats.iCommitFailureCount++; #endif @@ -1064,9 +1094,9 @@ __CACHE_PRINT3(_L("CACHEMAN: DECOMMIT: %08X %d %d, "), aAddr, aSegmentCount, r); if (r == KErrNone) { -#if defined(_DEBUG) || defined(_DEBUG_RELEASE) - iStats.iAllocatedSegmentCount-= aSegmentCount; -#endif + iAllocatedSegmentCount-= aSegmentCount; + + OstTrace1(TRACE_FILECACHE_MANAGER, FILECACHEMAN_DECOMMIT_SEGMENTS, "Allocated segments %d", iAllocatedSegmentCount); } else { @@ -1081,13 +1111,15 @@ void CCacheManager::SimulateLockFailureMode(TBool aEnable) { iSimulateLockFailureMode = aEnable; -__CACHE_PRINT1(_L("CACHEMAN: SimulateLockFailureMode: %d, "), iSimulateLockFailureMode); + + __CACHE_PRINT1(_L("CACHEMAN: SimulateLockFailureMode: %d, "), iSimulateLockFailureMode); + OstTrace1(TRACE_FILECACHE_MANAGER, FILECACHEMAN_SIMULATE_LOCK_FAILURE_MODE, "aEnable %d", aEnable); } void CCacheManager::AllocateMaxSegments(TBool aEnable) { iAllocateMaxSegments = aEnable; -__CACHE_PRINT1(_L("CACHEMAN: iAllocateMaxSegments: %d, "), iAllocateMaxSegments); + __CACHE_PRINT1(_L("CACHEMAN: iAllocateMaxSegments: %d, "), iAllocateMaxSegments); } TBool CCacheManager::AllocateMaxSegments() diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/sfile/sf_cache_man.h --- a/userlibandfileserver/fileserver/sfile/sf_cache_man.h Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_cache_man.h Tue Oct 26 12:49:20 2010 +0100 @@ -198,6 +198,7 @@ TInt iSegmentsPerCacheLine; TInt iLockedSegmentCount; + TInt iAllocatedSegmentCount; RChunk iChunk; TBool iSimulateLockFailureMode; diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/sfile/sf_debug.cpp --- a/userlibandfileserver/fileserver/sfile/sf_debug.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_debug.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -622,6 +622,14 @@ TInt r=aRequest->Write(2,pkgBuf); return r; } + + case KControlIoHeapCellCount: + { + TPckgBuf pkgBuf(User::Allocator().Count()); + TInt r=aRequest->Write(2,pkgBuf); + return r; + } + // Check if the file is in 'file sequential/non-rugged file' mode case KControlIoIsFileSequential: { diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/sfile/sf_drv.cpp --- a/userlibandfileserver/fileserver/sfile/sf_drv.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_drv.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1452,10 +1452,16 @@ if (pFileCache) { pFileCache = pFileCache->ReNewL(*pFileShare); // NB may return NULL if caching not enabled + + OstTraceExt3(TRACE_FILECACHE, FILECACHE_RENEW_FILE_CACHE1, "ReNew FileCache %x File %x drive %u", (TUint) pFileCache, (TUint) &pFileShare->File(), (TUint) DriveNumber()); + OstTraceData(TRACE_FILECACHE, FILECACHE_RENEW_FILE_CACHE2, "Name %S", pFileShare->File().iFileNameF->Ptr(), pFileShare->File().iFileNameF->Length()<<1); } else { pFileCache = CFileCache::NewL(*pFileShare); // NB may return NULL if caching not enabled + + OstTraceExt3(TRACE_FILECACHE, FILECACHE_NEW_FILE_CACHE1, "New FileCache %x FileCB %x drive %u", (TUint) pFileCache, (TUint) &pFileShare->File(), (TUint) DriveNumber()); + OstTraceData(TRACE_FILECACHE, FILECACHE_NEW_FILE_CACHE2, "Name %S", pFileShare->File().iFileNameF->Ptr(), pFileShare->File().iFileNameF->Length()<<1); } if (pFileCache) // Set the cached size to be the same as the uncached size diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/sfile/sf_file_cache.cpp --- a/userlibandfileserver/fileserver/sfile/sf_file_cache.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_file_cache.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -241,6 +241,7 @@ CleanupClosePushL(*fileCache); fileCache->ConstructL(aShare); CleanupStack::Pop(1, fileCache); + return fileCache; } @@ -305,6 +306,8 @@ delete iCacheClient; delete iFileNameF; + + OstTraceExt2(TRACE_FILECACHE, FILECACHE_DELETE, "fileCache %x fileCB %x", (TUint) this, (TUint) iFileCB); } @@ -316,6 +319,8 @@ TInt CFileCache::DirtyTimerEvent(TAny* aFileCache) { + OstTrace1(TRACE_FILECACHE, FILECACHE_DIRTY_DATA_TIMER_EXPIRY, "fileCache %x", (TUint) aFileCache); + // Cannot report errors here // coverity [unchecked_value] (void)((CFileCache*) aFileCache)->FlushDirty(); @@ -340,7 +345,9 @@ __ASSERT_DEBUG(!iDirtyDataOwner, Fault(EClosingDirtyFile)); } #endif - + + // there should be no dirty data (see assert above) but clean up just in case + MarkFileClean(); __CACHE_PRINT2(_L("CFileCache::Close() iFileCB %08X IsClosed %d"), iFileCB, TClosedFileUtils::IsClosed(this)); @@ -350,6 +357,8 @@ !TClosedFileUtils::IsClosed(this) && IsDriveThread()) { + OstTrace1(TRACE_FILECACHE, FILECACHE_MODE_TO_CLOSEQ, "Moving to close queue, fileCache %x", (TUint) this); + // add to ClosedFiles container __CACHE_PRINT1(_L("CLOSEDFILES: Adding %S\n"), &iFileCB->FileNameF() ); TRAP(r, TClosedFileUtils::AddL(this, ETrue)); @@ -567,6 +576,10 @@ if (r != KErrNone) return; + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_READ_AHEAD, "Issue read ahead, clientThreadId %x fileCache %x pos %x:%x len %d", + (TUint) threadId, (TUint) this, (TUint) I64HIGH(iReadAheadPos), (TUint) I64LOW(iReadAheadPos), iReadAheadLen); + r = newRequest->PushOperation( iReadAheadPos, iReadAheadLen, @@ -840,6 +853,11 @@ if (totalLen > iCacheSize) { TInt len = totalLen - iCacheSize; + + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_READ_UNCACHED1, "Read, media to client, clientThreadId %x fileCache %x pos %x:%x len %d", + (TUint) threadId, (TUint) this, (TUint) I64HIGH(currentPos), (TUint) I64LOW(currentPos), (TUint) len); + TInt r = aMsgRequest.PushOperation( currentPos, len, (TDesC8*) currentOperation->iReadWriteArgs.iData, currentOffset, @@ -891,6 +909,11 @@ // read into cache segment(s) __CACHE_PRINT2(_L("CACHEFILE: read pos %ld, readLen %d"), segmentStartPos, readLen); + + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_READ_CACHED1, "Read, media to cache, clientThreadId %x fileCache %x pos %x:%x len %d", + (TUint) threadId, (TUint) this, (TUint) I64HIGH(segmentStartPos), (TUint) I64LOW(segmentStartPos), (TUint) readLen); + TInt r = aMsgRequest.PushOperation( segmentStartPos, readLen, addr, 0, CompleteRead, @@ -924,6 +947,10 @@ // if addr is NULL then this is a read ahead request if (currentOperation->iReadWriteArgs.iData != NULL) { + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_READ_COPY, "Read, cache to client, clientThreadId %x fileCache %x pos %x:%x len %d", + (TUint) threadId, (TUint) this, (TUint) I64HIGH(currentPos), (TUint) I64LOW(currentPos), (TUint) len); + if (currentOperation->iClientRequest) { __ASSERT_DEBUG (aMsgRequest.Message().Handle() != NULL, Fault(EMsgAlreadyCompleted)); @@ -978,6 +1005,10 @@ addr = (TUint8*) currentOperation->iScratchValue0; readLen = (TInt) currentOperation->iScratchValue1; + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt3(TRACE_FILECACHE, FILECACHE_READ_COMPLETE, "Read, media to cache, clientThreadId %x fileCache %x r %d", + (TUint) threadId, (TUint) this, (TUint) (TUint) lastError); + aMsgRequest.CurrentOperation().iState = EStCopyToClient; } break; @@ -1027,6 +1058,11 @@ aMsgRequest.ReStart(); UpdateSharePosition(aMsgRequest, *currentOperation); + + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_READ_UNCACHED2, "Read media to client, clientThreadId %x fileCache %x pos %x:%x len %d", + (TUint) threadId, (TUint) this, (TUint) I64HIGH(currentPos), (TUint) I64LOW(currentPos), (TUint) totalLen); + return retCode; @@ -1205,6 +1241,11 @@ iCacheClient->Purge(ETrue); TInt len = totalLen - iCacheSize; + + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_WRITE_UNCACHED1, "Write, client to media, clientThreadId %x fileCache %x pos %x:%x len %d", + (TUint) threadId, (TUint) this, (TUint) I64HIGH(currentPos), (TUint) I64LOW(currentPos), (TUint) len); + TInt r = aMsgRequest.PushOperation( currentPos, len, (TDesC8*) currentOperation->iReadWriteArgs.iData, currentOffset, @@ -1394,6 +1435,11 @@ #pragma warning( default : 4244 ) #endif __ASSERT_DEBUG (aMsgRequest.Message().Handle() != NULL, Fault(EMsgAlreadyCompleted)); + + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_READ_CACHED2, "Read, media to cache, clientThreadId %x fileCache %x pos %x:%x len %d", + (TUint) threadId, (TUint) this, (TUint) I64HIGH(readPos), (TUint) I64LOW(readPos), (TUint) readLen); + TInt r = aMsgRequest.PushOperation( readPos, readLen, readAddr, 0, CompleteWrite, @@ -1446,6 +1492,11 @@ __ASSERT_DEBUG (aMsgRequest.Message().Handle() != NULL, Fault(EMsgAlreadyCompleted)); // copy from user buffer to cache buffer TInt writeError = KErrNone; + + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_WRITE_COPY, "Write, client to cache, clientThreadId %x fileCache %x pos %x:%x len %d", + (TUint) threadId, (TUint) this, (TUint) I64HIGH(currentPos), (TUint) I64LOW(currentPos), (TUint) writeLen); + if (currentOperation->iClientRequest) { TPtr8 ptr(addr+offset, writeLen, writeLen); @@ -1549,14 +1600,20 @@ currentOperation->iState = EStReStart; case EStReStart: - + { __ASSERT_DEBUG(retCode == CFsRequest::EReqActionBusy || retCode == CFsRequest::EReqActionContinue, Fault(EBadRetCode)); aMsgRequest.ReStart(); UpdateSharePosition(aMsgRequest, *currentOperation); if (currentOperation->iClientRequest) currentOperation->iReadWriteArgs.iPos = currentOperation->iClientPosition; // NB maybe KCurrentPosition64 + + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_WRITE_UNCACHED2, "Write, client to media, clientThreadId %x fileCache %x pos %x:%x len %d", + (TUint) threadId, (TUint) this, (TUint) I64HIGH(currentPos), (TUint) I64LOW(currentPos), (TUint) totalLen); + return retCode; + } case EStEnd: return retCode; @@ -1604,6 +1661,15 @@ CFsClientMessageRequest* newRequest = NULL; +#if defined (OST_TRACE_COMPILER_IN_USE) + RMessage2 msgOld; + if (aOldRequest) + msgOld = const_cast (aOldRequest->Message()); + TRACETHREADID(msgOld); + OstTraceExt2(TRACE_FILECACHE, FILECACHE_FLUSH_DIRTY, "clientThreadId %x fileCache %x", (TUint) threadId, (TUint) this); +#endif // if defined (OST_TRACE_COMPILER_IN_USE) + + TInt r = DoFlushDirty(newRequest, aOldRequest, EFlushAll); iLock.Signal(); @@ -1883,6 +1949,9 @@ currentOperation->Set(pos, len, addr, 0, EStWriteToDiskComplete); if (pos < iSize64) { + OstTraceExt4(TRACE_FILECACHE, FILECACHE_WRITE_DIRTY, "Write, cache to media, fileCache %x pos %x:%x len %d", + (TUint) this, (TUint) I64HIGH(pos), (TUint) I64LOW(pos), (TUint) len); + TInt r = aMsgRequest.PushOperation( pos, len, addr, 0, CompleteFlushDirty, @@ -1909,6 +1978,10 @@ iDrive->Dismount(); } #endif + TRACETHREADID(aMsgRequest.Message()); + OstTraceExt3(TRACE_FILECACHE, FILECACHE_FLUSH_DIRTY_COMPLETE, "Write, cache to media, clientThreadId %x fileCache %x r %d", + (TUint) threadId, (TUint) this, (TUint) lastError); + pos = currentOperation->iReadWriteArgs.iPos; iCacheClient->UnlockSegments(pos); } @@ -2129,7 +2202,11 @@ CDriveThread* driveThread=NULL; TInt r = FsThreadManager::GetDriveThread(iDriveNum, &driveThread); if(r == KErrNone && driveThread != NULL) + { + OstTrace1(TRACE_FILECACHE, FILECACHE_STARTING_DIRTY_DATA_TIMER, "Starting dirty data timer() fileCache %x", (TUint) this); + iDirtyTimer.Start(driveThread, iDirtyDataFlushTime); + } } //---------------------------------------------------------------------------- @@ -2294,6 +2371,14 @@ driveCacheSettings->iClosedFileKeepAliveTime, driveCacheSettings->iDirtyDataFlushTime); + OstTraceExt5(TRACE_FILECACHE, FILECACHE_SETTINGS, + "Drive %d Flags %x CacheSize %d FileCacheReadAsync %d FairSchedulingLen %d ", + (TUint) aDriveNumber, + (TUint) driveCacheSettings->iFlags, + (TUint) driveCacheSettings->iCacheSize, + (TUint) driveCacheSettings->iFileCacheReadAsync, + (TUint) driveCacheSettings->iFairSchedulingLen); + return KErrNone; } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/client/debug.h --- a/userlibandfileserver/fileserver/shostmassstorage/client/debug.h Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -// Copyright (c) 2008-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" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -/** - @file - @internalTechnology -*/ - -#ifndef DEBUG_H -#define DEBUG_H - -#if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#include -#endif - -// #define _USBMS_DEBUG_PRINT_ -// #define _MSDEVICE_DEBUG_PRINT_ - -#if defined(_USBMS_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -/** Trace - format string */ -#define __PRINT(t) {RDebug::Print(t);} -/** Trace - format string with 1 param */ -#define __PRINT1(t,a) {RDebug::Print(t,a);} -/** Trace - format string with 2 params */ -#define __PRINT2(t,a,b) {RDebug::Print(t,a,b);} -/** Trace - format string with 3 params */ -#define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} -/** Trace - format string with 4 params */ -#define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} -/** Trace - format string with 5 params */ -#define __PRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} - - -_LIT(KMsgIn, ">>%S\n"); -_LIT(KMsgOut,"<<%S\n"); - -class TMSLogFn -{ - protected: - TBuf<100> iName; - - public: - TMSLogFn(const TDesC& aName){iName = aName; RDebug::Print(KMsgIn, &iName);}; - ~TMSLogFn(){RDebug::Print(KMsgOut, &iName);}; -}; - -#define __FNLOG(name) TMSLogFn __fn_log__(_L(name)) - -#else - -/** NULL definition */ -#define __PRINT(t) -/** NULL definition */ -#define __PRINT1(t,a) -/** NULL definition */ -#define __PRINT2(t,a,b) -/** NULL definition */ -#define __PRINT3(t,a,b,c) -/** NULL definition */ -#define __PRINT4(t,a,b,c,d) -/** NULL definition */ -#define __PRINT5(t,a,b,c,d,e) -/** NULL definition */ -#define __FNLOG(name) -#endif - - -#if defined (_MSDEVICE_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#define __MSDEVPRINT(t) {RDebug::Print(t);} -#define __MSDEVPRINT1(t,a) {RDebug::Print(t,a);} -#define __MSDEVPRINT2(t,a,b) {RDebug::Print(t,a,b);} -#else -#define __MSDEVPRINT(t) -#define __MSDEVPRINT1(t,a) -#define __MSDEVPRINT2(t,a,b) -#endif // _MSDEVICE_DEBUG_PRINT_ - -#endif // DEBUG_H diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/client/hostmsclient.mmp --- a/userlibandfileserver/fileserver/shostmassstorage/client/hostmsclient.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/client/hostmsclient.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -16,24 +16,26 @@ // // -TARGET usbhostmsclient.dll +TARGET usbhostmsclient.dll -TARGETTYPE dll +TARGETTYPE dll OS_LAYER_SYSTEMINCLUDE_SYMBIAN USERINCLUDE . USERINCLUDE ../shared +USERINCLUDE traces SOURCEPATH . -SOURCE rusbhostmslogicalunit.cpp -SOURCE rusbhostmsdevice.cpp +SOURCE rusbhostmslogicalunit.cpp +SOURCE rusbhostmsdevice.cpp LIBRARY efsrv.lib euser.lib hal.lib usbdescriptors.lib usbdi_utils.lib -CAPABILITY TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD NetworkControl WriteDeviceData +CAPABILITY TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD NetworkControl WriteDeviceData -//MACRO _USBMS_DEBUG_PRINT_ +deffile ../../~/usbhostms.def -deffile ../../~/usbhostms.def +UID 0x20036401 +VENDORID 0x70000001 SMPSAFE diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmsdevice.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmsdevice.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmsdevice.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -22,14 +22,18 @@ #include #include "rusbhostmsdevice.h" -#include "debug.h" #include "msgservice.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "rusbhostmsdeviceTraces.h" +#endif + + _LIT(KFileSystem, "FAT"); TVersion RUsbHostMsDevice::Version() const { - __FNLOG("RUsbHostMsDevice::Version"); return(TVersion(KUsbHostMsSrvMajorVersionNumber, KUsbHostMsSrvMinorVersionNumber, KUsbHostMsSrvBuildVersionNumber)); @@ -38,7 +42,6 @@ TInt RUsbHostMsDevice::StartServer() { - __FNLOG("RUsbHostMsDevice::StartServer"); TInt r; RProcess server; @@ -48,7 +51,8 @@ // Create the server process if((r=server.Create(KUsbHostMsServerName,KNullDesC,serverUid)) != KErrNone) { - __PRINT1(_L("Server process create = %d\n"), r); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSDEVICE_10, + "Server process create = %d", r); return r; } @@ -61,7 +65,7 @@ } else { - server.SetPriority(EPriorityHigh); + server.SetPriority(EPriorityHigh); server.Resume(); // start the server } @@ -96,7 +100,6 @@ */ EXPORT_C void RUsbHostMsDevice::Add(const THostMassStorageConfig& aConfig, TRequestStatus& aStatus) { - __FNLOG("RUsbHostMsDevice::Add"); TInt err = KErrNone; err = CreateSession(KUsbHostMsServerName, Version(), 128, EIpcSession_GlobalSharable); @@ -119,39 +122,41 @@ } } - TRequestStatus* statusPtr = &aStatus; + TRequestStatus* statusPtr = &aStatus; if(err == KErrNone) { // Create a session handle that can be passed via IPC to another process // (also being shared by other threads in the current process) - err = ShareProtected(); + err = ShareProtected(); if(err == KErrNone) { // synchronous call to register the interface - TPckg pckg(aConfig); - err = SendReceive(EUsbHostMsRegisterInterface, TIpcArgs(&pckg)); - if(err != KErrNone) - { - User::RequestComplete(statusPtr, err); - } - else - { - // Asynchronous call to initialise the interface - SendReceive(EUsbHostMsInitialiseInterface, TIpcArgs(NULL), aStatus); - } - } + TPckg pckg(aConfig); + err = SendReceive(EUsbHostMsRegisterInterface, TIpcArgs(&pckg)); + if(err != KErrNone) + { + User::RequestComplete(statusPtr, err); + } + else + { + // Asynchronous call to initialise the interface + SendReceive(EUsbHostMsInitialiseInterface, TIpcArgs(NULL), aStatus); + } + } else { Close(); // Close the session handle - __PRINT1(_L("Could not create a sharable session handle %d\n"), err); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSDEVICE_11, + "Could not create a sharable session handle %d", err); User::RequestComplete(statusPtr, err); } } else { - // Check whether the error is in starting the server or in creating the + // Check whether the error is in starting the server or in creating the // session - __PRINT1(_L("Creating server/session failed with %d\n"), err); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSDEVICE_12, + "Creating server/session failed with %d", err); User::RequestComplete(statusPtr, err); } } @@ -165,18 +170,17 @@ */ EXPORT_C void RUsbHostMsDevice::Remove() { - // Note: Here, at present we use only the interface token. But we still take + // Note: Here, at present we use only the interface token. But we still take // THostMassStorageConfig as parameter for future needs - __FNLOG("RUsbHostMsDevice::Remove"); - _LIT(KUsbHostMsClientPanicCat, "usbhostmsclient"); + _LIT(KUsbHostMsClientPanicCat, "usbhostmsclient"); + + TInt r = SendReceive(EUsbHostMsUnRegisterInterface); - TInt r = SendReceive(EUsbHostMsUnRegisterInterface); - - r = SendReceive(EUsbHostMsFinalCleanup); - if(r != KErrNone) - { - User::Panic(KUsbHostMsClientPanicCat ,KErrCouldNotDisconnect); - } + r = SendReceive(EUsbHostMsFinalCleanup); + if(r != KErrNone) + { + User::Panic(KUsbHostMsClientPanicCat ,KErrCouldNotDisconnect); + } Close(); // Close the session handle } @@ -195,63 +199,64 @@ */ EXPORT_C TInt RUsbHostMsDevice::GetNumLun(TUint32& aNumLuns) { - __FNLOG("RUsbHostMsDevice::GetNumLun"); TPckg pckg(aNumLuns); return SendReceive(EUsbHostMsGetNumLun,TIpcArgs(&pckg)); } EXPORT_C TInt RUsbHostMsDevice::MountLun(TUint32 aLunId, TInt aDriveNum) - { - __FNLOG("RUsbHostMsDevice::MountLun"); - __MSDEVPRINT2(_L(">>> RUsbHostMsDevice::MountLun Drv=%d LUN=%d"), aDriveNum, aLunId); - RFs TheFs; - TInt r = TheFs.Connect(); - if(r == KErrNone) - { - TPckgBuf unitPkg; - unitPkg().iLunID = aLunId; + { + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_MSDEV, RUSBHOSTMSDEVICE_13, + ">>> RUsbHostMsDevice::MountLun Drv=%d LUN=%d", aDriveNum, aLunId); + RFs TheFs; + TInt r = TheFs.Connect(); + if(r == KErrNone) + { + TPckgBuf unitPkg; + unitPkg().iLunID = aLunId; - r = TheFs.MountProxyDrive(aDriveNum, _L("usbhostms"), &unitPkg, *this); - __MSDEVPRINT1(_L("MountProxyDrive %d"), r); - if(r >= KErrNone) - { - r = TheFs.MountFileSystem(KFileSystem, aDriveNum); - __MSDEVPRINT1(_L("MountFileSystem %d"), r); - if(r != KErrNone && r != KErrNotReady && r != KErrCorrupt && r != KErrNotSupported) - { - TheFs.DismountFileSystem(KFileSystem, aDriveNum); - TheFs.DismountProxyDrive(aDriveNum); - } - } - TheFs.Close(); - } - return r; - } + r = TheFs.MountProxyDrive(aDriveNum, _L("usbhostms"), &unitPkg, *this); + OstTrace1(TRACE_SHOSTMASSSTORAGE_MSDEV, RUSBHOSTMSDEVICE_14, + "MountProxyDrive %d", r); + if(r >= KErrNone) + { + r = TheFs.MountFileSystem(KFileSystem, aDriveNum); + OstTrace1(TRACE_SHOSTMASSSTORAGE_MSDEV, RUSBHOSTMSDEVICE_15, + "MountFileSystem %d", r); + if(r != KErrNone && r != KErrNotReady && r != KErrCorrupt && r != KErrNotSupported) + { + TheFs.DismountFileSystem(KFileSystem, aDriveNum); + TheFs.DismountProxyDrive(aDriveNum); + } + } + TheFs.Close(); + } + return r; + } EXPORT_C TInt RUsbHostMsDevice::DismountLun(TInt aDriveNum) - { - __FNLOG("RUsbHostMsDevice::DismountLun"); - __MSDEVPRINT1(_L(">>> RUsbHostMsDevice::DismountLun Drv=%d"), aDriveNum); - RFs TheFs; - TInt r; - r = TheFs.Connect(); - if(r == KErrNone) - { - r = TheFs.DismountFileSystem(KFileSystem, aDriveNum); - if(r != KErrNone) - { - // dismount failed - attempt a forced dismount - TRequestStatus stat; - TheFs.NotifyDismount(aDriveNum, stat, EFsDismountForceDismount); - User::WaitForRequest(stat); - r = stat.Int(); - } - if(r == KErrNone) - { - r = TheFs.DismountProxyDrive(aDriveNum); - } - TheFs.Close(); - } - return r; - } + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_MSDEV, RUSBHOSTMSDEVICE_20, + ">>> RUsbHostMsDevice::DismountLun Drv=%d", aDriveNum); + RFs TheFs; + TInt r; + r = TheFs.Connect(); + if(r == KErrNone) + { + r = TheFs.DismountFileSystem(KFileSystem, aDriveNum); + if(r != KErrNone) + { + // dismount failed - attempt a forced dismount + TRequestStatus stat; + TheFs.NotifyDismount(aDriveNum, stat, EFsDismountForceDismount); + User::WaitForRequest(stat); + r = stat.Int(); + } + if(r == KErrNone) + { + r = TheFs.DismountProxyDrive(aDriveNum); + } + TheFs.Close(); + } + return r; + } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmslogicalunit.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmslogicalunit.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmslogicalunit.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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,19 +23,24 @@ #include "msgservice.h" #include "rusbhostmsdevice.h" #include "rusbhostmslogicalunit.h" -#include "debug.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "rusbhostmslogicalunitTraces.h" +#endif + TVersion RUsbHostMsLogicalUnit::Version() const - { - return(TVersion(KUsbHostMsSrvMajorVersionNumber, + { + return(TVersion(KUsbHostMsSrvMajorVersionNumber, KUsbHostMsSrvMinorVersionNumber, KUsbHostMsSrvBuildVersionNumber)); - } + } EXPORT_C RUsbHostMsLogicalUnit::RUsbHostMsLogicalUnit() - { - // Intentionally left blank - } + { + // Intentionally left blank + } /** Send a command to initialise the Mass Storage device. @@ -48,24 +53,25 @@ */ EXPORT_C TInt RUsbHostMsLogicalUnit::Initialise(const RMessage2& aMsg, TInt aDevHandleIndex, - TUint32 aLun) - { - __FNLOG("RUsbHostMsLogicalUnit::Initialise"); - TInt r = dev.Open(aMsg, aDevHandleIndex); - if (r != KErrNone) - { - __PRINT1(_L("Session handle can not be opened %d"),r); - return r; - } + TUint32 aLun) + { + TInt r = dev.Open(aMsg, aDevHandleIndex); + if (r != KErrNone) + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_11, + "Session handle can not be opened %d", r); + return r; + } - r = CreateSubSession(dev, EUsbHostMsRegisterLun, TIpcArgs(aLun)); - if (r != KErrNone) - { - __PRINT1(_L("SubSession creation failed %d"),r); - return r; - } - return r; - } + r = CreateSubSession(dev, EUsbHostMsRegisterLun, TIpcArgs(aLun)); + if (r != KErrNone) + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_12, + "SubSession creation failed %d", r); + return r; + } + return r; + } /** @@ -76,27 +82,27 @@ @param aTrg Buffer to copy data to @return TInt KErrNone, if the send operation is successful; - KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; - KErrNoMemory, if there is insufficient memory available. + KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; + KErrNoMemory, if there is insufficient memory available. */ EXPORT_C TInt RUsbHostMsLogicalUnit::Read(TInt64 aPos, TInt aLength, TDes8& aTrg) - { - __FNLOG("RUsbHostMsLogicalUnit::Read"); + { + TReadWrite data; + data.iPos = aPos; + data.iLen = aLength; - TReadWrite data; - data.iPos = aPos; - data.iLen = aLength; - - __PRINT2(_L("pos = 0x%lx, len = x%x"), data.iPos, data.iLen); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_21, + "pos = 0x%x %x, len = x%x", I64HIGH(data.iPos), I64LOW(data.iPos), data.iLen); - TPckg pckg(data); - /* We handle the message asynchronously in the thread modelled MSC */ - TRequestStatus status; - SendReceive(EUsbHostMsRead, TIpcArgs(&pckg, &aTrg), status); - User::WaitForRequest(status); - __PRINT2(_L("pos = 0x%lx, len = x%x"), data.iPos, data.iLen); - return status.Int(); - } + TPckg pckg(data); + /* We handle the message asynchronously in the thread modelled MSC */ + TRequestStatus status; + SendReceive(EUsbHostMsRead, TIpcArgs(&pckg, &aTrg), status); + User::WaitForRequest(status); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_22, + "pos = 0x%x %x, len = x%x", I64HIGH(data.iPos), I64LOW(data.iPos), data.iLen); + return status.Int(); + } /** @@ -107,27 +113,27 @@ @param aTrg Buffer to copy data from @return TInt KErrNone, if the send operation is successful; - KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; - KErrNoMemory, if there is insufficient memory available. + KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; + KErrNoMemory, if there is insufficient memory available. available. */ EXPORT_C TInt RUsbHostMsLogicalUnit::Write(TInt64 aPos, TInt aLength, const TDesC8& aTrg) - { - __FNLOG("RUsbHostMsLogicalUnit::Write"); + { + TReadWrite data; + data.iPos = aPos; + data.iLen = aLength; - TReadWrite data; - data.iPos = aPos; - data.iLen = aLength; + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_23, + "pos = 0x%x %x, len = x%x", I64HIGH(data.iPos), I64LOW(data.iPos), data.iLen); - __PRINT2(_L("pos = 0x%lx, len = x%x"), data.iPos, data.iLen); - TPckg pckg(data); - /* We handle the message asynchronously in the thread modelled MSC */ - TRequestStatus status; - SendReceive(EUsbHostMsWrite, TIpcArgs(&aTrg, &pckg), status); - User::WaitForRequest(status); - return status.Int(); - } + TPckg pckg(data); + /* We handle the message asynchronously in the thread modelled MSC */ + TRequestStatus status; + SendReceive(EUsbHostMsWrite, TIpcArgs(&aTrg, &pckg), status); + User::WaitForRequest(status); + return status.Int(); + } /** @@ -137,27 +143,26 @@ @param aLength Number of Bytes @return TInt KErrNone, if the send operation is successful; - KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; - KErrNoMemory, if there is insufficient memory available. + KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; + KErrNoMemory, if there is insufficient memory available. available. */ EXPORT_C TInt RUsbHostMsLogicalUnit::Erase(TInt64 aPos, TInt aLength) - { - __FNLOG("RUsbHostMsLogicalUnit::Erase"); + { + TReadWrite data; + data.iPos = aPos; + data.iLen = aLength; - TReadWrite data; - data.iPos = aPos; - data.iLen = aLength; + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_24, + "pos = 0x%x %x, len = x%x", I64HIGH(data.iPos), I64LOW(data.iPos), data.iLen); - __PRINT2(_L("pos = 0x%lx, len = x%x"), data.iPos, data.iLen); - - TPckg pckg(data); - /* We handle the message asynchronously in the thread modelled MSC */ - TRequestStatus status; - SendReceive(EUsbHostMsErase, TIpcArgs(&pckg), status); - User::WaitForRequest(status); - return status.Int(); - } + TPckg pckg(data); + /* We handle the message asynchronously in the thread modelled MSC */ + TRequestStatus status; + SendReceive(EUsbHostMsErase, TIpcArgs(&pckg), status); + User::WaitForRequest(status); + return status.Int(); + } /** @@ -171,17 +176,15 @@ available. */ EXPORT_C TInt RUsbHostMsLogicalUnit::Caps(TCapsInfo& aCapsInfo) - { - __FNLOG("RUsbHostMsLogicalUnit::Caps"); - + { TPckg data(aCapsInfo); - /* We handle the message asynchronously in the thread modelled MSC */ - TRequestStatus status; - SendReceive(EUsbHostMsCapacity, TIpcArgs(&data),status); - User::WaitForRequest(status); - return status.Int(); - } + /* We handle the message asynchronously in the thread modelled MSC */ + TRequestStatus status; + SendReceive(EUsbHostMsCapacity, TIpcArgs(&data),status); + User::WaitForRequest(status); + return status.Int(); + } /** Request notification of media change to the file server @@ -189,26 +192,22 @@ @param aChanged The descriptor pointing to iChanged flag in TDrive to be updated when error occurs during read or write. @param aStatus The request status This is set to KErrNone on completion, or KErrCancel when the logical unit is closed; - KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; - KErrNoMemory, if there is insufficient memory available. + KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available; + KErrNoMemory, if there is insufficient memory available. @return None */ EXPORT_C void RUsbHostMsLogicalUnit::NotifyChange(TDes8& aChanged, TRequestStatus &aStatus) - { - __FNLOG("RUsbHostMsLogicalUnit::NotifyChange"); - - SendReceive(EUsbHostMsNotifyChange, TIpcArgs(&aChanged), aStatus); - } + { + SendReceive(EUsbHostMsNotifyChange, TIpcArgs(&aChanged), aStatus); + } /** Request to suspend the logical unit associated with this drive */ EXPORT_C void RUsbHostMsLogicalUnit::SuspendLun() - { - __FNLOG("RUsbHostMsLogicalUnit::SuspendLun"); - - SendReceive(EUsbHostMsSuspendLun, TIpcArgs(NULL)); - } + { + SendReceive(EUsbHostMsSuspendLun, TIpcArgs(NULL)); + } /** Close the sub-session. @@ -216,13 +215,11 @@ @return TInt KErrNone */ EXPORT_C TInt RUsbHostMsLogicalUnit::UnInitialise() - { - __FNLOG("RUsbHostMsLogicalUnit::UnInitialise"); - - CloseSubSession(EUsbHostMsUnRegisterLun); - dev.Close(); - return KErrNone; - } + { + CloseSubSession(EUsbHostMsUnRegisterLun); + dev.Close(); + return KErrNone; + } /** @@ -236,19 +233,17 @@ available. */ EXPORT_C TInt RUsbHostMsLogicalUnit::ForceRemount(TUint aFlags) - { - __FNLOG("RUsbHostMsLogicalUnit::ForceRemount"); - - __PRINT1(_L("flags = %d"), aFlags); + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_25, + "flags = %d", aFlags); - TRequestStatus status; - SendReceive(EUsbHostMsForceRemount, TIpcArgs(aFlags), status); - User::WaitForRequest(status); - return status.Int(); - } + TRequestStatus status; + SendReceive(EUsbHostMsForceRemount, TIpcArgs(aFlags), status); + User::WaitForRequest(status); + return status.Int(); + } EXPORT_C void RUsbHostMsLogicalUnit::NotifyChangeCancel() - { - __FNLOG("RUsbHostMsLogicalUnit::NotifyChangeCancel"); - SendReceive(EUsbHostMsCancelChangeNotifier, TIpcArgs(NULL)); - } + { + SendReceive(EUsbHostMsCancelChangeNotifier, TIpcArgs(NULL)); + } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/client/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/client/traces/OstTraceDefinitions.h Tue Oct 26 12:49:20 2010 +0100 @@ -0,0 +1,21 @@ +// Copyright (c) 2009 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" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/msproxy/debug.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/debug.cpp Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -// Copyright (c) 2008-2009 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" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -/** - @file - @internalTechnology -*/ - -#include "debug.h" - -#ifdef FUNCTION_TRACE_ENABLED - -_LIT8(KFnMsgSIn, ">>\t%S\r\n"); -_LIT8(KFnMsgSOut,"<<\t%S\r\n"); -_LIT8(KFnMsgIn, ">>[0x%08x]\t%S\r\n"); -_LIT8(KFnMsgOut,"<<[0x%08x]\t%S\r\n"); - -TLogStaticFn::TLogStaticFn(const TDesC8& aFunctionName) - { - iFunctionName.Set(aFunctionName); - buf.AppendFormat(KFnMsgSIn, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TLogStaticFn::~TLogStaticFn() - { - buf.Zero(); - buf.AppendFormat(KFnMsgSOut, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TLogFn::TLogFn(const TDesC8& aFunctionName, void* aThisPointer) -: iThisPointer(aThisPointer) - { - iFunctionName.Set(aFunctionName); - buf.AppendFormat(KFnMsgIn, iThisPointer, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TLogFn::~TLogFn() - { - buf.Zero(); - buf.AppendFormat(KFnMsgOut, iThisPointer, &iFunctionName); - RDebug::RawPrint(buf); - }; - -#endif diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/msproxy/debug.h --- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/debug.h Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -// Copyright (c) 2008-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" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// -// - -/** - @file - @internalTechnology -*/ - -#ifndef PXY_DEBUG_H -#define PXY_DEBUG_H - -// #define _HOST_DEBUG_PRINT_ -// #define _PROXY_DEBUG_PRINT_ -// #define _PROXY_FN_TRACE_ - -#if defined(_PROXY_FN_TRACE_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#define FUNCTION_TRACE_ENABLED -#endif - -#if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#include -#endif - -#ifdef FUNCTION_TRACE_ENABLED -/** -Logging function to be used with static functions. Prints the function string on -function entry and exit. -*/ -class TLogStaticFn - { -public: - static const TInt KLogBufferSize = 0xFF; - - TLogStaticFn(const TDesC8& aFunctionName); - - ~TLogStaticFn(); - -protected: - TBuf8 buf; - TPtrC8 iFunctionName; - }; - - -/** -Logging function which prints the function string on function entry and exit. -*/ -class TLogFn - { -public: - static const TInt KLogBufferSize = 0xFF; - TLogFn(const TDesC8& aFunctionName, void* aThisPointer); - - ~TLogFn(); - -private: - TBuf8 buf; - TPtrC8 iFunctionName; - void* iThisPointer; - }; - -#define __MSFNLOG TLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this); -#define __MSFNSLOG TLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); -#else // FUNCTION_TRACE_ENABLED -#define __MSFNSLOG -#define __MSFNLOG -#endif // FUNCTION_TRACE_ENABLED - - -#if defined (_PROXY_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#define __PXYPRINT(t) {RDebug::Print(t);} -#define __PXYPRINT1(t,a) {RDebug::Print(t,a);} -#define __PXYPRINT2(t,a,b) {RDebug::Print(t,a,b);} -#define __PXYPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} -#define __PXYPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} -#define __PXYPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} -#define __PXYPRINT8BIT1(t,a) {TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);} -#define __PXYPRINT1TEMP(t,a) {TBuftemp(a);RDebug::Print(t,&temp);} -#else -#define __PXYPRINT(t) -#define __PXYPRINT1(t,a) -#define __PXYPRINT2(t,a,b) -#define __PXYPRINT3(t,a,b,c) -#define __PXYPRINT4(t,a,b,c,d) -#define __PXYPRINT5(t,a,b,c,d,e) -#define __PXYPRINT8BIT1(t,a) -#define __PXYPRINT1TEMP(t,a) -#endif // _PROXY_DEBUG_PRINT_ - -#if defined(_HOST_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#define __HOSTPRINT(t) {RDebug::Print(t);} -#define __HOSTPRINT1(t,a) {RDebug::Print(t,a);} -#define __HOSTPRINT2(t,a,b) {RDebug::Print(t,a,b);} -#define __HOSTPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} -#define __HOSTPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} -#define __HOSTPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} -#define __HOSTPRINT8BIT1(t,a) {TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);} -#define __HOSTPRINT1TEMP(t,a) {TBuftemp(a);RDebug::Print(t,&temp);} -static const TUint KBlockSize = 0x200; -#else -#define __HOSTPRINT(t) -#define __HOSTPRINT1(t,a) -#define __HOSTPRINT2(t,a,b) -#define __HOSTPRINT3(t,a,b,c) -#define __HOSTPRINT4(t,a,b,c,d) -#define __HOSTPRINT5(t,a,b,c,d,e) -#define __HOSTPRINT8BIT1(t,a) -#define __HOSTPRINT1TEMP(t,a) -#endif // _HOST_DEBUG_PRINT_ - -#endif // PXY_DEBUG_H - - diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsfactory.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsfactory.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsfactory.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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,44 +23,45 @@ #include "hostusbmsproxy.h" #include "hostusbmsfactory.h" -#include "debug.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "hostusbmsfactoryTraces.h" +#endif + + CUsbHostMsProxyDriveFactory::CUsbHostMsProxyDriveFactory() - { - __MSFNSLOG - } + { + } CUsbHostMsProxyDriveFactory::~CUsbHostMsProxyDriveFactory() - { - __MSFNSLOG - } + { + } TInt CUsbHostMsProxyDriveFactory::Install() - { - __MSFNSLOG - _LIT(KLoggerName,"usbhostms"); - return SetName(&KLoggerName); - } + { + _LIT(KLoggerName,"usbhostms"); + return SetName(&KLoggerName); + } TInt CUsbHostMsProxyDriveFactory::CreateProxyDrive(CProxyDrive*& aMountProxyDrive,CMountCB* aMount) - { - __MSFNSLOG + { aMountProxyDrive = new CUsbHostMsProxyDrive(aMount,this); return (aMountProxyDrive==NULL) ? KErrNoMemory : KErrNone; - } + } extern "C" { -/* +/* Create the proxy drive factory object for the usbhost mass storage proxy */ EXPORT_C CExtProxyDriveFactory* CreateFileSystem() - { - __MSFNSLOG - return new CUsbHostMsProxyDriveFactory(); - } + { + return new CUsbHostMsProxyDriveFactory(); + } } /* @@ -68,39 +69,39 @@ This function issues an application session request (through publish and subscribe) to the USB manager. Upon USB Manager receiving this application session request in consent with the USB watcher application, the Bus request is passed to the OTG component to bringup the VBus, thus enumerating the mass storage -devices Upon enumerating the FDF will communicate with the Mount Manager which will allocate mass storage +devices Upon enumerating the FDF will communicate with the Mount Manager which will allocate mass storage drives for the logical units and continues drive access through the Usb host mass storage proxy drive. Ps: Note that the this request cant be handled by the MSC since, in the scenario where MSC is not running initially, the request will try to create the process. Creation of process will involve the file server inturn to load the MSC binary (.exe) to run. Since the RMessages are handled sequentially, the file server would not -be able to service the request until the AsyncEnuerate is completed. Where, the process creation will wait +be able to service the request until the AsyncEnuerate is completed. Where, the process creation will wait for the rendezvous to complete creating the deadlock situation. Hence the application session request is handled in the factory object itself! */ void CUsbHostMsProxyDriveFactory::AsyncEnumerate() { - __MSFNSLOG - - RProperty prop; - TInt ret; + RProperty prop; + TInt ret; - /* The property category is the USB manager */ - const TUid KUidUsbManCategory={0x101fe1db}; - /* The Key used is #6 for the Usb request session */ - const TInt KUsbRequestSessionProperty = 6; + /* The property category is the USB manager */ + const TUid KUidUsbManCategory={0x101fe1db}; + /* The Key used is #6 for the Usb request session */ + const TInt KUsbRequestSessionProperty = 6; - /* By this time the property should be available and allow us to get the handle. - If the property is not created (for some reason), we do not have anything to do */ - ret = prop.Attach(KUidUsbManCategory, KUsbRequestSessionProperty); - __PXYPRINT1(_L("Property attach returned %d"),ret); - if(ret == KErrNone) + /* By this time the property should be available and allow us to get the handle. + If the property is not created (for some reason), we do not have anything to do */ + ret = prop.Attach(KUidUsbManCategory, KUsbRequestSessionProperty); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSFACTORY_11, + "Property attach returned %d", ret); + if(ret == KErrNone) { - /* The Usb Manager does not evaluate the value passed through this property. - We pass 1 (an arbitary value) for completion */ - ret = prop.Set(KUidUsbManCategory, KUsbRequestSessionProperty, 1); - __PXYPRINT1(_L("Property set returned %d"),ret); - prop.Close(); - } + /* The Usb Manager does not evaluate the value passed through this property. + We pass 1 (an arbitary value) for completion */ + ret = prop.Set(KUidUsbManCategory, KUsbRequestSessionProperty, 1); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSFACTORY_12, + "Property set returned %d", ret); + prop.Close(); + } } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -21,25 +21,30 @@ #include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +static const TUint KBlockSize = 0x200; +#include "hostusbmsproxyTraces.h" +#endif + #include "hostusbmsproxy.h" -#include "debug.h" + + + CUsbHostMsProxyDrive::CUsbHostMsProxyDrive(CMountCB* aMount, CExtProxyDriveFactory* aDevice) : CExtProxyDrive(aMount,aDevice) - { - __MSFNSLOG - } + { + } CUsbHostMsProxyDrive::~CUsbHostMsProxyDrive() - { - __MSFNSLOG - iUsbHostMsLun.UnInitialise(); - } + { + iUsbHostMsLun.UnInitialise(); + } TInt CUsbHostMsProxyDrive::InitialiseOffset(TCapsInfo& aCapsInfo) - { - __MSFNSLOG + { RBuf8 partitionInfo; TInt r; TRAP(r, partitionInfo.CreateL(aCapsInfo.iBlockLength)); @@ -48,58 +53,63 @@ return r; } - r = iUsbHostMsLun.Read(0, aCapsInfo.iBlockLength, partitionInfo); - if (r != KErrNone) + r = iUsbHostMsLun.Read(0, aCapsInfo.iBlockLength, partitionInfo); + if (r != KErrNone) { - __PXYPRINT1(_L("!! Reading medium failed with %d !!"), r); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_10, + "!! Reading medium failed with %d !!", r); partitionInfo.Close(); - return r; + return r; } - TUint8* buffer = const_cast(partitionInfo.Ptr()); + TUint8* buffer = const_cast(partitionInfo.Ptr()); - // Read of the first sector successful so check for a Master Boot Record - if (*(reinterpret_cast(&buffer[KMBRSignatureOffset]))!= KMBRSignature) - { - __PXYPRINT(_L("MBR not present")); + // Read of the first sector successful so check for a Master Boot Record + if (*(reinterpret_cast(&buffer[KMBRSignatureOffset]))!= KMBRSignature) + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_11, + "MBR not present"); iMsDataMemMap.Reset(); } - else - { - // Move the partition entries to a 4 byte boundary - memcpy(&buffer[0],&buffer[KMBRFirstPartitionOffset],(sizeof(TMBRPartitionEntry)<<2)); - // Search for a x86 default boot partition - let this be the first - TMBRPartitionEntry* pe = reinterpret_cast(&buffer[0]); + else + { + // Move the partition entries to a 4 byte boundary + memcpy(&buffer[0],&buffer[KMBRFirstPartitionOffset],(sizeof(TMBRPartitionEntry)<<2)); + // Search for a x86 default boot partition - let this be the first + TMBRPartitionEntry* pe = reinterpret_cast(&buffer[0]); - TInt firstValidPartitionCount = -1; - TInt defaultPartitionNumber = -1; - TInt partitionCount = 0; - for (TInt i = 0; i < KMBRMaxPrimaryPartitions; i++, pe++) - { - if (pe->IsValidDosPartition() || pe->IsValidFAT32Partition() || pe->IsValidExFATPartition()) - { - __PXYPRINT(_L("Found a Valid Partition")); - partitionCount++; + TInt firstValidPartitionCount = -1; + TInt defaultPartitionNumber = -1; + TInt partitionCount = 0; + for (TInt i = 0; i < KMBRMaxPrimaryPartitions; i++, pe++) + { + if (pe->IsValidDosPartition() || pe->IsValidFAT32Partition() || pe->IsValidExFATPartition()) + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_12, + "Found a Valid Partition"); + partitionCount++; - if (firstValidPartitionCount < 0) - firstValidPartitionCount = i; + if (firstValidPartitionCount < 0) + firstValidPartitionCount = i; - if (pe->iX86BootIndicator == KBootIndicatorBootable) + if (pe->iX86BootIndicator == KBootIndicatorBootable) { - defaultPartitionNumber = i; - break; + defaultPartitionNumber = i; + break; } - } - else - { - __PXYPRINT(_L("!! Invalid Partition !!")); - } - } + } + else + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_13, + "!! Invalid Partition !!"); + } + } - // Check the validity of the partition address boundaries - if (partitionCount > 0) - { - __PXYPRINT1(_L("Using Partition %d"), partitionCount); - pe = reinterpret_cast(&buffer[0]); + // Check the validity of the partition address boundaries + if (partitionCount > 0) + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_14, + "Using Partition %d", partitionCount); + pe = reinterpret_cast(&buffer[0]); TInt partitionIndex = firstValidPartitionCount; if (defaultPartitionNumber > 0) { @@ -108,112 +118,119 @@ TMBRPartitionEntry& partitionEntry = pe[partitionIndex]; - iMsDataMemMap.InitDataArea(partitionEntry.iFirstSector, + iMsDataMemMap.InitDataArea(partitionEntry.iFirstSector, partitionEntry.iNumSectors, aCapsInfo.iBlockLength); - __PXYPRINT2(_L("paritioncount = %d defaultpartition = %d"), - partitionCount, partitionIndex); - __PXYPRINT3(_L("iFirstSector = x%x iNumSectors = x%x iSectorSize = x%x"), - partitionEntry.iFirstSector, - partitionEntry.iNumSectors, - aCapsInfo.iBlockLength); - } - else - { - __PXYPRINT(_L("No partition found")); - iMsDataMemMap.InitDataArea(0, aCapsInfo.iNumberOfBlocks, aCapsInfo.iBlockLength); - __PXYPRINT3(_L("iFirstSector = x%x iNumSectors = x%x iSectorSize = x%x"), - 0, - aCapsInfo.iNumberOfBlocks, - aCapsInfo.iBlockLength); - } - } + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_15, + "paritioncount = %d defaultpartition = %d", + partitionCount, partitionIndex); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_16, + "iFirstSector = x%x iNumSectors = x%x iSectorSize = x%x", + partitionEntry.iFirstSector, + partitionEntry.iNumSectors, + aCapsInfo.iBlockLength); + } + else + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_17, + "No partition found"); + iMsDataMemMap.InitDataArea(0, aCapsInfo.iNumberOfBlocks, aCapsInfo.iBlockLength); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_18, + "iFirstSector = x%x iNumSectors = x%x iSectorSize = x%x", + 0, + aCapsInfo.iNumberOfBlocks, + aCapsInfo.iBlockLength); + } + } partitionInfo.Close(); - return KErrNone; - } + return KErrNone; + } /** Initialise the proxy drive. @return system wide error code. */ TInt CUsbHostMsProxyDrive::Initialise() - { - __MSFNSLOG - __HOSTPRINT(_L(">>> CUsbHostMsProxyDrive::Initialise()")); + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_20, + ">>> CUsbHostMsProxyDrive::Initialise()"); - if(Mount()) - { - // as we can't currently handle remounting devices that have - // been removed by unplugging the USB cable, disable critical notifiers - // as there's no point in asking the user to re-insert the disk. - Mount()->SetNotifyOff(); - } + if(Mount()) + { + // as we can't currently handle remounting devices that have + // been removed by unplugging the USB cable, disable critical notifiers + // as there's no point in asking the user to re-insert the disk. + Mount()->SetNotifyOff(); + } // Check for media presence - TCapsInfo capsInfo; - TInt err = iUsbHostMsLun.Caps(capsInfo); + TCapsInfo capsInfo; + TInt err = iUsbHostMsLun.Caps(capsInfo); if (err == KErrNone && capsInfo.iMediaType == EMediaHardDisk) { err = InitialiseOffset(capsInfo); } - __HOSTPRINT1(_L("<<< CUsbHostMsProxyDrive::Initialise() err = %d"), err); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_21, + "<<< CUsbHostMsProxyDrive::Initialise() err = %d", err); return err; - } + } TInt CUsbHostMsProxyDrive::SetInfo(const RMessage2 &msg, TAny* aMessageParam2, TAny* aMessageParam3) { - __MSFNSLOG - __HOSTPRINT(_L(">>> CUsbHostMsProxyDrive::SetInfo()")); - TMassStorageUnitInfo iUnitInfo; + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_22, + ">>> CUsbHostMsProxyDrive::SetInfo()"); + TMassStorageUnitInfo iUnitInfo; TPckg infoPckg(iUnitInfo); - TRAPD(err, msg.ReadL(2, infoPckg)); + TRAPD(err, msg.ReadL(2, infoPckg)); - if(err != KErrNone) - { - __PXYPRINT1(_L("Cant read from the RMessage %d"), err); - __HOSTPRINT1(_L("<<< CUsbHostMsProxyDrive::SetInfo() err = %d"), err); - return err; - } + if(err != KErrNone) + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_23, + "Cant read from the RMessage %d", err); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_24, + "<<< CUsbHostMsProxyDrive::SetInfo() err = %d", err); + return err; + } - err = iUsbHostMsLun.Initialise(msg, 3, iUnitInfo.iLunID); - if(err != KErrNone) - { - __PXYPRINT1(_L("Initialising logical unit failed %d"), err); - __HOSTPRINT1(_L("<<< CUsbHostMsProxyDrive::SetInfo() err = %d"), err); - return err; - } + err = iUsbHostMsLun.Initialise(msg, 3, iUnitInfo.iLunID); + if(err != KErrNone) + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_25, + "Initialising logical unit failed %d", err); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_26, + "<<< CUsbHostMsProxyDrive::SetInfo() err = %d", err); + return err; + } - __HOSTPRINT1(_L("<<< CUsbHostMsProxyDrive::SetInfo() err = %d"), err); - return err; + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_27, + "<<< CUsbHostMsProxyDrive::SetInfo() err = %d", err); + return err; } TInt CUsbHostMsProxyDrive::Dismounted() - { - __MSFNSLOG - return KErrNone; - } + { + return KErrNone; + } TInt CUsbHostMsProxyDrive::Enlarge(TInt /*aLength*/) - { - __MSFNSLOG - return KErrNotSupported; - } + { + return KErrNotSupported; + } TInt CUsbHostMsProxyDrive::ReduceSize(TInt /*aPos*/, TInt /*aLength*/) - { - __MSFNSLOG - return KErrNotSupported; - } + { + return KErrNotSupported; + } -#define GetIndex(msg, aAddress, aIndex) \ - aIndex = msg.Ptr0() == aAddress ? 0 : \ - msg.Ptr1() == aAddress ? 1 : \ - msg.Ptr1() == aAddress ? 2 : \ - msg.Ptr1() == aAddress ? 3 : -1; +#define GetIndex(msg, aAddress, aIndex) \ + aIndex = msg.Ptr0() == aAddress ? 0 : \ + msg.Ptr1() == aAddress ? 1 : \ + msg.Ptr1() == aAddress ? 2 : \ + msg.Ptr1() == aAddress ? 3 : -1; /** Read from the proxy drive. @@ -228,113 +245,125 @@ */ TInt CUsbHostMsProxyDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt aOffset) - { - __MSFNSLOG - __HOSTPRINT4(_L("\n>>> HOST Read Pos=0x%lx LBA=0x%lx 0x%x 0x%x"), - aPos, aPos/KBlockSize, aLength, aOffset); + { + OstTraceExt4(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_300, + ">>> HOST Read Pos=0x%x %x LBA=0x%x %x", + I64HIGH(aPos), I64LOW(aPos), I64HIGH(aPos/KBlockSize), I64LOW(aPos/KBlockSize)); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_301, + ">>> Len 0x%x Offset 0x%x", + aLength, aOffset); - TBool localMessage = (aThreadHandle == KLocalMessageHandle); + TBool localMessage = (aThreadHandle == KLocalMessageHandle); - // - // Set file position to where we want to read... - // - if(!localMessage) - { - RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); - localMessage = (msg.Handle() == KLocalMessageHandle); - } + // + // Set file position to where we want to read... + // + if(!localMessage) + { + RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); + localMessage = (msg.Handle() == KLocalMessageHandle); + } - TInt index = 0; - if (!localMessage) - { - RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); - GetIndex(msg, aTrg, index); + TInt index = 0; + if (!localMessage) + { + RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); + GetIndex(msg, aTrg, index); - if (index < 0) + if (index < 0) { - __HOSTPRINT1(_L("<<< HOST Read ret=%d"), KErrArgument); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_302, + "<<< HOST Read ret=%d", KErrArgument); return KErrArgument; } - } + } - /* Calculate the end position */ - TInt64 end = aPos + static_cast(aLength); + /* Calculate the end position */ + TInt64 end = aPos + static_cast(aLength); - /* check whether there is enough source data to write to the destination descriptor */ - TInt64 truncate; - if(localMessage) - { - truncate = aLength - (((TPtr8* )aTrg)->MaxLength() - aOffset); - __PXYPRINT1(_L("Descriptor length: %08x"), ((TPtr8* )aTrg)->MaxLength()); - } - else - { - RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); - truncate = aLength - (msg.GetDesMaxLength(index) - aOffset); - __PXYPRINT1(_L("Descriptor length: %08x"), msg.GetDesMaxLength(index)); - } + /* check whether there is enough source data to write to the destination descriptor */ + TInt64 truncate; + if(localMessage) + { + truncate = aLength - (((TPtr8* )aTrg)->MaxLength() - aOffset); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_303, + "Descriptor length: %08x", ((TPtr8* )aTrg)->MaxLength()); + } + else + { + RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); + truncate = aLength - (msg.GetDesMaxLength(index) - aOffset); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_304, + "Descriptor length: %08x", msg.GetDesMaxLength(index)); + } - __PXYPRINT1(_L("Offset: %08x"), aOffset); - __PXYPRINT1(_L("Truncate: 0x%lx"), truncate); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_305, + "Offset: %08x", aOffset); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_306, + "Truncate: 0x%lx", truncate); - if (truncate > 0) - { - end -= truncate; - } + if (truncate > 0) + { + end -= truncate; + } - iBuf.SetMax(); + iBuf.SetMax(); TInt r; TInt64 mediaPos; - while (aPos < end) + while (aPos < end) { - TInt len = end - aPos; + TInt len = end - aPos; mediaPos = aPos; r = iMsDataMemMap.CheckBlockInRange(mediaPos, len); if (r != KErrNone) { - __HOSTPRINT1(_L("<<< HOST Read ret=%d"), r); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_307, + "<<< HOST Read ret=%d", r); return r; } - if (localMessage) - { - TPtr8* pTrgPtr = (TPtr8*)aTrg; - TPtr8 trgDes((TUint8*)(pTrgPtr->MidTPtr(aOffset).Ptr()), pTrgPtr->MaxLength() - aOffset); - r = iUsbHostMsLun.Read(mediaPos, len, trgDes); - if (r != KErrNone) - return r; - pTrgPtr->SetLength(aOffset + trgDes.Length()); - } - else - { - if (len > iBuf.MaxLength()) - len = iBuf.MaxLength(); + if (localMessage) + { + TPtr8* pTrgPtr = (TPtr8*)aTrg; + TPtr8 trgDes((TUint8*)(pTrgPtr->MidTPtr(aOffset).Ptr()), pTrgPtr->MaxLength() - aOffset); + r = iUsbHostMsLun.Read(mediaPos, len, trgDes); + if (r != KErrNone) + return r; + pTrgPtr->SetLength(aOffset + trgDes.Length()); + } + else + { + if (len > iBuf.MaxLength()) + len = iBuf.MaxLength(); r = iUsbHostMsLun.Read(mediaPos, len, iBuf); - if (r != KErrNone) + if (r != KErrNone) { - __HOSTPRINT1(_L("<<< HOST Read ret=%d"), r); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_308, + "<<< HOST Read ret=%d", r); return r; } - iBuf.SetLength(len); + iBuf.SetLength(len); - RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); - r = msg.Write(index, iBuf, aOffset); - if (r != KErrNone) + RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); + r = msg.Write(index, iBuf, aOffset); + if (r != KErrNone) { - __HOSTPRINT1(_L("<<< HOST Read ret=%d"), r); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_309, + "<<< HOST Read ret=%d", r); return r; } - } + } aPos += len; aOffset += len; } - __HOSTPRINT1(_L("<<< HOST Read ret=%d"), KErrNone); - return KErrNone; - } + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_310, + "<<< HOST Read ret=%d", KErrNone); + return KErrNone; + } /** @@ -351,10 +380,9 @@ */ TInt CUsbHostMsProxyDrive::Read(TInt64 aPos, TInt aLength, const TAny* aTrg, TInt aThreadHandle, TInt aOffset, TInt /* aFlags */) - { - __MSFNSLOG - return Read(aPos, aLength, aTrg, aThreadHandle, aOffset); - } + { + return Read(aPos, aLength, aTrg, aThreadHandle, aOffset); + } /** Read from the proxy drive. @@ -366,12 +394,12 @@ @return system wide error code. */ TInt CUsbHostMsProxyDrive::Read(TInt64 aPos, TInt aLength, TDes8& aTrg) - { - __MSFNSLOG - __HOSTPRINT3(_L("\n>>> HOST Read Pos=0x%lx LBA=0x%lx 0x%x"), - aPos, aPos/KBlockSize, aLength); - return iUsbHostMsLun.Read(iMsDataMemMap.GetDataPos(aPos), aLength, aTrg); - } + { + OstTraceExt5(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_40, + ">>> HOST Read Pos=0x%x %x LBA=0x%x %x 0x%x", + I64HIGH(aPos), I64LOW(aPos), I64HIGH(aPos/KBlockSize), I64LOW(aPos/KBlockSize), aLength); + return iUsbHostMsLun.Read(iMsDataMemMap.GetDataPos(aPos), aLength, aTrg); + } /** Write to the proxy drive. @@ -386,110 +414,121 @@ */ TInt CUsbHostMsProxyDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aThreadHandle, TInt aOffset) - { - // - // Set file position to where we want to write... - // - __MSFNSLOG - __HOSTPRINT4(_L("\n>>> HOST Write Pos=0x%lx LBA=0%lx 0x%x 0x%x"), - aPos, aPos/KBlockSize, aLength, aOffset); + { + // + // Set file position to where we want to write... + // + OstTraceExt4(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_50, + ">>> HOST Write Pos=0x%x %x LBA=0%x %x", + I64HIGH(aPos), I64LOW(aPos), I64HIGH(aPos/KBlockSize), I64LOW(aPos/KBlockSize)); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_501, + "Len=0x%x Offset=0x%x", aLength, aOffset); - TBool localMessage = (aThreadHandle == KLocalMessageHandle); + TBool localMessage = (aThreadHandle == KLocalMessageHandle); - if(!localMessage) - { - RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); - localMessage = (msg.Handle() == KLocalMessageHandle); - } + if(!localMessage) + { + RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); + localMessage = (msg.Handle() == KLocalMessageHandle); + } - TInt index = 0; - if(!localMessage) - { - RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); - GetIndex(msg, aSrc, index); + TInt index = 0; + if(!localMessage) + { + RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); + GetIndex(msg, aSrc, index); - if (index < 0) - return KErrArgument; - } + if (index < 0) + return KErrArgument; + } - /* Calculate the end position */ - TInt64 end = aPos + static_cast(aLength); - /* check whether there is enough source data to read */ - TInt64 truncate; - if (localMessage) - { - truncate = aLength - (((TPtr8* )aSrc)->Length() - aOffset); - __PXYPRINT1(_L("Descriptor length: %08x"), ((TPtr8* )aSrc)->Length()); - } - else - { - RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); - truncate = aLength - (msg.GetDesLength(index) - aOffset); - __PXYPRINT1(_L("Descriptor length: %08x"), msg.GetDesLength(index)); - } + /* Calculate the end position */ + TInt64 end = aPos + static_cast(aLength); + /* check whether there is enough source data to read */ + TInt64 truncate; + if (localMessage) + { + truncate = aLength - (((TPtr8* )aSrc)->Length() - aOffset); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_51, + "Descriptor length: %08x", ((TPtr8* )aSrc)->Length()); + } + else + { + RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); + truncate = aLength - (msg.GetDesLength(index) - aOffset); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_52, + "Descriptor length: %08x", msg.GetDesLength(index)); + } - __PXYPRINT1(_L("Offset: %08x"), aOffset); - __PXYPRINT1(_L("Truncate: 0x%lx"), truncate); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_53, + "Offset: %08x", aOffset); + OstTrace1(TRACE_SHOSTMASSSTORAGE_PROXY, HOSTUSBMSPROXY_54, + "Truncate: 0x%lx", truncate); - /* if truncate is > 0 we are short of source data as claimed by the aLength. Hence adjust the 'end' */ - if (truncate > 0) - { - end -= truncate; - } + /* if truncate is > 0 we are short of source data as claimed by the aLength. Hence adjust the 'end' */ + if (truncate > 0) + { + end -= truncate; + } - iBuf.SetMax(); + iBuf.SetMax(); TInt r; TInt64 mediaPos; - while (aPos < end) + while (aPos < end) { - TInt len = end - aPos; + TInt len = end - aPos; mediaPos = aPos; r = iMsDataMemMap.CheckBlockInRange(mediaPos, len); if (r != KErrNone) { - __HOSTPRINT1(_L("<<< HOST Write ret=%d"), r); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_55, + "<<< HOST Write ret=%d", r); return r; } - if (localMessage) - { - r = iUsbHostMsLun.Write(mediaPos, len, ((TPtr8*)aSrc)->MidTPtr(aOffset)); + if (localMessage) + { + r = iUsbHostMsLun.Write(mediaPos, len, ((TPtr8*)aSrc)->MidTPtr(aOffset)); - if (r != KErrNone) + if (r != KErrNone) { - __HOSTPRINT1(_L("<<< HOST Write ret=%d"), r); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_56, + "<<< HOST Write ret=%d", r); return r; } - } - else - { - if (len > iBuf.Length()) - len = iBuf.Length(); + } + else + { + if (len > iBuf.Length()) + len = iBuf.Length(); - RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); - r = msg.Read(index, iBuf, aOffset); - if (r != KErrNone) + RMessage2 msg(*(RMessagePtr2 *) &aThreadHandle); + r = msg.Read(index, iBuf, aOffset); + if (r != KErrNone) { - __HOSTPRINT1(_L("<<< HOST Write ret=%d"), r); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_57, + "<<< HOST Write ret=%d", r); return r; } - r = iUsbHostMsLun.Write(mediaPos, len, iBuf); - if (r != KErrNone) + r = iUsbHostMsLun.Write(mediaPos, len, iBuf); + if (r != KErrNone) { - __HOSTPRINT1(_L("<<< HOST Write ret=%d"), r); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_58, + "<<< HOST Write ret=%d", r); return r; } - } + } aPos += len; aOffset += len; } - __HOSTPRINT1(_L("<<< HOST Write ret=%d"), KErrNone); - return KErrNone; - } + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_59, + "<<< HOST Write ret=%d", KErrNone); + return KErrNone; + } /** @@ -506,10 +545,9 @@ */ TInt CUsbHostMsProxyDrive::Write(TInt64 aPos, TInt aLength, const TAny* aSrc, TInt aThreadHandle, TInt aOffset, TInt /* aFlags */) - { - __MSFNSLOG - return Write(aPos, aLength, aSrc, aThreadHandle, aOffset); - } + { + return Write(aPos, aLength, aSrc, aThreadHandle, aOffset); + } /** Write to the proxy drive. @@ -520,12 +558,12 @@ @return system wide error code. */ TInt CUsbHostMsProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc) - { - __MSFNSLOG - __HOSTPRINT3(_L("\n>>> HOST Write Pos=0x%lx LBA=0x%lx 0x%x"), - aPos, aPos/KBlockSize, aSrc.Length()); - return iUsbHostMsLun.Write(iMsDataMemMap.GetDataPos(aPos), aSrc.Length(), aSrc); - } + { + OstTraceExt5(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_60, + ">>> HOST Write Pos=0x%x %x LBA=0x%x %x Len=0x%x", + I64HIGH(aPos), I64LOW(aPos), I64HIGH(aPos/KBlockSize), I64LOW(aPos/KBlockSize), aSrc.Length()); + return iUsbHostMsLun.Write(iMsDataMemMap.GetDataPos(aPos), aSrc.Length(), aSrc); + } /** @@ -536,87 +574,95 @@ @return system wide error code */ TInt CUsbHostMsProxyDrive::Caps(TDes8& anInfo) - { - __MSFNSLOG - __HOSTPRINT(_L(">>> HOST Caps")); - TLocalDriveCapsV6Buf caps; + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_70, + ">>> HOST Caps"); + TLocalDriveCapsV6Buf caps; caps.FillZ(); TLocalDriveCapsV6& c = caps(); c.iConnectionBusType = EConnectionBusUsb; - c.iDriveAtt = KDriveAttLocal | KDriveAttRemovable | KDriveAttExternal; - c.iMediaAtt = KMediaAttFormattable; - c.iFileSystemId = KDriveFileSysFAT; + c.iDriveAtt = KDriveAttLocal | KDriveAttRemovable | KDriveAttExternal; + c.iMediaAtt = KMediaAttFormattable; + c.iFileSystemId = KDriveFileSysFAT; - TCapsInfo capsInfo; - TInt r = iUsbHostMsLun.Caps(capsInfo); + TCapsInfo capsInfo; + TInt r = iUsbHostMsLun.Caps(capsInfo); - if (KErrNone == r) - { + if (KErrNone == r) + { c.iType = capsInfo.iMediaType; if (capsInfo.iMediaType == EMediaHardDisk) { c.iBlockSize = capsInfo.iBlockLength; TUint64 size = iMsDataMemMap.DataSize(); - + if (size == 0) { // No valid partitions so specify the size of the disk size = static_cast(capsInfo.iNumberOfBlocks) * capsInfo.iBlockLength; } c.iSize = size; - + c.iEraseBlockSize = 0; - + if (capsInfo.iWriteProtect) { c.iMediaAtt |= KMediaAttWriteProtected; } - + static const TInt K512ByteSectorSize = 0x200; // 512 if(K512ByteSectorSize != capsInfo.iBlockLength) { // not formattable if sector size is not 512 c.iMediaAtt &= ~KMediaAttFormattable; } - __HOSTPRINT4(_L("<<< HOST Caps Block[num=0x%x size=0x%x] Media[size=0x%lx WP=0x%x]"), - capsInfo.iNumberOfBlocks, capsInfo.iBlockLength, - caps().iSize, caps().iMediaAtt); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_710, + "<<< HOST Caps Block[num=0x%x size=0x%x]", + capsInfo.iNumberOfBlocks, capsInfo.iBlockLength); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_711, + "Media size=0x%x %x", I64HIGH(caps().iSize), I64LOW(caps().iSize)); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_712, + "WP=0x%x", caps().iMediaAtt); } else if (capsInfo.iMediaType == EMediaCdRom) { // not formattable c.iMediaAtt &= ~KMediaAttFormattable; - __HOSTPRINT(_L(">>> HOST Caps MediaType = EMediaCdRom")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_72, + ">>> HOST Caps MediaType = EMediaCdRom"); } else { // do nothing } - } - else if (KErrNotReady == r) + } + else if (KErrNotReady == r) { - __HOSTPRINT(_L("<<< HOST Caps Media Not Present")); - c.iType = EMediaNotPresent; - r = KErrNone; + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_73, + "<<< HOST Caps Media Not Present"); + c.iType = EMediaNotPresent; + r = KErrNone; } - else if (KErrGeneral == r) + else if (KErrGeneral == r) { - __HOSTPRINT(_L("<<< HOST Caps Unable to communicate with media")); - c.iType = EMediaUnknown; + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_74, + "<<< HOST Caps Unable to communicate with media"); + c.iType = EMediaUnknown; } else { - __HOSTPRINT(_L("<<< HOST Caps Unknown Error")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_75, + "<<< HOST Caps Unknown Error"); c.iType = EMediaUnknown; - r = KErrUnknown; + r = KErrUnknown; } - anInfo = caps.Left(Min(caps.Length(),anInfo.MaxLength())); - return r; - } + anInfo = caps.Left(Min(caps.Length(),anInfo.MaxLength())); + return r; + } /** @@ -630,10 +676,10 @@ @return system wide error code. */ TInt CUsbHostMsProxyDrive::Erase(TInt64 aPos, TInt& aLength) - { - __MSFNSLOG - __HOSTPRINT3(_L("\n HOST Erase Pos=0x%lx LBA=0x%lx 0x%x"), - aPos, aPos/KBlockSize, aLength); + { + OstTraceExt5(TRACE_SHOSTMASSSTORAGE_HOST, HOSTUSBMSPROXY_80, + "HOST Erase Pos=0x%x %x LBA=0x%x %x 0x%x", + I64HIGH(aPos), I64LOW(aPos), I64HIGH(aPos/KBlockSize), I64LOW(aPos/KBlockSize), aLength); TInt err = iMsDataMemMap.TranslateDataPos(aPos, aLength); if (err) @@ -641,7 +687,7 @@ err = iUsbHostMsLun.Erase(aPos, aLength); return err; - } + } /** @@ -653,10 +699,9 @@ @return system wide error code. */ TInt CUsbHostMsProxyDrive::Format(TInt64 aPos, TInt aLength) - { - __MSFNSLOG + { return Erase(aPos, aLength); - } + } /** @@ -667,9 +712,7 @@ @return system wide error code. */ TInt CUsbHostMsProxyDrive::Format(TFormatInfo& aInfo) - { - __MSFNSLOG - + { const TInt KDefaultMaxBytesPerFormat = 0x100 * iMsDataMemMap.BlockLength(); // 128K if (aInfo.i512ByteSectorsFormatted < 0) @@ -681,10 +724,10 @@ aInfo.i512ByteSectorsFormatted = 0; aInfo.iMaxBytesPerFormat = KDefaultMaxBytesPerFormat; - TLocalDriveCapsV6Buf caps; - TInt r = Caps(caps); - if (r != KErrNone) - return r; + TLocalDriveCapsV6Buf caps; + TInt r = Caps(caps); + if (r != KErrNone) + return r; iMsDataMemMap.InitDataArea(caps().iSize); } @@ -705,75 +748,67 @@ TInt CUsbHostMsProxyDrive::NotifyChange(TDes8 &aChanged,TRequestStatus* aStatus) - { - __MSFNSLOG - iUsbHostMsLun.NotifyChange(aChanged, *aStatus); + { + iUsbHostMsLun.NotifyChange(aChanged, *aStatus); - if(*aStatus != KRequestPending) - return KErrUnknown; + if(*aStatus != KRequestPending) + return KErrUnknown; - return KErrNone; - } + return KErrNone; + } void CUsbHostMsProxyDrive::NotifyChangeCancel() - { - __MSFNSLOG - iUsbHostMsLun.NotifyChangeCancel(); - } + { + iUsbHostMsLun.NotifyChangeCancel(); + } TInt CUsbHostMsProxyDrive::SetMountInfo(const TDesC8* /*aMountInfo*/,TInt /*aMountInfoThreadHandle=KCurrentThreadHandle*/) { - __MSFNSLOG return KErrNone; } TInt CUsbHostMsProxyDrive::ForceRemount(TUint aFlags) { - __MSFNSLOG iUsbHostMsLun.ForceRemount(aFlags); return KErrNone; } TInt CUsbHostMsProxyDrive::Unlock(TMediaPassword& /*aPassword*/, TBool /*aStorePassword*/) { - __MSFNSLOG return KErrNotSupported; } TInt CUsbHostMsProxyDrive::Lock(TMediaPassword& /*aOldPassword*/, TMediaPassword& /*aNewPassword*/, TBool /*aStorePassword*/) { - __MSFNSLOG return KErrNotSupported; } TInt CUsbHostMsProxyDrive::Clear(TMediaPassword& /*aPassword*/) { - __MSFNSLOG return KErrNotSupported; } TInt CUsbHostMsProxyDrive::ErasePassword() { - __MSFNSLOG return KErrNotSupported; } TInt CUsbHostMsProxyDrive::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput) - { - switch(aInterfaceId) - { - case ELocalBufferSupport: - return KErrNone; - case EFinalised: - { - TBool isFinalised = (TBool)aInput; - if(isFinalised) - { - iUsbHostMsLun.SuspendLun(); - } - } - return KErrNone; - default: - return KErrNotSupported; - } - } + { + switch(aInterfaceId) + { + case ELocalBufferSupport: + return KErrNone; + case EFinalised: + { + TBool isFinalised = (TBool)aInput; + if(isFinalised) + { + iUsbHostMsLun.SuspendLun(); + } + } + return KErrNone; + default: + return KErrNotSupported; + } + } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/msproxy/susbhomsproxy.mmp --- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/susbhomsproxy.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/susbhomsproxy.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -12,30 +12,27 @@ // // Description: // f32/shostmassstorage/msproxy/susbhomsproxy.mmp -// +// // -TARGET usbhostms.pxy -TARGETTYPE fsy - -USERINCLUDE . -USERINCLUDE ../client +TARGET usbhostms.pxy +TARGETTYPE fsy -SOURCEPATH . -SOURCE hostusbmsfactory.cpp -SOURCE hostusbmsproxy.cpp -SOURCE tmsmemmap.cpp -SOURCE debug.cpp +USERINCLUDE . +USERINCLUDE ../client +USERINCLUDE traces -// Function tracing -//SOURCEPATH ../server/shared -//SOURCE msdebug.cpp +SOURCEPATH . +SOURCE hostusbmsfactory.cpp +SOURCE hostusbmsproxy.cpp +SOURCE tmsmemmap.cpp + OS_LAYER_SYSTEMINCLUDE_SYMBIAN -LIBRARY euser.lib efile.lib usbhostmsclient.lib +LIBRARY euser.lib efile.lib usbhostmsclient.lib -UID 0x100039df 0x10000CEE +UID 0x100039df 0x10000CEE VENDORID 0x70000001 //MACRO _HOST_DEBUG_PRINT_ diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -28,14 +28,16 @@ #include #include "tmsmemmap.h" -#include "debug.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tmsmemmapTraces.h" +#endif TMsDataMemMap::TMsDataMemMap() - { - __MSFNSLOG + { Reset(); - } + } /** @@ -52,7 +54,6 @@ */ TInt TMsDataMemMap::TranslateDataPos(TInt64& aPos, TInt& aLength) const { - __MSFNSLOG // Map to the actual position on the media aPos += iDataOffset; @@ -82,7 +83,6 @@ */ TInt TMsDataMemMap::CheckBlockInRange(TInt64& aPos, TInt aLength) const { - __MSFNSLOG // Map to the actual position on the media aPos += iDataOffset; @@ -94,7 +94,8 @@ TInt64 endPos = aPos + aLength; if (endPos > iSize) { - __PXYPRINT2(_L("EOF found 0x%lx x%x"), aPos, aLength); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_PROXY, TMSMEMMAP_1, + "EOF found Pos=0x%x %x Len=0x%x", I64HIGH(aPos), I64LOW(aPos), aLength); return KErrEof; } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/msproxy/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/traces/OstTraceDefinitions.h Tue Oct 26 12:49:20 2010 +0100 @@ -0,0 +1,21 @@ +// Copyright (c) 2009 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" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevice.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevice.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevice.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -33,100 +33,95 @@ #include "cusbhostmsdevice.h" #include "cusbmssuspendresume.h" -#include "msdebug.h" -#include "debug.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cusbhostmsdeviceTraces.h" +#endif CUsbHostMsDevice* CUsbHostMsDevice::NewL(THostMassStorageConfig& aConfig) { - __MSFNSLOG - CUsbHostMsDevice* r = new (ELeave) CUsbHostMsDevice(aConfig); - CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; - } + CUsbHostMsDevice* r = new (ELeave) CUsbHostMsDevice(aConfig); + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; + } void CUsbHostMsDevice::ConstructL() { - __MSFNLOG - iTimer = CPeriodic::NewL(CActive::EPriorityStandard); - iTimerRunning = EFalse; + iTimer = CPeriodic::NewL(CActive::EPriorityStandard); + iTimerRunning = EFalse; } CUsbHostMsDevice::CUsbHostMsDevice(THostMassStorageConfig& aConfig) -: iConfig(aConfig), - iState(EReady) +: iConfig(aConfig), + iState(EReady) { - __MSFNLOG - } + } CUsbHostMsDevice::~CUsbHostMsDevice() { - __MSFNLOG - delete iTransport; - delete iDeviceSuspendResume; - if (iTimer && iTimerRunning) - { - iTimer->Cancel(); - } - delete iTimer; - } + delete iTransport; + delete iDeviceSuspendResume; + if (iTimer && iTimerRunning) + { + iTimer->Cancel(); + } + delete iTimer; + } MTransport* CUsbHostMsDevice::InitialiseTransportL(TTransportType aTransportId) { - __MSFNLOG - switch(aTransportId) + switch(aTransportId) { - case BulkOnlyTransport: - return CBulkOnlyTransport::NewL(iConfig.iInterfaceToken); - default: - // Panic; - __HOSTPRINT(_L("Unsupported Transport class requested")); - User::Leave(KErrNotSupported); - return NULL; + case BulkOnlyTransport: + return CBulkOnlyTransport::NewL(iConfig.iInterfaceToken); + default: + // Panic; + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSDEVICE_10, + "Unsupported Transport class requested"); + User::Leave(KErrNotSupported); + return NULL; } } void CUsbHostMsDevice::InitialiseL(const RMessage2& aMessage) - { - __MSFNLOG - iTransport = InitialiseTransportL((TTransportType) iConfig.iTransportId); - TRAPD(r, iDeviceSuspendResume = CUsbMsIfaceSuspendResume::NewL(iTransport, this)); - if(r != KErrNone) - { - delete iTransport; - User::Leave(r); - } - iTransport->GetMaxLun(&iMaxLun, aMessage); - } + { + iTransport = InitialiseTransportL((TTransportType) iConfig.iTransportId); + TRAPD(r, iDeviceSuspendResume = CUsbMsIfaceSuspendResume::NewL(iTransport, this)); + if(r != KErrNone) + { + delete iTransport; + User::Leave(r); + } + iTransport->GetMaxLun(&iMaxLun, aMessage); + } void CUsbHostMsDevice::UnInitialiseL() { - __MSFNLOG - StopTimer(); + StopTimer(); iLuList.RemoveAllLuL(); } TInt CUsbHostMsDevice::AddLunL(TLun aLun) { - __MSFNLOG TInt r = KErrNone; - StartTimer(); + StartTimer(); CUsbHostMsLogicalUnit* lu = CUsbHostMsLogicalUnit::NewL(aLun); CleanupStack::PushL(lu); TRAP(r, lu->InitialiseProtocolL(aLun, iConfig, *iTransport)); - if (r == KErrNone) - { - TRAP(r, iLuList.AddLuL(lu)); - } + if (r == KErrNone) + { + TRAP(r, iLuList.AddLuL(lu)); + } if (r != KErrNone) { @@ -142,24 +137,21 @@ void CUsbHostMsDevice::RemoveLunL(TLun aLun) { - __MSFNLOG - if(iLuList.Count() <= 1) - StopTimer(); - iLuList.RemoveLuL(aLun); + if(iLuList.Count() <= 1) + StopTimer(); + iLuList.RemoveLuL(aLun); } void CUsbHostMsDevice::InitLunL(TLun aLun) - { - __MSFNLOG - CUsbHostMsLogicalUnit& lu = SetLunL(aLun); + { + CUsbHostMsLogicalUnit& lu = SetLunL(aLun); lu.InitL(); - } + } void CUsbHostMsDevice::SuspendLunL(TLun aLun) - { - __MSFNLOG + { if (IsSuspended()) { return; @@ -169,42 +161,40 @@ // check whether all the luns are suspended, if so then request usb // interface suspension to the transport layer - for (TInt i = 0; i < iLuList.Count(); i++) - { - CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); - if (!lu.IsReadyToSuspend() && lu.IsConnected()) - return; - } + for (TInt i = 0; i < iLuList.Count(); i++) + { + CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); + if (!lu.IsReadyToSuspend() && lu.IsConnected()) + return; + } - for (TInt i = 0; i < iLuList.Count(); i++) - { - CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); - SetLunL(lu); - lu.SuspendL(); - } + for (TInt i = 0; i < iLuList.Count(); i++) + { + CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); + SetLunL(lu); + lu.SuspendL(); + } - StopTimer(); - iDeviceSuspendResume->Suspend(); - iState = ESuspended; - } + StopTimer(); + iDeviceSuspendResume->Suspend(); + iState = ESuspended; + } void CUsbHostMsDevice::Resume(TRequestStatus& aStatus) - { - __MSFNLOG - if (iState == ESuspended) - { - StartTimer(); - iDeviceSuspendResume->Resume(aStatus); - } - } + { + if (iState == ESuspended) + { + StartTimer(); + iDeviceSuspendResume->Resume(aStatus); + } + } TLun CUsbHostMsDevice::GetAndSetLunL(const RMessage2& aMessage) - { - __MSFNLOG - // Subssessions need a positive value to store in the handles. We represent Luns as LunId+1 - // We represent LunId in MSC from 0 to MaxLun-1 as represented in BOT so subtract 1 from the Id + { + // Subssessions need a positive value to store in the handles. We represent Luns as LunId+1 + // We represent LunId in MSC from 0 to MaxLun-1 as represented in BOT so subtract 1 from the Id // received from RMessage TInt lun = aMessage.Int3() - 1; @@ -212,9 +202,9 @@ { User::Leave(KErrArgument); } - SetLunL(static_cast(lun)); - return static_cast(lun); - } + SetLunL(static_cast(lun)); + return static_cast(lun); + } CUsbHostMsLogicalUnit& CUsbHostMsDevice::GetLuL(TInt aLunNum) const @@ -224,64 +214,63 @@ void CUsbHostMsDevice::SetLunL(CUsbHostMsLogicalUnit& aLu) - { - __MSFNLOG + { TLun lun = aLu.Lun(); - if (lun <= iMaxLun) + if (lun <= iMaxLun) { - __HOSTPRINT1(_L("SetLun %d"), lun); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSDEVICE_20, + "SetLun %d", lun); iTransport->SetLun(lun); - if (aLu.IsReadyToSuspend()) - { - aLu.CancelReadyToSuspend(); - } - } - } + if (aLu.IsReadyToSuspend()) + { + aLu.CancelReadyToSuspend(); + } + } + } CUsbHostMsLogicalUnit& CUsbHostMsDevice::SetLunL(TLun aLun) - { - __MSFNLOG + { CUsbHostMsLogicalUnit& lu = iLuList.GetLuL(aLun); SetLunL(lu); return lu; - } + } /** Starts timer to periodically check LUN. If the timer is not yet running then start it. */ void CUsbHostMsDevice::StartTimer() - { - __MSFNLOG - if (!iTimerRunning) - { - // Period of the LUN Ready check - const TTimeIntervalMicroSeconds32 KInterval = iConfig.iStatusPollingInterval * 1000 * 1000; - TCallBack callback(TimerCallback, this); - __HOSTPRINT(_L("Starting timer")); - iTimer->Start(KInterval, KInterval, callback); - iTimerRunning = ETrue; - } - } + { + if (!iTimerRunning) + { + // Period of the LUN Ready check + const TTimeIntervalMicroSeconds32 KInterval = iConfig.iStatusPollingInterval * 1000 * 1000; + TCallBack callback(TimerCallback, this); + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSDEVICE_21, + "Starting timer"); + iTimer->Start(KInterval, KInterval, callback); + iTimerRunning = ETrue; + } + } /** Ensure that the Timer is stopped */ void CUsbHostMsDevice::StopTimer() - { - __MSFNLOG - if (iTimer && iTimerRunning) - { - __HOSTPRINT(_L("Stopping timer")); - if (iTimer->IsActive()) - { - iTimer->Cancel(); - } - iTimerRunning = EFalse; - } - } + { + if (iTimer && iTimerRunning) + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSDEVICE_30, + "Stopping timer"); + if (iTimer->IsActive()) + { + iTimer->Cancel(); + } + iTimerRunning = EFalse; + } + } /** A static wrapper for the DoLunReadyCheckEvent member function for use as a timer @@ -291,70 +280,65 @@ @return not used in CPeriodic callback (see TCallback) */ TInt CUsbHostMsDevice::TimerCallback(TAny* obj) - { - __MSFNSLOG + { CUsbHostMsDevice* device = static_cast(obj); - TRAPD(err, device->DoLunReadyCheckEventL()); - return err; - } + TRAPD(err, device->DoLunReadyCheckEventL()); + return err; + } void CUsbHostMsDevice::DoLunReadyCheckEventL() - { - __MSFNLOG - TInt err; - for (TInt i = 0; i < iLuList.Count(); i++) - { - CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); - SetLunL(lu); - TRAP(err, lu.DoLunReadyCheckL()); - } - } + { + TInt err; + for (TInt i = 0; i < iLuList.Count(); i++) + { + CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); + SetLunL(lu); + TRAP(err, lu.DoLunReadyCheckL()); + } + } void CUsbHostMsDevice::DoHandleRemoteWakeupL() - { - __MSFNLOG - DoResumeLogicalUnitsL(); - DoLunReadyCheckEventL(); // For remote wakeup we do not wait for timer to expire + { + DoResumeLogicalUnitsL(); + DoLunReadyCheckEventL(); // For remote wakeup we do not wait for timer to expire // check whether all the luns are suspended, if so then request usb // interface suspension to the transport layer - for (TInt i = 0; i < iLuList.Count(); i++) - { - CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); - // Has any of the logical units have got its state changed? - if ( (lu.IsReadyToSuspend() && !lu.IsConnected()) || - (!lu.IsReadyToSuspend() && lu.IsConnected()) ) - { - StartTimer(); // Now start the timer - return; - } - } + for (TInt i = 0; i < iLuList.Count(); i++) + { + CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); + // Has any of the logical units have got its state changed? + if ( (lu.IsReadyToSuspend() && !lu.IsConnected()) || + (!lu.IsReadyToSuspend() && lu.IsConnected()) ) + { + StartTimer(); // Now start the timer + return; + } + } - for (TInt i = 0; i < iLuList.Count(); i++) - { - CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); - SetLunL(lu); - lu.SuspendL(); - } + for (TInt i = 0; i < iLuList.Count(); i++) + { + CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); + SetLunL(lu); + lu.SuspendL(); + } - iDeviceSuspendResume->Suspend(); - iState = ESuspended; - } + iDeviceSuspendResume->Suspend(); + iState = ESuspended; + } void CUsbHostMsDevice::DoResumeLogicalUnitsL() - { - __MSFNLOG - for (TInt i = 0; i < iLuList.Count(); i++) - { - CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); - SetLunL(lu); - lu.ResumeL(); - } - } + { + for (TInt i = 0; i < iLuList.Count(); i++) + { + CUsbHostMsLogicalUnit& lu = iLuList.GetLu(i); + SetLunL(lu); + lu.ResumeL(); + } + } void CUsbHostMsDevice::ResumeCompletedL() - { - __MSFNLOG - iState = EReady; - DoResumeLogicalUnitsL(); - } + { + iState = EReady; + DoResumeLogicalUnitsL(); + } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -27,10 +27,13 @@ #include "msgservice.h" #include "cusbhostmslogicalunit.h" #include "cusbhostmsdevice.h" -#include "msdebug.h" #include "cusbhostmssession.h" #include "cusbhostmsdevicethread.h" -#include "debug.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cusbhostmsdevicethreadTraces.h" +#endif /** Constructor @@ -38,7 +41,6 @@ TDeviceHandler::TDeviceHandler(CUsbHostMsDevice& aDevice) : iDevice(aDevice) { - __MSFNLOG } @@ -51,14 +53,13 @@ */ void TDeviceHandler::HandleMessageL(const RMessage2& aMessage) { - __MSFNLOG TLun lun = iDevice.GetAndSetLunL(aMessage); - switch (aMessage.Function()) - { - case EUsbHostMsSuspendLun: + switch (aMessage.Function()) + { + case EUsbHostMsSuspendLun: iDevice.SuspendLunL(lun); - break; + break; case EUsbHostMsUnRegisterLun: iDevice.RemoveLunL(lun); break; @@ -67,8 +68,8 @@ CUsbHostMsLogicalUnit& lu = iDevice.GetLuL(lun); TLogicalUnitHandler luHandler(lu); luHandler.HandleMessageL(aMessage); - break; - } + break; + } } @@ -80,7 +81,6 @@ TLogicalUnitHandler::TLogicalUnitHandler(CUsbHostMsLogicalUnit& aLu) : iLu(aLu) { - __MSFNLOG } @@ -91,65 +91,62 @@ @param aMessage */ void TLogicalUnitHandler::HandleMessageL(const RMessage2& aMessage) - { - __MSFNLOG - switch (aMessage.Function()) - { - case EUsbHostMsNotifyChange: + { + switch (aMessage.Function()) + { + case EUsbHostMsNotifyChange: iLu.NotifyChange(aMessage); - break; - case EUsbHostMsCancelChangeNotifier: + break; + case EUsbHostMsCancelChangeNotifier: iLu.CancelChangeNotifierL(); - break; - case EUsbHostMsForceRemount: + break; + case EUsbHostMsForceRemount: iLu.ForceCompleteNotifyChangeL(); - break; - case EUsbHostMsRead: + break; + case EUsbHostMsRead: iLu.ReadL(aMessage); - break; - case EUsbHostMsWrite: + break; + case EUsbHostMsWrite: iLu.WriteL(aMessage); - break; - case EUsbHostMsErase: + break; + case EUsbHostMsErase: iLu.EraseL(aMessage); - break; - case EUsbHostMsCapacity: + break; + case EUsbHostMsCapacity: iLu.CapsL(aMessage); - break; - default: - aMessage.Panic(KUsbHostMsSrvPncCat, EUsbMsPanicIllegalIPC); - break; - } - } + break; + default: + aMessage.Panic(KUsbHostMsSrvPncCat, EUsbMsPanicIllegalIPC); + break; + } + } void CUsbHostMsDeviceThread::DoStartServerL(TAny* aPtr) { - __MSFNSLOG CActiveScheduler* s = new(ELeave) CActiveScheduler; CActiveScheduler::Install(s); - CUsbHostMsDeviceThread* iThread = (CUsbHostMsDeviceThread*)aPtr; - CActiveScheduler::Add(iThread); + CUsbHostMsDeviceThread* iThread = (CUsbHostMsDeviceThread*)aPtr; + CActiveScheduler::Add(iThread); iThread->Start(); - RThread::Rendezvous(KErrNone); + RThread::Rendezvous(KErrNone); - // + // // Ready to run CActiveScheduler::Start(); // // Cleanup the scheduler - delete s; + delete s; } TInt CUsbHostMsDeviceThread::Entry(TAny* aPtr) - { - __MSFNSLOG - CTrapCleanup* cleanup = CTrapCleanup::New(); + { + CTrapCleanup* cleanup = CTrapCleanup::New(); if (!cleanup) { return KErrNoMemory; @@ -158,31 +155,29 @@ TRAPD(error, DoStartServerL(aPtr)); delete cleanup; return error; - } + } void CUsbHostMsDeviceThread::RunL() - { - __MSFNLOG - + { // called on completion of MessageRequest() or Resume() User::LeaveIfError(iStatus.Int()); - Lock(); + Lock(); if (iUsbHostMsDevice) { if (iUsbHostMsDevice->IsSuspended()) { - RMessage2 msg = iRMessage2[iDequeueIndex]; + RMessage2 msg = iRMessage2[iDequeueIndex]; if (msg.Function() != EUsbHostMsSuspendLun) { - // request resume + // request resume Unlock(); iUsbHostMsDevice->Resume(iStatus); SetActive(); return; - } + } } } @@ -192,15 +187,15 @@ iDequeueIndex++; if(iDequeueIndex >= KMaxNumMessage) - iDequeueIndex = 0; + iDequeueIndex = 0; if(iQueueFull) - iQueueFull = EFalse; + iQueueFull = EFalse; HandleMessage(msg); if ((iQueueIndex != iDequeueIndex) || iQueueFull) - { - // self completion + { + // self completion TRequestStatus* status = &iStatus; User::RequestComplete(status, KErrNone); SetActive(); @@ -211,7 +206,7 @@ SetActive(); } Unlock(); - } + } void CUsbHostMsDeviceThread::DoCancel() @@ -223,63 +218,59 @@ TInt CUsbHostMsDeviceThread::RunError(TInt aError) { - __HOSTPRINT1(_L(">> HOST RunError returning %d"), aError); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSDEVICETHREAD_10, + ">> HOST RunError returning %d", aError); return KErrNone; } TInt CUsbHostMsDeviceThread::QueueMsg(const RMessage2& aMsg) - { - __MSFNLOG - - if (iQueueFull) - { - return KErrOverflow; - } + { + if (iQueueFull) + { + return KErrOverflow; + } Lock(); - iRMessage2[iQueueIndex] = aMsg; - iQueueIndex++; + iRMessage2[iQueueIndex] = aMsg; + iQueueIndex++; - if (iQueueIndex >= KMaxNumMessage) - { - iQueueIndex = 0; - } + if (iQueueIndex >= KMaxNumMessage) + { + iQueueIndex = 0; + } - if (iQueueIndex == iDequeueIndex) - { - iQueueFull = ETrue; - } - Unlock(); - return KErrNone; - } + if (iQueueIndex == iDequeueIndex) + { + iQueueFull = ETrue; + } + Unlock(); + return KErrNone; + } CUsbHostMsDeviceThread::CUsbHostMsDeviceThread(CUsbHostMsSession& aUsbHostMsSession, TUint aToken) -: CActive(EPriorityStandard), +: CActive(EPriorityStandard), iUsbHostMsSession(aUsbHostMsSession), iQueueFull(EFalse) - { - __MSFNLOG + { TBuf<32> nameBuf; nameBuf.Format(_L("Host Ms ThreadMutex%8x"), aToken); - iMutex.CreateGlobal(nameBuf,EOwnerProcess); - } + iMutex.CreateGlobal(nameBuf,EOwnerProcess); + } CUsbHostMsDeviceThread::~CUsbHostMsDeviceThread() - { - __MSFNLOG + { Cancel(); - iMutex.Close(); - } + iMutex.Close(); + } CUsbHostMsDeviceThread* CUsbHostMsDeviceThread::NewL(CUsbHostMsSession& aUsbHostMsSession, TUint aToken) - { - __MSFNSLOG - CUsbHostMsDeviceThread* r = new (ELeave) CUsbHostMsDeviceThread(aUsbHostMsSession, aToken); - return r; - } + { + CUsbHostMsDeviceThread* r = new (ELeave) CUsbHostMsDeviceThread(aUsbHostMsSession, aToken); + return r; + } void CUsbHostMsDeviceThread::Start() @@ -291,59 +282,61 @@ /** Handles the request (in the form of a message) received from the client -@param aMessage The received message +@param aMessage The received message */ void CUsbHostMsDeviceThread::HandleMessage(const RMessage2& aMessage) - { - __MSFNLOG - TInt ret = KErrNotReady; - __HOSTPRINT2(_L(">> HOST DispatchMessageL Function=%d %d"), aMessage.Function(), aMessage.Int3()); - switch (aMessage.Function()) - { - case EUsbHostMsRegisterInterface: - TRAP(ret, RegisterInterfaceL(aMessage)); - break; + { + TInt ret = KErrNotReady; + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSDEVICETHREAD_21, + ">> HOST DispatchMessageL Function=%d %d", + aMessage.Function(), aMessage.Int3()); + switch (aMessage.Function()) + { + case EUsbHostMsRegisterInterface: + TRAP(ret, RegisterInterfaceL(aMessage)); + break; case EUsbHostMsInitialiseInterface: - TRAP(ret, InitialiseInterfaceL(aMessage)); + TRAP(ret, InitialiseInterfaceL(aMessage)); // CUsbInterfaceHandler::GetMaxLun() completes asynchronously if (ret) { // Error condition needs to be completed break; } - return; - case EUsbHostMsUnRegisterInterface: - // Check whether all luns have got uninitialised. + return; + case EUsbHostMsUnRegisterInterface: + // Check whether all luns have got uninitialised. if (iUsbHostMsDevice) { for(TInt i = 0, j = iUsbHostMsDevice->GetMaxLun(); i <= j; i++) TRAP_IGNORE(iUsbHostMsDevice->RemoveLunL(i)); } - TRAP(ret, UnRegisterInterfaceL(aMessage)); - break; - case EUsbHostMsRegisterLun: - TRAP(ret, RegisterLogicalUnitL(aMessage)); - break; - case EUsbHostMsGetNumLun: - TRAP(ret, GetNumLunL(aMessage)); - break; - case EUsbHostMsShutdown: - ret = Shutdown(); - break; + TRAP(ret, UnRegisterInterfaceL(aMessage)); + break; + case EUsbHostMsRegisterLun: + TRAP(ret, RegisterLogicalUnitL(aMessage)); + break; + case EUsbHostMsGetNumLun: + TRAP(ret, GetNumLunL(aMessage)); + break; + case EUsbHostMsShutdown: + ret = Shutdown(); + break; default: // Try Device Handler and Logical Unit Handler __ASSERT_DEBUG(iUsbHostMsDevice, User::Invariant()); TDeviceHandler deviceHandler(*iUsbHostMsDevice); TRAP(ret, deviceHandler.HandleMessageL(aMessage)); - break; - } - __HOSTPRINT1(_L(">> HOST returning %d"), ret); + break; + } + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSDEVICETHREAD_22, + ">> HOST returning %d", ret); if (aMessage.Function() != EUsbHostMsNotifyChange) { aMessage.Complete(ret); } - } + } /** @@ -353,85 +346,81 @@ */ TInt CUsbHostMsDeviceThread::Shutdown() { - __MSFNLOG CActiveScheduler::Stop(); - return KErrNone; - } + return KErrNone; + } void CUsbHostMsDeviceThread::GetNumLunL(const RMessage2& aMessage) - { - __MSFNLOG + { if (!iUsbHostMsDevice) { User::Leave(KErrNotReady); } - TUint32 maxLun = iUsbHostMsDevice->GetMaxLun() + 1; - TPtrC8 pLun((TUint8*)&maxLun,sizeof(TUint32)); - aMessage.WriteL(0,pLun); - } + TUint32 maxLun = iUsbHostMsDevice->GetMaxLun() + 1; + TPtrC8 pLun((TUint8*)&maxLun,sizeof(TUint32)); + aMessage.WriteL(0,pLun); + } void CUsbHostMsDeviceThread::RegisterInterfaceL(const RMessage2& aMessage) - { - __MSFNLOG + { + THostMassStorageConfig msDeviceConfig; + TPtr8 ptr((TUint8*)&msDeviceConfig,sizeof(THostMassStorageConfig)); + aMessage.ReadL(0, ptr); - THostMassStorageConfig msDeviceConfig; - TPtr8 ptr((TUint8*)&msDeviceConfig,sizeof(THostMassStorageConfig)); - aMessage.ReadL(0, ptr); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSDEVICETHREAD_30, + "RegisterInterfaceL Token=%d ", msDeviceConfig.iInterfaceToken); - __HOSTPRINT1(_L("RegisterInterfaceL Token=%d "), msDeviceConfig.iInterfaceToken); - - iUsbHostMsDevice = CUsbHostMsDevice::NewL(msDeviceConfig); - } + iUsbHostMsDevice = CUsbHostMsDevice::NewL(msDeviceConfig); + } void CUsbHostMsDeviceThread::InitialiseInterfaceL(const RMessage2& aMessage) - { - __MSFNLOG + { if (!iUsbHostMsDevice) { User::Leave(KErrNotReady); } - TRAPD(err, iUsbHostMsDevice->InitialiseL(aMessage)); + TRAPD(err, iUsbHostMsDevice->InitialiseL(aMessage)); if (err != KErrNone) { delete iUsbHostMsDevice; - iUsbHostMsDevice = NULL; + iUsbHostMsDevice = NULL; User::Leave(err); } - } + } void CUsbHostMsDeviceThread::UnRegisterInterfaceL(const RMessage2& aMessage) { - __MSFNLOG if (!iUsbHostMsDevice) { User::Leave(KErrNotReady); } - TRAPD(err, iUsbHostMsDevice->UnInitialiseL()); - delete iUsbHostMsDevice; - iUsbHostMsDevice = NULL; + TRAPD(err, iUsbHostMsDevice->UnInitialiseL()); + delete iUsbHostMsDevice; + iUsbHostMsDevice = NULL; User::LeaveIfError(err); } void CUsbHostMsDeviceThread::RegisterLogicalUnitL(const RMessage2& aMessage) - { + { if (!iUsbHostMsDevice) { User::Leave(KErrNotReady); } - TUint32 iLunId = aMessage.Int0() + 1; // Subssessions need a positive value to store in the handles. We represent Luns as LunId+1 - TPtrC8 pLun((TUint8*)&iLunId, sizeof(TUint32)); - aMessage.WriteL(3, pLun); - iLunId -= 1; // We represent LunId in MSC from 0 to MaxLun-1 as represented in BOT - __HOSTPRINT1(_L("RegisterLogicalUnitL LUN=%d "), iLunId); - iUsbHostMsDevice->AddLunL(iLunId); - iUsbHostMsDevice->InitLunL(iLunId); - } + TUint32 iLunId = aMessage.Int0() + 1; // Subssessions need a positive value to store in the handles. We represent Luns as LunId+1 + TPtrC8 pLun((TUint8*)&iLunId, sizeof(TUint32)); + aMessage.WriteL(3, pLun); + iLunId -= 1; // We represent LunId in MSC from 0 to MaxLun-1 as represented in BOT + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSDEVICETHREAD_31, + "RegisterLogicalUnitL LUN=%d ", iLunId); + iUsbHostMsDevice->AddLunL(iLunId); + iUsbHostMsDevice->InitLunL(iLunId); + } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmslogicalunit.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmslogicalunit.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmslogicalunit.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -31,69 +31,65 @@ #include "cusbhostmslogicalunit.h" #include "usbmshostpanic.h" -#include "msdebug.h" -#include "debug.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cusbhostmslogicalunitTraces.h" +#endif CUsbHostMsLogicalUnit* CUsbHostMsLogicalUnit::NewL(TLun aLun) { - __MSFNSLOG - CUsbHostMsLogicalUnit* r = new (ELeave) CUsbHostMsLogicalUnit(aLun); - CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; - } + CUsbHostMsLogicalUnit* r = new (ELeave) CUsbHostMsLogicalUnit(aLun); + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; + } void CUsbHostMsLogicalUnit::ConstructL() { - __MSFNLOG const TInt KInitialDataBufSize = 0x200; - iDataBuf.CreateL(KInitialDataBufSize); + iDataBuf.CreateL(KInitialDataBufSize); } CUsbHostMsLogicalUnit::CUsbHostMsLogicalUnit(TLun aLun) : iProtocol(NULL), iLun(aLun), - iSuspendRequest(EFalse) + iSuspendRequest(EFalse) { - __MSFNLOG - } + } CUsbHostMsLogicalUnit::~CUsbHostMsLogicalUnit() { - __MSFNLOG iDataBuf.Close(); - delete iProtocol; - } + delete iProtocol; + } void CUsbHostMsLogicalUnit::InitL() { - __MSFNLOG - iProtocol->InitialiseUnitL(); + iProtocol->InitialiseUnitL(); } void CUsbHostMsLogicalUnit::UnInitL() { - __MSFNLOG - iProtocol->UninitialiseUnitL(); + iProtocol->UninitialiseUnitL(); } void CUsbHostMsLogicalUnit::ReadL(const RMessage2& aMessage) { - __MSFNLOG - TReadWrite p; - TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite)); - aMessage.ReadL(0, pReadWrite); - __HOSTPRINT2(_L("pos = 0x%lx len = %08x"), p.iPos, p.iLen); + TReadWrite p; + TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite)); + aMessage.ReadL(0, pReadWrite); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSLOGICALUNIT_10, + "pos = 0x%x %x len = %08x", I64HIGH(p.iPos), I64LOW(p.iPos), p.iLen); User::LeaveIfError(CheckPosition(p)); - // check if buffer can hold requested data and resize if not - if (iDataBuf.MaxLength() < p.iLen) + // check if buffer can hold requested data and resize if not + if (iDataBuf.MaxLength() < p.iLen) iDataBuf.ReAllocL(p.iLen); iProtocol->ReadL(p.iPos, iDataBuf, p.iLen); @@ -103,11 +99,11 @@ void CUsbHostMsLogicalUnit::WriteL(const RMessage2& aMessage) { - __MSFNLOG - TReadWrite p; - TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite)); - aMessage.ReadL(1, pReadWrite); - __HOSTPRINT2(_L("pos = 0x%lx len = %08x"), p.iPos, p.iLen); + TReadWrite p; + TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite)); + aMessage.ReadL(1, pReadWrite); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSLOGICALUNIT_11, + "pos = 0x%x %x len = %08x", I64HIGH(p.iPos), I64LOW(p.iPos), p.iLen); User::LeaveIfError(CheckPosition(p)); @@ -115,18 +111,18 @@ if (iDataBuf.MaxLength() < p.iLen) iDataBuf.ReAllocL(p.iLen); - aMessage.ReadL(0, iDataBuf); - iProtocol->WriteL(p.iPos, iDataBuf, p.iLen); + aMessage.ReadL(0, iDataBuf); + iProtocol->WriteL(p.iPos, iDataBuf, p.iLen); } void CUsbHostMsLogicalUnit::EraseL(const RMessage2& aMessage) { - __MSFNLOG - TReadWrite p; - TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite)); - aMessage.ReadL(0, pReadWrite); - __HOSTPRINT2(_L("pos = 0x%lx len = %08x"), p.iPos, p.iLen); + TReadWrite p; + TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite)); + aMessage.ReadL(0, pReadWrite); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSLOGICALUNIT_12, + "pos = 0x%x %x len = %08x", I64HIGH(p.iPos), I64LOW(p.iPos), p.iLen); User::LeaveIfError(CheckPosition(p)); @@ -135,99 +131,88 @@ iDataBuf.ReAllocL(p.iLen); iDataBuf.FillZ(p.iLen); - iProtocol->WriteL(p.iPos, iDataBuf, p.iLen); + iProtocol->WriteL(p.iPos, iDataBuf, p.iLen); } void CUsbHostMsLogicalUnit::CapsL(const RMessage2& aMessage) { - __MSFNLOG - TCapsInfo capsInfo; TPckg pckg(capsInfo); - iProtocol->GetCapacityL(capsInfo); + iProtocol->GetCapacityL(capsInfo); iSize = static_cast(capsInfo.iNumberOfBlocks) * capsInfo.iBlockLength; - aMessage.WriteL(0, pckg); + aMessage.WriteL(0, pckg); } void CUsbHostMsLogicalUnit::NotifyChange(const RMessage2& aMessage) { - __MSFNLOG - iProtocol->NotifyChange(aMessage); + iProtocol->NotifyChange(aMessage); } void CUsbHostMsLogicalUnit::ForceCompleteNotifyChangeL() { - __MSFNLOG - iProtocol->ForceCompleteNotifyChangeL(); + iProtocol->ForceCompleteNotifyChangeL(); } void CUsbHostMsLogicalUnit::CancelChangeNotifierL() { - __MSFNLOG - iProtocol->CancelChangeNotifierL(); + iProtocol->CancelChangeNotifierL(); } TBool CUsbHostMsLogicalUnit::IsConnected() - { - return iProtocol->IsConnected() ? ETrue : EFalse; - } + { + return iProtocol->IsConnected() ? ETrue : EFalse; + } TBool CUsbHostMsLogicalUnit::IsReadyToSuspend() { - __MSFNLOG - return iSuspendRequest ? ETrue : EFalse; - } + return iSuspendRequest ? ETrue : EFalse; + } void CUsbHostMsLogicalUnit::ReadyToSuspend() { - __MSFNLOG - iSuspendRequest = ETrue; + iSuspendRequest = ETrue; } void CUsbHostMsLogicalUnit::CancelReadyToSuspend() { - __MSFNLOG - iSuspendRequest = EFalse; + iSuspendRequest = EFalse; } void CUsbHostMsLogicalUnit::SuspendL() { - __MSFNLOG - iProtocol->SuspendL(); + iProtocol->SuspendL(); } void CUsbHostMsLogicalUnit::ResumeL() - { - __MSFNLOG - // We do not cancel iSuspendRequest here - iProtocol->ResumeL(); - } + { + // We do not cancel iSuspendRequest here + iProtocol->ResumeL(); + } void CUsbHostMsLogicalUnit::DoLunReadyCheckL() { - __MSFNLOG - iProtocol->DoScsiReadyCheckEventL(); + iProtocol->DoScsiReadyCheckEventL(); } TInt CUsbHostMsLogicalUnit::InitialiseProtocolL(TLun aLun, THostMassStorageConfig& aConfig, MTransport& aTransport) { - __MSFNLOG __ASSERT_DEBUG(iProtocol == NULL, User::Panic(KUsbMsHostPanicCat, EProtocolNotFree)); - switch(aConfig.iProtocolId) + switch(aConfig.iProtocolId) { - case ScsiProtocol: - iProtocol = CScsiProtocol::NewL(aLun, aTransport); - break; - default: - __HOSTPRINT(_L("Unsupported Transport class requested")); - iProtocol = NULL; - return KErrNotSupported; + case ScsiProtocol: + iProtocol = CScsiProtocol::NewL(aLun, aTransport); + break; + default: + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSLOGICALUNIT_13, + "Unsupported Transport class requested"); + iProtocol = NULL; + return KErrNotSupported; } - return KErrNone; + return KErrNone; } TInt CUsbHostMsLogicalUnit::CheckPosition(const TReadWrite& aReadWrite) @@ -240,9 +225,9 @@ return KErrArgument; } - // detect drive not present - if (iSize == 0) - return KErrNotReady; + // detect drive not present + if (iSize == 0) + return KErrNotReady; if (aReadWrite.iPos >= iSize) return KErrArgument; diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbmssuspendresume.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbmssuspendresume.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbmssuspendresume.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -34,76 +34,81 @@ #include "cbulkonlytransport.h" #include "cusbmssuspendresume.h" -#include "msdebug.h" -#include "debug.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cusbmssuspendresumeTraces.h" +#endif void CUsbMsIfaceSuspendResume::RunL() { - __MSFNLOG - iDevice->ResumeCompletedL(); - if(iCancelSuspend) - { - User::RequestComplete(iDeviceStatus, iStatus.Int()); - iDeviceStatus = NULL; - } - else - { - iDevice->DoHandleRemoteWakeupL(); - } + iDevice->ResumeCompletedL(); + if(iCancelSuspend) + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_SUSPEND, CUSBMSSUSPENDRESUME_10, + "SUSPEND/RESUME completed."); + User::RequestComplete(iDeviceStatus, iStatus.Int()); + iDeviceStatus = NULL; + } + else + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_SUSPEND, CUSBMSSUSPENDRESUME_11, + "REMOTE WAKEUP"); + iDevice->DoHandleRemoteWakeupL(); + } } /** Cancellation of outstanding request */ void CUsbMsIfaceSuspendResume::DoCancel() - { - __MSFNLOG - } + { + } TInt CUsbMsIfaceSuspendResume::RunError(TInt aError) - { - __MSFNLOG + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_SUSPEND, CUSBMSSUSPENDRESUME_12, + "Error = %d", aError); return KErrNone; - } + } void CUsbMsIfaceSuspendResume::Resume(TRequestStatus& aStatus) - { - __MSFNLOG - iCancelSuspend = ETrue; + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_SUSPEND, CUSBMSSUSPENDRESUME_13, + "RESUME"); + iCancelSuspend = ETrue; aStatus = KRequestPending; - iDeviceStatus = &aStatus; - iTransport->Resume(); - } + iDeviceStatus = &aStatus; + iTransport->Resume(); + } void CUsbMsIfaceSuspendResume::Suspend() - { - __MSFNLOG - if(!IsActive()) - SetActive(); - iCancelSuspend = EFalse; - iTransport->Suspend(iStatus); - } + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_SUSPEND, CUSBMSSUSPENDRESUME_14, + "SUSPEND"); + if(!IsActive()) + SetActive(); + iCancelSuspend = EFalse; + iTransport->Suspend(iStatus); + } CUsbMsIfaceSuspendResume* CUsbMsIfaceSuspendResume::NewL(MTransport *aTransport, CUsbHostMsDevice *aDevice) - { - return new (ELeave) CUsbMsIfaceSuspendResume(aTransport, aDevice); - } + { + return new (ELeave) CUsbMsIfaceSuspendResume(aTransport, aDevice); + } CUsbMsIfaceSuspendResume::CUsbMsIfaceSuspendResume(MTransport* aTransport, CUsbHostMsDevice* aDevice) -: CActive(EPriorityHigh), +: CActive(EPriorityHigh), iTransport(aTransport), iDevice(aDevice), iCancelSuspend(EFalse) - { - __MSFNLOG - CActiveScheduler::Add(this); - } + { + CActiveScheduler::Add(this); + } CUsbMsIfaceSuspendResume::~CUsbMsIfaceSuspendResume() - { - __MSFNLOG - Cancel(); - } + { + Cancel(); + } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -25,19 +25,20 @@ #include "cusbhostmslogicalunit.h" #include "tlogicalunitlist.h" -#include "msdebug.h" -#include "debug.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tlogicalunitlistTraces.h" +#endif TLogicalUnitList::~TLogicalUnitList() { - __MSFNLOG iLu.ResetAndDestroy(); } void TLogicalUnitList::AddLuL(CUsbHostMsLogicalUnit* aLu) { - __MSFNLOG - __HOSTPRINT1(_L("Adding LU 0x%x"), aLu); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, TLOGICALUNITLIST_10, + "Adding LU 0x%x", aLu); TInt r= FindLu(aLu->Lun()); if (r < 0) @@ -47,18 +48,17 @@ User::Leave(r); } } - else // If it is able to find the lun already + else // If it is able to find the lun already { User::Leave(KErrAlreadyExists); } - User::LeaveIfError(iLu.Append(aLu)); + User::LeaveIfError(iLu.Append(aLu)); } void TLogicalUnitList::RemoveLuL(TLun aLun) { - __MSFNLOG TInt index = FindLu(aLun); User::LeaveIfError(index); @@ -66,23 +66,22 @@ TRAPD(err, lu->UnInitL()); delete lu; iLu.Remove(index); - if(err != KErrNone) - User::Leave(err); + if(err != KErrNone) + User::Leave(err); } void TLogicalUnitList::RemoveAllLuL() { - __MSFNLOG - TInt ret = KErrNone; + TInt ret = KErrNone; for (TInt index = 0; index < iLu.Count(); index++) { CUsbHostMsLogicalUnit* lu = iLu[index]; TRAPD(err, lu->UnInitL()); delete lu; // set return flag for first error condition - if (ret == KErrNone && err != KErrNone) - ret = err; + if (ret == KErrNone && err != KErrNone) + ret = err; } iLu.Reset(); @@ -91,18 +90,17 @@ TInt TLogicalUnitList::Count() const { - __MSFNSLOG - return iLu.Count(); - } + return iLu.Count(); + } TInt TLogicalUnitList::FindLu(TLun aLun) const { - __MSFNSLOG - TInt index; for (index = 0; index < iLu.Count(); index++) { - __HOSTPRINT2(_L("search LUN=%d : interface id = %d"), aLun, iLu[index]->Lun()); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_HOST, TLOGICALUNITLIST_11, + "search LUN=%d : interface id = %d", + (TInt)aLun, (TInt)iLu[index]->Lun()); if (iLu[index]->Lun() == aLun) { break; @@ -119,7 +117,6 @@ CUsbHostMsLogicalUnit& TLogicalUnitList::GetLuL(TLun aLun) const { - __MSFNSLOG TInt index = FindLu(aLun); User::LeaveIfError(index); return *iLu[index]; @@ -128,6 +125,5 @@ CUsbHostMsLogicalUnit& TLogicalUnitList::GetLu(TInt aIndex) const { - __MSFNSLOG return *iLu[aIndex]; } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/hostmsserver.mmp --- a/userlibandfileserver/fileserver/shostmassstorage/server/hostmsserver.mmp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/hostmsserver.mmp Tue Oct 26 12:49:20 2010 +0100 @@ -13,58 +13,57 @@ // Description: // f32/group/hostmsserver.mmp // Host mass storage client/server mmp file -// +// // -TARGET usbhostmssrv.exe +TARGET usbhostmssrv.exe -TARGETTYPE exe +TARGETTYPE exe OS_LAYER_SYSTEMINCLUDE_SYMBIAN -USERINCLUDE ../shared -USERINCLUDE ./src/include -USERINCLUDE ./controller/include -USERINCLUDE ./transport/include -USERINCLUDE ./protocol/include -USERINCLUDE ./shared +USERINCLUDE ../shared +USERINCLUDE ./src/include +USERINCLUDE ./controller/include +USERINCLUDE ./transport/include +USERINCLUDE ./protocol/include +USERINCLUDE ./shared +USERINCLUDE ./traces -SOURCEPATH ./src -SOURCE cusbhostmssession.cpp -SOURCE cusbhostmsserver.cpp -SOURCE entry.cpp - -SOURCEPATH ./controller -SOURCE cusbhostmsdevice.cpp -SOURCE tlogicalunitlist.cpp -SOURCE cusbmssuspendresume.cpp -SOURCE cusbhostmsdevicethread.cpp -SOURCE cusbhostmslogicalunit.cpp +SOURCEPATH ./src +SOURCE cusbhostmssession.cpp +SOURCE cusbhostmsserver.cpp +SOURCE entry.cpp -SOURCEPATH ./transport -SOURCE cbulkonlytransport.cpp -SOURCE cusbifacehandler.cpp +SOURCEPATH ./controller +SOURCE cusbhostmsdevice.cpp +SOURCE tlogicalunitlist.cpp +SOURCE cusbmssuspendresume.cpp +SOURCE cusbhostmsdevicethread.cpp +SOURCE cusbhostmslogicalunit.cpp + +SOURCEPATH ./transport +SOURCE cbulkonlytransport.cpp +SOURCE cusbifacehandler.cpp -SOURCEPATH ./protocol -SOURCE cmassstoragefsm.cpp -SOURCE cscsiprotocol.cpp -SOURCE tspcclientinterface.cpp -SOURCE tsbcclientinterface.cpp -SOURCE tscsiclientreq.cpp -SOURCE tscsiprimarycmds.cpp -SOURCE tscsiblockcmds.cpp -SOURCE tblocktransfer.cpp +SOURCEPATH ./protocol +SOURCE cmassstoragefsm.cpp +SOURCE cscsiprotocol.cpp +SOURCE tspcclientinterface.cpp +SOURCE tsbcclientinterface.cpp +SOURCE tscsiclientreq.cpp +SOURCE tscsiprimarycmds.cpp +SOURCE tscsiblockcmds.cpp +SOURCE tblocktransfer.cpp -SOURCEPATH ./shared -SOURCE msdebug.cpp -LIBRARY efsrv.lib euser.lib hal.lib usbdescriptors.lib usbdi_utils.lib +LIBRARY efsrv.lib euser.lib hal.lib usbdescriptors.lib usbdi_utils.lib START WINS -BASEADDRESS 0x61000000 +BASEADDRESS 0x61000000 END CAPABILITY AllFiles CommDD -UID 0 0x10286A83 +UID 0 0x10286A83 // **** Enable for Host MS testing **** //MACRO _TESTREPORT_PRINT_ diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/cmassstoragefsm.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cmassstoragefsm.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cmassstoragefsm.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -20,10 +20,12 @@ #include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cmassstoragefsmTraces.h" +#endif + #include "usbmshostpanic.h" -#include "debug.h" -#include "msdebug.h" - #include "msctypes.h" #include "mprotocol.h" #include "mblocktransferprotocol.h" @@ -32,6 +34,7 @@ #include "cmassstoragefsm.h" + /** Constructor @@ -40,7 +43,6 @@ TMassStorage::TMassStorage(CScsiProtocol& aScsiProtocol) : iScsiProtocol(aScsiProtocol) { - __MSFNLOG } @@ -49,8 +51,7 @@ */ void CMassStorageFsm::ClearStatusCheck() { - __MSFNLOG - iStatusCheck = EFalse; + iStatusCheck = EFalse; } @@ -59,8 +60,7 @@ */ void CMassStorageFsm::SetStatusCheck() { - __MSFNLOG - iStatusCheck = ETrue; + iStatusCheck = ETrue; } @@ -71,8 +71,7 @@ */ TBool CMassStorageFsm::IsStatusCheck() const { - __MSFNSLOG - return iStatusCheck; + return iStatusCheck; } @@ -83,7 +82,6 @@ */ TBool TMassStorage::IsSbcSet() const { - __MSFNSLOG return iScsiProtocol.MsIsSbcSet(); } @@ -94,7 +92,6 @@ */ TBool TMassStorage::IsRemovableMedia() const { - __MSFNSLOG return iScsiProtocol.MsIsRemovableMedia(); } @@ -105,7 +102,6 @@ */ const TSenseInfo& TMassStorage::MsSenseInfo() const { - __MSFNSLOG return iScsiProtocol.MsSenseInfo(); } @@ -113,7 +109,6 @@ /** SCSI Request */ TMassStorage::TEvent TMassStorage::InquiryL() { - __MSFNLOG TEvent event = EEvCommandFailed; switch (iScsiProtocol.MsInquiryL()) @@ -125,11 +120,13 @@ event = EEvCommandFailed; break; case KErrNotSupported: - __SCSIPRINT(_L("INQUIRY Command returned NOT SUPPORTED")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, CMASSSTORAGEFSM_10, + "INQUIRY Command returned NOT SUPPORTED"); User::Leave(KErrNotSupported); break; default: - __SCSIPRINT(_L("INQUIRY Command returned KErrUnknown")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, CMASSSTORAGEFSM_11, + "INQUIRY Command returned KErrUnknown"); User::Leave(KErrUnknown); break; } @@ -140,18 +137,19 @@ /** SCSI Request */ TMassStorage::TEvent TMassStorage::SenseL() { - __MSFNLOG TEvent event = EEvCommandPassed; switch (iScsiProtocol.MsRequestSenseL()) { case KErrNone: break; case KErrCommandFailed: - __SCSIPRINT(_L("REQUEST SENSE Command Failed")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, CMASSSTORAGEFSM_12, + "REQUEST SENSE Command Failed"); User::Leave(KErrNotSupported); break; default: - __SCSIPRINT(_L("INQUIRY Command returned KErrUnknown")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, CMASSSTORAGEFSM_13, + "INQUIRY Command returned KErrUnknown"); User::Leave(KErrUnknown); break; } @@ -162,7 +160,6 @@ /** SCSI Request */ TMassStorage::TEvent TMassStorage::TestUnitReadyL() { - __MSFNLOG // KErrCommandFailed indictates that device is NOT READY TInt err = iScsiProtocol.MsTestUnitReadyL(); return (err == KErrNone) ? EEvCommandPassed : EEvCommandFailed; @@ -172,7 +169,6 @@ /** SCSI Request */ TMassStorage::TEvent TMassStorage::StartStopUnitL(TBool aStart) { - __MSFNLOG TInt err = iScsiProtocol.MsStartStopUnitL(aStart); return (err == KErrNone) ? EEvCommandPassed : EEvCommandFailed; } @@ -181,7 +177,6 @@ /** SCSI Request */ TMassStorage::TEvent TMassStorage::PreventAllowMediumRemovalL(TBool aPrevent) { - __MSFNLOG // KErrCommandFailed indictates that device is NOT READY TInt err = iScsiProtocol.MsPreventAllowMediaRemovalL(aPrevent); return (err == KErrNone) ? EEvCommandPassed : EEvCommandFailed; @@ -191,7 +186,6 @@ /** SCSI Request */ TMassStorage::TEvent TMassStorage::ReadCapacityL() { - __MSFNLOG TInt err = iScsiProtocol.MsReadCapacityL(); return ErrToEvent(err); } @@ -200,7 +194,6 @@ /** SCSI Request */ TMassStorage::TEvent TMassStorage::ModeSense10L() { - __MSFNLOG TInt err = iScsiProtocol.MsModeSense10L(); return ErrToEvent(err); } @@ -209,7 +202,6 @@ /** SCSI Request */ TMassStorage::TEvent TMassStorage::ModeSense6L() { - __MSFNLOG TInt err = iScsiProtocol.MsModeSense6L(); return ErrToEvent(err); } @@ -225,18 +217,16 @@ */ CMassStorageFsm* CMassStorageFsm::NewL(CScsiProtocol& aScsiProtocol) { - __MSFNSLOG - CMassStorageFsm* r = new (ELeave) CMassStorageFsm(aScsiProtocol); + CMassStorageFsm* r = new (ELeave) CMassStorageFsm(aScsiProtocol); - CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; } void CMassStorageFsm::ConstructL() { - __MSFNLOG TInt i = 0; // EInquiryState, iStateTable[i++] = new (ELeave) TInquiryState; @@ -291,13 +281,10 @@ : TMassStorage(aScsiProtocol), iStartStopUnitRequired(EFalse) { - __MSFNLOG } CMassStorageFsm::~CMassStorageFsm() { - __MSFNLOG - for (TInt i = 0; i < iStateTable.Count(); i++) { delete iStateTable[i]; @@ -307,8 +294,6 @@ TMassStorage::TEvent CMassStorageFsm::EntryL() { - __MSFNLOG - return iState->EntryL(*this); } @@ -320,8 +305,8 @@ */ TInt CMassStorageFsm::ConnectLogicalUnitL() { - __MSFNLOG - __HOSTPRINT(_L("CMassStorageFsm::ConnectLogicalUnitL()")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CMASSSTORAGEFSM_14, + "Connect Logical Unit"); TInt err = KErrNone; for (;;) { @@ -340,8 +325,8 @@ */ TInt CMassStorageFsm::DisconnectLogicalUnitL() { - __MSFNLOG - __HOSTPRINT(_L("CMassStorageFsm::DisconnectLogicalUnitL()")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CMASSSTORAGEFSM_15, + "Disconnect Logical Unit"); TInt err = KErrNone; for (;;) { @@ -360,24 +345,24 @@ */ TBool CMassStorageFsm::IsConnected() const { - __MSFNSLOG return iState->iStateId == TMassStorageState::EConnectedState ? ETrue : EFalse; } TInt CMassStorageFsm::ProcessStateL() { - __MSFNLOG TMassStorage::TEvent event = TMassStorage::EEvCommandFailed; TRAPD(err, event = EntryL()); if (err == KErrNotSupported) { - __HOSTPRINT(_L("FSM ProcessState returning with KErrNotSupported")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CMASSSTORAGEFSM_16, + "FSM ProcessState returning with KErrNotSupported"); return KErrNotSupported; } User::LeaveIfError(err); - __HOSTPRINT1(_L("FSM event=%d"), event); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CMASSSTORAGEFSM_17, + "FSM event=%d", event); switch (event) { case TMassStorage::EEvCommandPassed: @@ -394,28 +379,26 @@ break; } - __HOSTPRINT1(_L("FSM ProcessState completed=%d"), err); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CMASSSTORAGEFSM_18, + "FSM ProcessState completed=%d", err); return err; } TInt CMassStorageFsm::ScsiCommandPassed() { - __MSFNLOG return iState->ScsiCommandPassed(*this); } TInt CMassStorageFsm::ScsiCommandFailed() { - __MSFNLOG return iState->ScsiCommandFailed(*this); } TInt CMassStorageFsm::ScsiCommandError() { - __MSFNLOG return iState->ScsiCommandError(*this); } @@ -428,16 +411,15 @@ TMassStorageState::TMassStorageState(TStateId aStateId) : iStateId(aStateId) { - __MSFNLOG } -/** - Default state does nothing. Used by states where the stalled event is not - applicable - +/** + Default state does nothing. Used by states where the stalled event is not + applicable + @param aFsm - + @return TInt */ TInt TMassStorageState::ScsiCommandError(CMassStorageFsm& /* aFsm */) @@ -448,7 +430,6 @@ TInt TMassStorageState::SenseError(CMassStorageFsm& aFsm) { - __MSFNLOG TInt ret = KErrNone; const TSenseInfo& senseInfo = aFsm.MsSenseInfo(); @@ -471,20 +452,17 @@ TInquiryState::TInquiryState() : TMassStorageState(EInquiryState) { - __MSFNLOG } TMassStorage::TEvent TInquiryState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.InquiryL(); }; TInt TInquiryState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(ENotReadyState); return KErrNone; }; @@ -492,7 +470,6 @@ TInt TInquiryState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EInquirySenseState); return KErrNone; } @@ -504,20 +481,17 @@ TInquirySenseState::TInquirySenseState() : TMassStorageState(EInquirySenseState) { - __MSFNLOG } TMassStorage::TEvent TInquirySenseState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.SenseL(); }; TInt TInquirySenseState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG // SENSE ERROR aFsm.SetState(TMassStorageState::EInquiryState); return KErrCompletion; @@ -526,7 +500,6 @@ TInt TInquirySenseState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::EInquiryState); return KErrCompletion; } @@ -538,20 +511,17 @@ TNotReadyState::TNotReadyState() : TMassStorageState(ENotReadyState) { - __MSFNLOG } TMassStorage::TEvent TNotReadyState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.TestUnitReadyL(); } TInt TNotReadyState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG if (aFsm.IsSbcSet()) { if (aFsm.IsRemovableMedia()) @@ -561,17 +531,17 @@ } else { - __HOSTPRINT(_L("SBC is not set !!")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CMASSSTORAGEFSM_19, + "SBC is not set !!"); aFsm.SetState(TMassStorageState::EReadCapacityState); } - + return KErrNone; } TInt TNotReadyState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::ENotReadySenseState); return KErrNone; } @@ -583,20 +553,17 @@ TNotReadySenseState::TNotReadySenseState() : TMassStorageState(ENotReadySenseState) { - __MSFNLOG } TMassStorage::TEvent TNotReadySenseState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.SenseL(); } TInt TNotReadySenseState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG const TSenseInfo& senseInfo = aFsm.MsSenseInfo(); TInt ret = KErrNone; @@ -618,7 +585,6 @@ TInt TNotReadySenseState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG return TMassStorageState::SenseError(aFsm); } @@ -629,20 +595,17 @@ TStartUnitState::TStartUnitState() : TMassStorageState(EPreventRemovalState) { - __MSFNLOG } TMassStorage::TEvent TStartUnitState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.StartStopUnitL(ETrue); } TInt TStartUnitState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG if (aFsm.IsRemovableMedia()) aFsm.SetState(TMassStorageState::EPreventRemovalState); else @@ -653,7 +616,6 @@ TInt TStartUnitState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::EPreventRemovalSenseState); return KErrNone; } @@ -664,20 +626,17 @@ TStartUnitSenseState::TStartUnitSenseState() : TMassStorageState(EPreventRemovalSenseState) { - __MSFNLOG } TMassStorage::TEvent TStartUnitSenseState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.SenseL(); } TInt TStartUnitSenseState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG if (aFsm.IsRemovableMedia()) aFsm.SetState(TMassStorageState::EPreventRemovalState); else @@ -689,7 +648,6 @@ TInt TStartUnitSenseState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG TInt ret = KErrCompletion; const TSenseInfo& senseInfo = aFsm.MsSenseInfo(); @@ -714,20 +672,17 @@ TPreventMediumRemovalState::TPreventMediumRemovalState() : TMassStorageState(EPreventRemovalState) { - __MSFNLOG } TMassStorage::TEvent TPreventMediumRemovalState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.PreventAllowMediumRemovalL(ETrue); } TInt TPreventMediumRemovalState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::EReadCapacityState); return KErrNone; } @@ -735,7 +690,6 @@ TInt TPreventMediumRemovalState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::EPreventRemovalSenseState); return KErrNone; } @@ -746,20 +700,17 @@ TPreventMediumRemovalSenseState::TPreventMediumRemovalSenseState() : TMassStorageState(EPreventRemovalSenseState) { - __MSFNLOG } TMassStorage::TEvent TPreventMediumRemovalSenseState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.SenseL(); } TInt TPreventMediumRemovalSenseState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::EReadCapacityState); return KErrNone; } @@ -769,7 +720,6 @@ TInt TPreventMediumRemovalSenseState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG TInt ret = KErrCompletion; const TSenseInfo& senseInfo = aFsm.MsSenseInfo(); @@ -792,20 +742,17 @@ TReadCapacity10State::TReadCapacity10State() : TMassStorageState(EReadCapacityState) { - __MSFNLOG } TMassStorage::TEvent TReadCapacity10State::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.ReadCapacityL(); }; TInt TReadCapacity10State::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EModeSense10State); return KErrNone; }; @@ -813,7 +760,6 @@ TInt TReadCapacity10State::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::ESenseState); return KErrCompletion; } @@ -821,7 +767,6 @@ TInt TReadCapacity10State::ScsiCommandError(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::ENotReadyState); return KErrCompletion; } @@ -833,20 +778,17 @@ TModeSense10State::TModeSense10State() : TMassStorageState(EModeSense10State) { - __MSFNLOG } TMassStorage::TEvent TModeSense10State::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.ModeSense10L(); }; TInt TModeSense10State::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EConnectedState); return KErrCompletion; }; @@ -854,7 +796,6 @@ TInt TModeSense10State::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EModeSense10SenseState); return KErrNone; } @@ -862,7 +803,6 @@ TInt TModeSense10State::ScsiCommandError(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EModeSense6State); return KErrNone; } @@ -873,20 +813,17 @@ TModeSense10SenseState::TModeSense10SenseState() : TMassStorageState(EModeSense10SenseState) { - __MSFNLOG } TMassStorage::TEvent TModeSense10SenseState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.SenseL(); }; TInt TModeSense10SenseState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG TInt ret = KErrCompletion; const TSenseInfo& senseInfo = aFsm.MsSenseInfo(); @@ -906,7 +843,6 @@ TInt TModeSense10SenseState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EInquirySenseState); return KErrCompletion; } @@ -917,20 +853,17 @@ TModeSense6State::TModeSense6State() : TMassStorageState(EModeSense6State) { - __MSFNLOG } TMassStorage::TEvent TModeSense6State::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.ModeSense6L(); }; TInt TModeSense6State::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EConnectedState); return KErrCompletion; }; @@ -938,7 +871,6 @@ TInt TModeSense6State::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EModeSense6SenseState); return KErrNone; } @@ -946,7 +878,6 @@ TInt TModeSense6State::ScsiCommandError(CMassStorageFsm& aFsm) { - __MSFNLOG // If device responds with protocol error, ignore the error and assume the // device is not write protected aFsm.SetState(EConnectedState); @@ -960,20 +891,17 @@ TModeSense6SenseState::TModeSense6SenseState() : TMassStorageState(EModeSense6SenseState) { - __MSFNLOG } TMassStorage::TEvent TModeSense6SenseState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.SenseL(); }; TInt TModeSense6SenseState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG TInt ret = KErrCompletion; const TSenseInfo& senseInfo = aFsm.MsSenseInfo(); @@ -992,7 +920,6 @@ TInt TModeSense6SenseState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EInquirySenseState); return KErrCompletion; } @@ -1005,29 +932,26 @@ TConnectedState::TConnectedState() : TMassStorageState(EConnectedState) { - __MSFNLOG } TMassStorage::TEvent TConnectedState::EntryL(CMassStorageFsm& /* aFsm */) { - __MSFNLOG return TMassStorage::EEvCommandPassed; }; TInt TConnectedState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG TInt ret = KErrNone; if (aFsm.IsRemovableMedia()) { - if(aFsm.IsStatusCheck()) - { - aFsm.SetState(TMassStorageState::EStatusCheckState); - } - else + if(aFsm.IsStatusCheck()) + { + aFsm.SetState(TMassStorageState::EStatusCheckState); + } + else { aFsm.SetState(TMassStorageState::EAllowRemovalState); } @@ -1038,8 +962,8 @@ } else { - aFsm.SetState(TMassStorageState::ENotReadyState); - ret = KErrCompletion; + aFsm.SetState(TMassStorageState::ENotReadyState); + ret = KErrCompletion; } return ret; }; @@ -1047,7 +971,6 @@ TInt TConnectedState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::EInquiryState); return KErrCompletion; } @@ -1059,20 +982,17 @@ TStatusCheckState::TStatusCheckState() : TMassStorageState(EStatusCheckState) { - __MSFNLOG } TMassStorage::TEvent TStatusCheckState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.TestUnitReadyL(); }; TInt TStatusCheckState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(EConnectedState); return KErrCompletion; }; @@ -1080,8 +1000,7 @@ TInt TStatusCheckState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG - aFsm.SetState(ESenseState); + aFsm.SetState(ESenseState); return KErrNone; } @@ -1092,20 +1011,17 @@ TAllowMediumRemovalState::TAllowMediumRemovalState() : TMassStorageState(EAllowRemovalState) { - __MSFNLOG } TMassStorage::TEvent TAllowMediumRemovalState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.PreventAllowMediumRemovalL(EFalse); } TInt TAllowMediumRemovalState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG TInt ret = KErrNone; if (aFsm.StartStopUnitRequired()) { @@ -1122,7 +1038,6 @@ TInt TAllowMediumRemovalState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::EInquiryState); return KErrCompletion; } @@ -1134,20 +1049,17 @@ TStopUnitState::TStopUnitState() : TMassStorageState(EStopUnitState) { - __MSFNLOG } TMassStorage::TEvent TStopUnitState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.StartStopUnitL(EFalse); } TInt TStopUnitState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(ENotReadyState); return KErrCompletion; }; @@ -1155,7 +1067,6 @@ TInt TStopUnitState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(TMassStorageState::EInquiryState); return KErrCompletion; } @@ -1167,20 +1078,17 @@ TSenseState::TSenseState() : TMassStorageState(EConnectedState) { - __MSFNLOG } TMassStorage::TEvent TSenseState::EntryL(CMassStorageFsm& aFsm) { - __MSFNLOG return aFsm.SenseL(); }; TInt TSenseState::ScsiCommandPassed(CMassStorageFsm& aFsm) { - __MSFNLOG aFsm.SetState(ENotReadyState); return KErrCompletion; }; @@ -1188,7 +1096,6 @@ TInt TSenseState::ScsiCommandFailed(CMassStorageFsm& aFsm) { - __MSFNLOG // This event should not happen aFsm.SetState(EInquiryState); return KErrCompletion; diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -20,8 +20,11 @@ #include -#include "debug.h" -#include "msdebug.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cscsiprotocolTraces.h" +#endif + #include "msctypes.h" #include "shared.h" #include "msgservice.h" @@ -53,19 +56,17 @@ */ CScsiProtocol* CScsiProtocol::NewL(TLun aLun, MTransport& aTransport) { - __MSFNSLOG - CScsiProtocol* r = new (ELeave) CScsiProtocol(aTransport); + CScsiProtocol* r = new (ELeave) CScsiProtocol(aTransport); - CleanupStack::PushL(r); - r->ConstructL(aLun); - CleanupStack::Pop(); - return r; + CleanupStack::PushL(r); + r->ConstructL(aLun); + CleanupStack::Pop(); + return r; } void CScsiProtocol::ConstructL(TLun aLun) { - __MSFNLOG - // iState = EEntry; + // iState = EEntry; iFsm = CMassStorageFsm::NewL(*this); const TInt blockLength = 0x200; @@ -79,13 +80,11 @@ : iSpcInterface(aTransport), iSbcInterface(NULL) { - __MSFNLOG } CScsiProtocol::~CScsiProtocol() { - __MSFNLOG delete iFsm; iHeadbuf.Close(); iTailbuf.Close(); @@ -95,11 +94,10 @@ void CScsiProtocol::InitialiseUnitL() { - __MSFNLOG iState = EDisconnected; - // A device may take time to mount the media. If the device fails attempt to - // retry the connection for a number of seconds + // A device may take time to mount the media. If the device fails attempt to + // retry the connection for a number of seconds TInt retryCounter = 20; do { @@ -117,43 +115,39 @@ User::After(1000 * 200); // 200 mS } while (retryCounter); - } + } void CScsiProtocol::UninitialiseUnitL() { - __MSFNLOG iFsm->DisconnectLogicalUnitL(); } TBool CScsiProtocol::IsConnected() { - __MSFNLOG - return (iState == EConnected)? ETrue : EFalse; + return (iState == EConnected)? ETrue : EFalse; } void CScsiProtocol::ReadL(TPos aPos, TDes8& aBuf, TInt aLength) { - __MSFNLOG if (!iSbcInterface) User::Leave(KErrNotSupported); if(!IsConnected()) - User::Leave(KErrNotReady); + User::Leave(KErrNotReady); iSbcInterface->iBlockTransfer.ReadL(*this, aPos, aLength, aBuf); } void CScsiProtocol::BlockReadL(TPos aPos, TDes8& aCopybuf, TInt aLen) { - __MSFNLOG if (!iSbcInterface) User::Leave(KErrNotSupported); - __ASSERT_DEBUG(aPos % iSbcInterface->iBlockTransfer.BlockLength() == 0, + __ASSERT_DEBUG(aPos % iSbcInterface->iBlockTransfer.BlockLength() == 0, User::Panic(KUsbMsHostPanicCat, EBlockDevice)); const TInt blockLen = iSbcInterface->iBlockTransfer.BlockLength(); @@ -166,18 +160,21 @@ User::LeaveIfError(KErrOverflow); } - TInt err = iSbcInterface->Read10L(I64LOW(lba), aCopybuf, len); + TInt err = iSbcInterface->Read10L(I64LOW(lba), aCopybuf, len); if (err) { - __SCSIPRINT1(_L("READ(10) Err=%d"), err); + OstTrace1(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_10, + "READ(10) Err=%d", err); User::LeaveIfError(DoCheckConditionL()); } // handle residue while (len != aLen) { - __SCSIPRINT2(_L("SCSI Read Residue 0x%x bytes read (0x%x)"), len, aLen); - __SCSIPRINT2(_L("Pos=0x%lx Len=0x%x"), aPos, aLen); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_11, + "SCSI Read Residue 0x%x bytes read (0x%x)", len, aLen); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_12, + "Pos=0x%lx Len=0x%x", aPos, aLen); // read next block @@ -187,8 +184,8 @@ aLen -= bytesRead; len = aLen; - __SCSIPRINT3(_L("New Pos=0x%lx Len=0x%x (bytes read = %x)"), - aPos, aLen, bytesRead); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_13, + "New Pos=0x%lx Len=0x%x (bytes read = %x)", aPos, aLen, bytesRead); aCopybuf.SetLength(bytesRead); @@ -206,27 +203,25 @@ TDesC8& aBuf, TInt aLength) { - __MSFNLOG if (!iSbcInterface) User::Leave(KErrNotSupported); if(!IsConnected()) - User::Leave(KErrNotReady); + User::Leave(KErrNotReady); iSbcInterface->iBlockTransfer.WriteL(*this, aPosition, aLength, aBuf); } void CScsiProtocol::BlockWriteL(TPos aPos, TDesC8& aCopybuf, TUint aOffset, TInt aLen) { - __MSFNLOG if (!iSbcInterface) User::Leave(KErrNotSupported); - __ASSERT_DEBUG(aPos % iSbcInterface->iBlockTransfer.BlockLength() == 0, + __ASSERT_DEBUG(aPos % iSbcInterface->iBlockTransfer.BlockLength() == 0, User::Panic(KUsbMsHostPanicCat, EBlockDevice)); const TInt blockLen = iSbcInterface->iBlockTransfer.BlockLength(); TInt len = aLen; - TInt err = iSbcInterface->Write10L(aPos/blockLen, aCopybuf, aOffset, len); + TInt err = iSbcInterface->Write10L(aPos/blockLen, aCopybuf, aOffset, len); if (err) { User::LeaveIfError(DoCheckConditionL()); @@ -235,8 +230,10 @@ while (len != aLen) { // handle residue - __SCSIPRINT2(_L("SCSI Write Residue 0x%x bytes read (0x%x)"), len, aLen); - __SCSIPRINT2(_L("Pos=0x%lx Len=0x%x"), aPos, aLen); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_20, + "SCSI Write Residue 0x%x bytes read (0x%x)", len, aLen); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_21, + "Pos=0x%lx Len=0x%x", aPos, aLen); // write next block @@ -245,7 +242,8 @@ aPos += bytesWritten; aLen -= bytesWritten; len = aLen; - __SCSIPRINT2(_L("New Pos=0x%lx Len=0x%x"), aPos, aLen); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_22, + "New Pos=0x%lx Len=0x%x", aPos, aLen); TPtrC8 buf = aCopybuf.Mid(bytesWritten); @@ -261,7 +259,6 @@ void CScsiProtocol::GetCapacityL(TCapsInfo& aCapsInfo) { - __MSFNLOG if (!IsConnected()) { if (!DoScsiReadyCheckEventL()) @@ -279,8 +276,8 @@ aCapsInfo.iMediaType = EMediaHardDisk; - TLba lastLba; - TUint32 blockLength; + TLba lastLba; + TUint32 blockLength; // Retry ReadCapacity10L if stalled TInt stallCounter = 4; @@ -322,15 +319,16 @@ { User::LeaveIfError(err); } - } + } } aCapsInfo.iNumberOfBlocks = lastLba + 1; aCapsInfo.iBlockLength = blockLength; aCapsInfo.iWriteProtect = iWriteProtect; - __SCSIPRINT3(_L("numBlock = x%x , blockLength = %x wp = %d"), - lastLba + 1, blockLength, iWriteProtect); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_30, + "numBlock=x%x blockLength=x%x wp=%d", + (TUint32)(lastLba + 1), blockLength, (TInt32)iWriteProtect); } @@ -343,7 +341,6 @@ */ TInt CScsiProtocol::MsInquiryL() { - __MSFNLOG ResetSbc(); /** @@ -367,27 +364,39 @@ } // print reponse - __TESTREPORT1(_L("RMB = %d"), info.iRemovable); - __TESTREPORT2(_L("PERIPHERAL DEVICE TYPE = %d PQ = %d"), - info.iPeripheralDeviceType, - info.iPeripheralQualifier); - __TESTREPORT1(_L("VERSION = %d"), info.iVersion); - __TESTREPORT1(_L("RESPONSE DATA FORMAT = %d"), info.iResponseDataFormat); - __TESTREPORT3(_L("VENDOR ID %S PRODUCT ID %S REV %S"), - &info.iIdentification.iVendorId, - &info.iIdentification.iProductId, - &info.iIdentification.iProductRev); + OstTrace1(TRACE_SHOSTMASSSTORAGE_DEVICEREPORT, CSCSIPROTOCOL_40, + "RMB = %d", info.iRemovable); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_DEVICEREPORT, CSCSIPROTOCOL_41, + "PERIPHERAL DEVICE TYPE = %d PQ = %d", + info.iPeripheralDeviceType, + info.iPeripheralQualifier); + OstTrace1(TRACE_SHOSTMASSSTORAGE_DEVICEREPORT, CSCSIPROTOCOL_42, + "VERSION = %d", info.iVersion); + OstTrace1(TRACE_SHOSTMASSSTORAGE_DEVICEREPORT, CSCSIPROTOCOL_43, + "RESPONSE DATA FORMAT = %d", + info.iResponseDataFormat); + + OstTraceData(TRACE_SHOSTMASSSTORAGE_DEVICEREPORT, CSCSIPROTOCOL_440, + "VENDOR ID %s", + info.iIdentification.iVendorId.Ptr(), info.iIdentification.iVendorId.Size() * 2); + OstTraceData(TRACE_SHOSTMASSSTORAGE_DEVICEREPORT, CSCSIPROTOCOL_441, + "PRODUCT ID %s", + info.iIdentification.iProductId.Ptr(), info.iIdentification.iProductId.Size() * 2); + OstTraceData(TRACE_SHOSTMASSSTORAGE_DEVICEREPORT, CSCSIPROTOCOL_442, + "REV %s", + info.iIdentification.iProductRev.Ptr(), info.iIdentification.iProductRev.Size() * 2); if (info.iPeripheralQualifier != 0 && info.iPeripheralQualifier != 1) { - __HOSTPRINT(_L("Peripheral Qualifier[Unknown device type]")) + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CSCSIPROTOCOL_45, + "Peripheral Qualifier[Unknown device type]"); err = KErrUnknown; } else if (info.iPeripheralDeviceType == 0) { // SCSI SBC Direct access device iRemovableMedia = info.iRemovable; - + // SCSI Block device iSbcInterface = new (ELeave) TSbcClientInterface(iSpcInterface.Transport()); iSbcInterface->InitBuffers(&iHeadbuf, &iTailbuf); @@ -396,10 +405,11 @@ else if (info.iPeripheralDeviceType == 5) { // SCSI MMC-2 CD-ROM device - __HOSTPRINT(_L("Peripheral Device Type[CD-ROM]")) + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CSCSIPROTOCOL_46, + "Peripheral Device Type[CD-ROM]"); iRemovableMedia = info.iRemovable; - // MMC-2 is not supported. A SCSI interface call will return + // MMC-2 is not supported. A SCSI interface call will return // KErrNotSupported. If SCSI support is extended in future then // TSbcInterface class should be replaced with a proper interface class. iSbcInterface = NULL; @@ -407,8 +417,9 @@ } else { - __HOSTPRINT(_L("Peripheral Device Type[Unsupported device type]")) - err = KErrUnknown; + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CSCSIPROTOCOL_47, + "Peripheral Device Type[Unsupported device type]"); + err = KErrUnknown; } return err; @@ -424,7 +435,6 @@ */ TInt CScsiProtocol::MsTestUnitReadyL() { - __MSFNLOG /* TestUnitReady */ return iSpcInterface.TestUnitReadyL(); } @@ -443,7 +453,6 @@ */ TInt CScsiProtocol::MsReadCapacityL() { - __MSFNLOG if (!iSbcInterface) { User::Leave(KErrNotSupported); @@ -454,7 +463,8 @@ TUint32 lastLba; TInt err = iSbcInterface->ReadCapacity10L(lastLba, blockSize); - __TESTREPORT2(_L("CAPACITY: Block Size=0x%x Last LBA=0x%x"), blockSize, lastLba); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_DEVICEREPORT, CSCSIPROTOCOL_50, + "CAPACITY: Block Size=0x%x Last LBA=0x%x", blockSize, lastLba); return err; } @@ -468,7 +478,6 @@ */ TInt CScsiProtocol::MsModeSense10L() { - __MSFNLOG if (!iSbcInterface) User::Leave(KErrNotSupported); @@ -492,7 +501,6 @@ */ TInt CScsiProtocol::MsModeSense6L() { - __MSFNLOG if (!iSbcInterface) User::Leave(KErrNotSupported); @@ -516,7 +524,6 @@ */ TInt CScsiProtocol::MsStartStopUnitL(TBool aStart) { - __MSFNLOG if (!iSbcInterface) User::Leave(KErrNotSupported); @@ -533,14 +540,12 @@ */ TInt CScsiProtocol::MsPreventAllowMediaRemovalL(TBool aPrevent) { - __MSFNLOG return iSpcInterface.PreventAllowMediumRemovalL(aPrevent); } TInt CScsiProtocol::DoCheckConditionL() { - __MSFNLOG User::LeaveIfError(MsRequestSenseL()); TInt err; @@ -550,15 +555,15 @@ iSenseInfo.iAdditional == TSenseInfo::EAscLogicalUnitNotReady && iSenseInfo.iQualifier == TSenseInfo::EAscqInitializingCommandRequired) { - if (iSbcInterface) - { - // start unit - err = iSbcInterface->StartStopUnitL(ETrue); - if (err) - { - User::LeaveIfError(MsRequestSenseL()); - } - } + if (iSbcInterface) + { + // start unit + err = iSbcInterface->StartStopUnitL(ETrue); + if (err) + { + User::LeaveIfError(MsRequestSenseL()); + } + } } err = GetSystemWideSenseError(iSenseInfo); @@ -582,7 +587,7 @@ iMediaChangeNotifier.DoNotifyL(); iState = nextState; } - + return err; } @@ -630,99 +635,97 @@ extension will be notified setting the iChanged flag */ TInt CScsiProtocol::GetSystemWideSenseError(const TSenseInfo& aSenseInfo) - { - __MSFNLOG - TInt ret = KErrNone; - TInt additionalError = KErrNone; + { + TInt ret = KErrNone; + TInt additionalError = KErrNone; - switch(aSenseInfo.iSenseCode) - { - case TSenseInfo::ENoSense: - case TSenseInfo::ERecoveredError: - ret = KErrNone; - break; - case TSenseInfo::ENotReady: + switch(aSenseInfo.iSenseCode) + { + case TSenseInfo::ENoSense: + case TSenseInfo::ERecoveredError: + ret = KErrNone; + break; + case TSenseInfo::ENotReady: ret = KErrNotReady; - additionalError = ProcessAsCodes(aSenseInfo); + additionalError = ProcessAsCodes(aSenseInfo); if (additionalError != KErrNone) { ret = additionalError; } - break; - case TSenseInfo::EMediumError: - ret = KErrCorrupt; - additionalError = ProcessAsCodes(aSenseInfo); + break; + case TSenseInfo::EMediumError: + ret = KErrCorrupt; + additionalError = ProcessAsCodes(aSenseInfo); if (additionalError != KErrNone) { ret = additionalError; } - break; - case TSenseInfo::EUnitAttention: - ret = KErrDisconnected; - break; - case TSenseInfo::EDataProtection: - ret = KErrAccessDenied; - break; - case TSenseInfo::EIllegalRequest: - case TSenseInfo::EHardwareError: - case TSenseInfo::EBlankCheck: - case TSenseInfo::EVendorSpecific: - case TSenseInfo::EMisCompare: - ret = KErrUnknown; - break; - case TSenseInfo::ECopyAborted: - case TSenseInfo::EAbortedCommand: - ret = KErrAbort; - break; - case TSenseInfo::EDataOverflow: - ret = KErrOverflow; - break; - default: - ret = KErrUnknown; - break; - } + break; + case TSenseInfo::EUnitAttention: + ret = KErrDisconnected; + break; + case TSenseInfo::EDataProtection: + ret = KErrAccessDenied; + break; + case TSenseInfo::EIllegalRequest: + case TSenseInfo::EHardwareError: + case TSenseInfo::EBlankCheck: + case TSenseInfo::EVendorSpecific: + case TSenseInfo::EMisCompare: + ret = KErrUnknown; + break; + case TSenseInfo::ECopyAborted: + case TSenseInfo::EAbortedCommand: + ret = KErrAbort; + break; + case TSenseInfo::EDataOverflow: + ret = KErrOverflow; + break; + default: + ret = KErrUnknown; + break; + } - return ret; - } + return ret; + } TInt CScsiProtocol::ProcessAsCodes(const TSenseInfo& aSenseInfo) { - __MSFNLOG - TInt ret = KErrNone; + TInt ret = KErrNone; - switch(aSenseInfo.iAdditional) - { + switch(aSenseInfo.iAdditional) + { case TSenseInfo::EAscLogicalUnitNotReady: - case TSenseInfo::EMediaNotPresent: + case TSenseInfo::EMediaNotPresent: ret = KErrNotReady; - break; + break; + + case TSenseInfo::ELbaOutOfRange: + ret = KErrOverflow; + break; - case TSenseInfo::ELbaOutOfRange: - ret = KErrOverflow; - break; - - case TSenseInfo::EWriteProtected: - ret = KErrAccessDenied; - break; + case TSenseInfo::EWriteProtected: + ret = KErrAccessDenied; + break; - case TSenseInfo::ENotReadyToReadyChange: - ret = KErrNone; - break; + case TSenseInfo::ENotReadyToReadyChange: + ret = KErrNone; + break; - case TSenseInfo::EAscLogicalUnitDoesNotRespondToSelection: - case TSenseInfo::EInvalidCmdCode: - case TSenseInfo::EInvalidFieldInCdb: - case TSenseInfo::ELuNotSupported: + case TSenseInfo::EAscLogicalUnitDoesNotRespondToSelection: + case TSenseInfo::EInvalidCmdCode: + case TSenseInfo::EInvalidFieldInCdb: + case TSenseInfo::ELuNotSupported: case TSenseInfo::EInsufficientRes: ret = KErrUnknown; break; - default: - ret = KErrNone; - break; - } - return ret; - } + default: + ret = KErrNone; + break; + } + return ret; + } /** @@ -734,14 +737,12 @@ */ TInt CScsiProtocol::MsRequestSenseL() { - __MSFNLOG return iSpcInterface.RequestSenseL(iSenseInfo) ? KErrCommandFailed : KErrNone; - } + } void CScsiProtocol::CreateSbcInterfaceL(TUint32 aBlockLen, TUint32 aLastLba) { - __MSFNLOG // SCSI Block device ASSERT(iSbcInterface == NULL); iSbcInterface = new (ELeave) TSbcClientInterface(iSpcInterface.Transport()); @@ -752,7 +753,6 @@ void CScsiProtocol::ResetSbc() { - __MSFNLOG if (iSbcInterface) { delete iSbcInterface; @@ -762,92 +762,86 @@ void CScsiProtocol::NotifyChange(const RMessage2& aMessage) - { - __MSFNLOG + { iMediaChangeNotifier.Register(aMessage); - } + } void CScsiProtocol::ForceCompleteNotifyChangeL() - { - __MSFNLOG + { iMediaChangeNotifier.DoNotifyL(); - } + } void CScsiProtocol::CancelChangeNotifierL() - { - __MSFNLOG + { iMediaChangeNotifier.DoCancelL(); - } + } void CScsiProtocol::SuspendL() - { - __MSFNLOG + { if (iFsm->StartStopUnitRequired()) { iSbcInterface->StartStopUnitL(EFalse); } - } + } void CScsiProtocol::ResumeL() - { - __MSFNLOG + { if (iFsm->StartStopUnitRequired()) { iSbcInterface->StartStopUnitL(ETrue); } - } + } TBool CScsiProtocol::DoScsiReadyCheckEventL() - { - __MSFNLOG - TInt err = KErrNone; + { + TInt err = KErrNone; - if(iRemovableMedia || iState != EConnected) + if(iRemovableMedia || iState != EConnected) { - iFsm->SetStatusCheck(); - TRAP(err, iFsm->ConnectLogicalUnitL()); - iFsm->ClearStatusCheck(); + iFsm->SetStatusCheck(); + TRAP(err, iFsm->ConnectLogicalUnitL()); + iFsm->ClearStatusCheck(); - User::LeaveIfError(err); - err = iFsm->IsConnected() ? KErrNone : KErrNotReady; + User::LeaveIfError(err); + err = iFsm->IsConnected() ? KErrNone : KErrNotReady; } - if (iState == EConnected) + if (iState == EConnected) { - if (err != KErrNone) - { - iState = EDisconnected; - __SCSIPRINT(_L("** Disconnected Notification **")); + if (err != KErrNone) + { + iState = EDisconnected; + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_60, + "** Disconnected Notification **"); iMediaChangeNotifier.DoNotifyL(); - } + } } - else + else { - if (err == KErrNone) - { - iState = EConnected; - __SCSIPRINT(_L("** Connected Notification **")); + if (err == KErrNone) + { + iState = EConnected; + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, CSCSIPROTOCOL_61, + "** Connected Notification **"); iMediaChangeNotifier.DoNotifyL(); - } + } } return err = KErrNone ? ETrue : EFalse; - } + } RMediaChangeNotifier::RMediaChangeNotifier() : iRegistered(EFalse) { - __MSFNSLOG } RMediaChangeNotifier::~RMediaChangeNotifier() { - __MSFNSLOG if (iRegistered) iNotifier.Complete(KErrDisconnected); } @@ -859,33 +853,29 @@ */ void RMediaChangeNotifier::Register(const RMessage2& aMessage) { - __MSFNLOG - iRegistered = ETrue; - iNotifier = aMessage; + iRegistered = ETrue; + iNotifier = aMessage; } void RMediaChangeNotifier::DoNotifyL() { - __MSFNLOG - CompleteNotifierL(KErrNone); + CompleteNotifierL(KErrNone); } void RMediaChangeNotifier::DoCancelL() { - __MSFNLOG - CompleteNotifierL(KErrCancel); + CompleteNotifierL(KErrCancel); } void RMediaChangeNotifier::CompleteNotifierL(TInt aReason) - { - __MSFNLOG - if (iRegistered) + { + if (iRegistered) { - TBool mediaChanged = ETrue; - TPtrC8 pStatus((TUint8*)&mediaChanged,sizeof(TBool)); - iNotifier.WriteL(0,pStatus); - iNotifier.Complete(aReason); - iRegistered = EFalse; + TBool mediaChanged = ETrue; + TPtrC8 pStatus((TUint8*)&mediaChanged,sizeof(TBool)); + iNotifier.WriteL(0,pStatus); + iNotifier.Complete(aReason); + iRegistered = EFalse; } - } + } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/cmassstoragefsm.inl --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/cmassstoragefsm.inl Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/cmassstoragefsm.inl Tue Oct 26 12:49:20 2010 +0100 @@ -16,14 +16,13 @@ /** @file @internalTechnology - + Sets the StateId to be entered next time the FSM is called. - + @param aStateId The State ID */ inline void CMassStorageFsm::SetState(TMassStorageState::TStateId aStateId) { - __HOSTPRINT1(_L("CMassStorage::SetState[%d]"), aStateId); iState = iStateTable[aStateId]; } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiblockcmds.inl --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiblockcmds.inl Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiblockcmds.inl Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -12,15 +12,15 @@ // // Description: // scsiblockcommands.inl -// +// // /** @file @internalTechnology - + Constructor for SCSI MODE SENSE (6) request. - + @param aPageControl SCSI PAGE CONTROL field @param aPageCode SCSI PAGE CODE field @param aSubPageCode SCSI SUB PAGE CODE field @@ -40,7 +40,6 @@ inline TInt TScsiClientModeSense6Req::EncodeRequestL(TDes8& aBuffer) const { - __SCSIPRINT(_L("<-- SCSI MODE SENSE (6)")); TInt length = TScsiClientReq::EncodeRequestL(aBuffer); // PC @@ -65,7 +64,6 @@ iBlockTransferLength(0), iProtect(0) { - __MSFNSLOG } @@ -74,7 +72,6 @@ : TScsiClientRdWr10Req(ERead10) { - __MSFNSLOG } @@ -83,7 +80,6 @@ : TScsiClientReq(EReadCapacity10), iLba(0) { - __MSFNSLOG } @@ -96,7 +92,6 @@ : TScsiClientReq(EReadCapacity10), iLba(aLba) { - __MSFNSLOG } @@ -105,7 +100,6 @@ : TScsiClientRdWr10Req(EWrite10) { - __MSFNSLOG } @@ -117,6 +111,5 @@ iStart(EFalse), iLoej(EFalse) { - __MSFNSLOG } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiclientreq.inl --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiclientreq.inl Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiclientreq.inl Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -16,9 +16,9 @@ /** @file @internalTechnology - + Constructor initialised with the SCSI OPERATION CODE for this object. - + @param aOperationCode The SCSI OPERATION CODE of the request */ inline TScsiClientReq::TScsiClientReq(TOperationCode aOperationCode) @@ -27,12 +27,10 @@ iNaca(0), iLink(0) { - __MSFNSLOG } inline TUint8 TScsiClientReq::GetControlByte() const { - __MSFNSLOG TUint8 control = 0; if (iLink) @@ -48,7 +46,6 @@ inline TGroupCode TScsiClientReq::GetGroupCode() const { - __MSFNSLOG return iOperationCode >> 5; } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiprimarycmds.inl --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiprimarycmds.inl Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/include/tscsiprimarycmds.inl Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -12,7 +12,7 @@ // // Description: // scsiprimarycommands.inl -// +// // /** @@ -24,7 +24,6 @@ inline TScsiClientTestUnitReadyReq::TScsiClientTestUnitReadyReq() : TScsiClientReq(ETestUnitReady) { - __MSFNSLOG } @@ -33,7 +32,6 @@ : TScsiClientReq(ERequestSense), iAllocationLength(KResponseLength) { - __MSFNSLOG } @@ -44,15 +42,12 @@ */ inline void TScsiClientRequestSenseReq::SetAllocationLength(TAllocationLength aAllocationLength) { - __MSFNSLOG iAllocationLength = aAllocationLength; } inline TInt TScsiClientRequestSenseReq::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG - __SCSIPRINT(_L("<-- SCSI REQUEST SENSE")); TInt length = TScsiClientReq::EncodeRequestL(aBuffer); aBuffer[4] = iAllocationLength; @@ -67,7 +62,6 @@ iEvpd(EFalse), iAllocationLength(KResponseLength) { - __MSFNSLOG } @@ -78,7 +72,6 @@ */ inline void TScsiClientInquiryReq::SetAllocationLength(TAllocationLength aAllocationLength) { - __MSFNSLOG iAllocationLength = aAllocationLength; } @@ -90,7 +83,6 @@ */ inline void TScsiClientInquiryReq::SetEvpd(TUint8 aPageCode) { - __MSFNSLOG iEvpd = ETrue; iPage = aPageCode; } @@ -103,7 +95,6 @@ */ inline void TScsiClientInquiryReq::SetCmdDt(TUint8 aOperationCode) { - __MSFNSLOG iCmdDt = ETrue; iPage = aOperationCode; } @@ -111,8 +102,6 @@ inline TInt TScsiClientInquiryReq::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG - __SCSIPRINT(_L("<-- SCSI INQUIRY")); TInt length = TScsiClientReq::EncodeRequestL(aBuffer); if (iEvpd) @@ -151,7 +140,6 @@ : TScsiClientReq(EPreventMediaRemoval), iPrevent(aPrevent) { - __MSFNSLOG } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/tblocktransfer.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tblocktransfer.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tblocktransfer.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -25,8 +25,11 @@ #include "mblocktransferprotocol.h" #include "tblocktransfer.h" -#include "debug.h" -#include "msdebug.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tblocktransferTraces.h" +#endif /** @@ -42,48 +45,51 @@ TInt aLength, TDes8& aBuf) { - __MSFNLOG - __HOSTPRINT1(_L("blocklen = 0%lx"), iBlockLength); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_1, + "blocklen = 0%lx", iBlockLength); - TInt copylen = 0; + TInt copylen = 0; TInt headlen = 0; - aBuf.SetLength(0); + aBuf.SetLength(0); TPos headOffset = GetHeadBlockOffset(aPosition); - /**** READ10 HEAD ****/ - if (headOffset) + /**** READ10 HEAD ****/ + if (headOffset) { - TPos headpos = aPosition - headOffset; + TPos headpos = aPosition - headOffset; iHeadbuf->Zero(); - headlen = ((headOffset + aLength - 1) / iBlockLength) == 0 ? aLength : (iBlockLength - headOffset); + headlen = ((headOffset + aLength - 1) / iBlockLength) == 0 ? aLength : (iBlockLength - headOffset); - __HOSTPRINT2(_L("\tRead head pos = 0%lx length = 0%lx"), - headpos, iBlockLength); - aProtocol.BlockReadL(headpos, *iHeadbuf, iBlockLength); - aBuf.Append(iHeadbuf->Ptr() + headOffset, headlen); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_10, + "Read head pos = 0%x %x length = 0%lx", + I64HIGH(headpos), I64LOW(headpos), iBlockLength); + aProtocol.BlockReadL(headpos, *iHeadbuf, iBlockLength); + aBuf.Append(iHeadbuf->Ptr() + headOffset, headlen); } - /**** READ10 BODY ****/ + /**** READ10 BODY ****/ TInt blocksInMain = (aLength - headlen)/iBlockLength; - if (blocksInMain) + if (blocksInMain) { - copylen = blocksInMain * iBlockLength; - __HOSTPRINT2(_L("\tRead main pos = 0%lx length = 0x%x"), - aPosition+headlen, copylen); - aProtocol.BlockReadL(aPosition+headlen, (TDes8 &)aBuf, copylen); + copylen = blocksInMain * iBlockLength; + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_11, + "Read main pos = 0%x %x length = 0x%x", + I64HIGH(aPosition+headlen), I64LOW(aPosition+headlen), copylen); + aProtocol.BlockReadL(aPosition+headlen, (TDes8 &)aBuf, copylen); } - copylen += headlen; + copylen += headlen; - /**** READ10 TAIL ****/ + /**** READ10 TAIL ****/ TInt tailLen = aLength - copylen; - if ((tailLen) != 0) + if ((tailLen) != 0) { - __HOSTPRINT2(_L("\tRead tail pos = 0%lx length = 0%lx"), - aPosition+copylen, iBlockLength); - iTailbuf->Zero(); - aProtocol.BlockReadL(aPosition+copylen, *iTailbuf, iBlockLength); - aBuf.Append(iTailbuf->Ptr(), tailLen); + OstTraceExt4(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_12, + "Read tail pos = 0%x %x length = 0%x %x", + I64HIGH(aPosition+copylen), I64LOW(aPosition+copylen), I64HIGH(iBlockLength), I64LOW(iBlockLength)); + iTailbuf->Zero(); + aProtocol.BlockReadL(aPosition+copylen, *iTailbuf, iBlockLength); + aBuf.Append(iTailbuf->Ptr(), tailLen); } } @@ -101,71 +107,75 @@ TInt aLength, TDesC8& aBuf) { - __MSFNLOG - TInt copylen = 0; + TInt copylen = 0; TInt headlen = 0; TPos headOffset = GetHeadBlockOffset(aPosition); - /**** WRITE10 HEAD ****/ - if (headOffset) + /**** WRITE10 HEAD ****/ + if (headOffset) { - TPos headpos = aPosition - headOffset; + TPos headpos = aPosition - headOffset; iHeadbuf->Zero(); RBuf8& buf = *iTailbuf; buf.Zero(); - headlen = ((headOffset + aLength - 1) / iBlockLength) == 0 ? aLength : (iBlockLength - headOffset); + headlen = ((headOffset + aLength - 1) / iBlockLength) == 0 ? aLength : (iBlockLength - headOffset); - __HOSTPRINT2(_L("\tWrite-Read head pos = 0%lx length = 0%lx"), - headpos, iBlockLength); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_20, + "Write-Read head pos = 0%x %x length = 0%lx", + I64HIGH(headpos), I64LOW(headpos), iBlockLength); - aProtocol.BlockReadL(headpos, *iHeadbuf, iBlockLength); - /* get head */ - __HOSTPRINT2(_L("\tcopying read data pos = 0%lx offset = 0%lx"), - headpos, headOffset); - buf.Append(iHeadbuf->Ptr(), headOffset); + aProtocol.BlockReadL(headpos, *iHeadbuf, iBlockLength); + /* get head */ + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_21, + "tcopying read data pos = 0%x %x offset = 0%lx", + I64HIGH(headpos), I64LOW(headpos), headOffset); + buf.Append(iHeadbuf->Ptr(), headOffset); - /* get body */ - buf.Append(aBuf.Ptr(), headlen); + /* get body */ + buf.Append(aBuf.Ptr(), headlen); - /* Is it a short write and tail exist? */ + /* Is it a short write and tail exist? */ TInt headEndOffset = headOffset + headlen; - if (headEndOffset != iBlockLength) + if (headEndOffset != iBlockLength) { TInt len = iBlockLength - headEndOffset; - __HOSTPRINT2(_L("\t(short write) copying read data pos = 0%lx length = %08x"), - (headpos + headEndOffset), len); - buf.Append(iHeadbuf->Ptr() + headEndOffset, len); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_22, + "(short write) copying read data pos = 0%x %x length = %08x", + I64HIGH(headpos + headEndOffset), I64LOW(headpos + headEndOffset), len); + buf.Append(iHeadbuf->Ptr() + headEndOffset, len); } - __HOSTPRINT2(_L("\tWrite head pos = 0%lx length = %08x"), - headpos, headlen); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_23, + "Write head pos = 0%x %x length = %08x", + I64HIGH(headpos), I64LOW(headpos), headlen); - aProtocol.BlockWriteL(headpos, (TDes8 &)buf, 0, iBlockLength); + aProtocol.BlockWriteL(headpos, (TDes8 &)buf, 0, iBlockLength); } - /**** WRITE10 BODY ****/ + /**** WRITE10 BODY ****/ TPos blocksInMain = (aLength - headlen)/iBlockLength; - if (blocksInMain) + if (blocksInMain) { - copylen = blocksInMain * iBlockLength; + copylen = blocksInMain * iBlockLength; const TUint64 pos = aPosition + headlen; - __HOSTPRINT2(_L("\tWrite main pos = 0%lx length = %08x"), - pos, copylen); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_24, + "Write main pos = 0%x %x length = %08x", + I64HIGH(pos), I64LOW(pos), copylen); - /* form the body */ - aProtocol.BlockWriteL(pos, (TDes8 &)aBuf, headlen, copylen); + /* form the body */ + aProtocol.BlockWriteL(pos, (TDes8 &)aBuf, headlen, copylen); } - copylen += headlen; + copylen += headlen; - /**** WRITE10 TAIL ****/ + /**** WRITE10 TAIL ****/ TInt tailLen = aLength - copylen;; - if (tailLen != 0) + if (tailLen != 0) { RBuf8& buf = *iHeadbuf; buf.Zero(); @@ -174,23 +184,23 @@ const TUint64 pos = aPosition + copylen; - __HOSTPRINT2(_L("\tWrite-Read tail pos = 0%lx length = %08x"), - pos, iBlockLength); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, TBLOCKTRANSFER_25, + "Write-Read tail pos = 0%x %x length = %08x", + I64HIGH(pos), I64LOW(pos), iBlockLength); - aProtocol.BlockReadL(pos, *iTailbuf, iBlockLength); - /* get head */ - buf.Append(aBuf.Ptr() + copylen, tailLen); - /* get tail */ - buf.Append(iTailbuf->Ptr() + tailLen, iBlockLength - tailLen); + aProtocol.BlockReadL(pos, *iTailbuf, iBlockLength); + /* get head */ + buf.Append(aBuf.Ptr() + copylen, tailLen); + /* get tail */ + buf.Append(iTailbuf->Ptr() + tailLen, iBlockLength - tailLen); - aProtocol.BlockWriteL(pos, (TDes8 &)buf, 0, iBlockLength); + aProtocol.BlockWriteL(pos, (TDes8 &)buf, 0, iBlockLength); } } void TBlockTransfer::SetCapacityL(TUint32 aBlockLength, TLba aLastLba) { - __MSFNLOG iBlockLength = static_cast(aBlockLength); iLastLba = aLastLba; @@ -201,19 +211,17 @@ { iHeadbuf->ReAllocL(aBlockLength); iTailbuf->ReAllocL(aBlockLength); - } + } } TPos TBlockTransfer::GetHeadBlockOffset(TPos aPos) { - __MSFNLOG - return (aPos % iBlockLength); + return (aPos % iBlockLength); } TLba TBlockTransfer::GetHeadBlockLbaL(TPos aPos) { - __MSFNLOG TLba lba = I64LOW(aPos / iBlockLength); if (lba > iLastLba) User::Leave(KErrArgument); @@ -222,13 +230,11 @@ TPos TBlockTransfer::GetTailBlockOffset(TPos aPos, TInt aLen) { - __MSFNLOG return ((aPos + aLen) % iBlockLength); } TLba TBlockTransfer::GetTailBlockLbaL(TPos aPos, TInt aLen) { - __MSFNLOG TLba lba = I64LOW((aPos + aLen) / iBlockLength); if (lba > iLastLba) User::Leave(KErrArgument); diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/tsbcclientinterface.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tsbcclientinterface.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tsbcclientinterface.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -20,8 +20,11 @@ #include -#include "msdebug.h" -#include "debug.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tsbcclientinterfaceTraces.h" +#endif + #include "msctypes.h" #include "mtransport.h" @@ -34,6 +37,7 @@ #include "tscsiblockcmds.h" #include "tsbcclientinterface.h" + /** Constructor. @@ -42,13 +46,11 @@ TSbcClientInterface::TSbcClientInterface(MTransport& aTransport) : iTransport(aTransport) { - __MSFNLOG } TSbcClientInterface::~TSbcClientInterface() { - __MSFNLOG } @@ -65,22 +67,21 @@ */ TInt TSbcClientInterface::ModeSense6L(TUint aPageCode, TBool& aWriteProtected) { - __MSFNLOG TScsiClientModeSense6Req modeSense6Req(TScsiClientModeSense6Req::ECurrentValues, aPageCode); TScsiClientModeSense6Resp modeSense6Resp; TInt err = iTransport.SendControlCmdL(&modeSense6Req, &modeSense6Resp); if (!err) { - __SCSIPRINT1(_L("SCSI MODE SENSE (6) INFO WrProtect=%d"), - modeSense6Resp.iWriteProtected); + OstTrace1(TRACE_SHOSTMASSSTORAGE_SCSI, TSBCCLIENTINTERFACE_10, + "SCSI MODE SENSE (6) INFO WrProtect=%d", modeSense6Resp.iWriteProtected); aWriteProtected = modeSense6Resp.iWriteProtected; } else { aWriteProtected = EFalse; } - return err; + return err; } @@ -97,7 +98,6 @@ */ TInt TSbcClientInterface::ModeSense10L(TUint aPageCode, TBool& aWriteProtected) { - __MSFNLOG TScsiClientModeSense10Req modeSense10Req(TScsiClientModeSense10Req::ECurrentValues, aPageCode); TScsiClientModeSense10Resp modeSense10Resp; @@ -105,15 +105,15 @@ if (!err) { - __SCSIPRINT1(_L("SCSI MODE SENSE (10) INFO WrProtect=%d"), - modeSense10Resp.iWriteProtected); + OstTrace1(TRACE_SHOSTMASSSTORAGE_SCSI, TSBCCLIENTINTERFACE_11, + "SCSI MODE SENSE (10) INFO WrProtect=%d", modeSense10Resp.iWriteProtected); aWriteProtected = modeSense10Resp.iWriteProtected; } else { aWriteProtected = EFalse; } - return err; + return err; } @@ -134,14 +134,13 @@ iSubPageCode(aSubPageCode), iAllocationLength(KResponseLength) { - __MSFNLOG } TInt TScsiClientModeSense10Req::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG - __SCSIPRINT(_L("<-- SCSI MODE SENSE (10)")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSBCCLIENTINTERFACE_12, + "<-- SCSI MODE SENSE (10)"); TInt length = TScsiClientReq::EncodeRequestL(aBuffer); // PC @@ -171,8 +170,7 @@ */ TInt TSbcClientInterface::Read10L(TLba aLba, TDes8& aBuffer, TInt& aLen) { - __MSFNLOG - __ASSERT_DEBUG(iBlockTransfer.BlockLength(), User::Panic(KUsbMsHostPanicCat, EBlockLengthNotSet)); + __ASSERT_DEBUG(iBlockTransfer.BlockLength(), User::Panic(KUsbMsHostPanicCat, EBlockLengthNotSet)); __ASSERT_DEBUG(aLen % iBlockTransfer.BlockLength() == 0, User::Panic(KUsbMsHostPanicCat, EBlockDevice)); TScsiClientRead10Req read10Req; @@ -186,7 +184,7 @@ } read10Req.iBlockTransferLength = static_cast(blockTransferLength); TInt err = iTransport.SendDataRxCmdL(&read10Req, aBuffer, aLen); - return err; + return err; } /** @@ -203,7 +201,6 @@ */ TInt TSbcClientInterface::ReadCapacity10L(TLba& aLba, TUint32& aBlockSize) { - __MSFNLOG TScsiClientReadCapacity10Req capacity10Req; TScsiClientReadCapacity10Resp capacity10Resp; @@ -213,12 +210,12 @@ aLba = capacity10Resp.iLba; aBlockSize = capacity10Resp.iBlockSize; - __SCSIPRINT2(_L("Capacity LBA=0x%08x SIZE=0x%08x"), - aLba, aBlockSize); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, TSBCCLIENTINTERFACE__, + "Capacity LBA=0x%08x SIZE=0x%08x", aLba, aBlockSize); iBlockTransfer.SetCapacityL(aBlockSize, aLba); } - return err; + return err; } @@ -233,7 +230,6 @@ */ TInt TSbcClientInterface::StartStopUnitL(TBool aStart) { - __MSFNLOG TScsiClientStartStopUnitReq startStopUnitReq; startStopUnitReq.iImmed = ETrue; @@ -242,7 +238,7 @@ TInt err = iTransport.SendControlCmdL(&startStopUnitReq); - return err; + return err; } @@ -264,15 +260,14 @@ */ TInt TSbcClientInterface::Write10L(TLba aLba, TDesC8& aBuffer, TUint aPos, TInt& aLen) { - __MSFNLOG - __ASSERT_DEBUG(iBlockTransfer.BlockLength(), User::Panic(KUsbMsHostPanicCat, EBlockLengthNotSet)); + __ASSERT_DEBUG(iBlockTransfer.BlockLength(), User::Panic(KUsbMsHostPanicCat, EBlockLengthNotSet)); __ASSERT_DEBUG(aLen % iBlockTransfer.BlockLength() == 0, User::Panic(KUsbMsHostPanicCat, EBlockDevice)); // check that buffer size is large enough - if (aBuffer.Length() < (aPos + aLen)) - { + if (aBuffer.Length() < (aPos + aLen)) + { User::Leave(KErrArgument); - } + } TScsiClientWrite10Req write10Req; write10Req.iLogicalBlockAddress = aLba; @@ -285,6 +280,6 @@ write10Req.iBlockTransferLength = static_cast(blockTransferLength); TInt err = iTransport.SendDataTxCmdL(&write10Req, aBuffer, aPos, aLen); - return err; + return err; } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiblockcmds.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiblockcmds.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiblockcmds.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -19,8 +19,12 @@ */ #include -#include "debug.h" -#include "msdebug.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tscsiblockcmdsTraces.h" +#endif + #include "msctypes.h" #include "mscutils.h" @@ -30,12 +34,13 @@ #include "tscsiblockcmds.h" -// **** MODE SENSE (6) **** +// **** MODE SENSE (6) **** void TScsiClientModeSense6Resp::DecodeL(const TDesC8& aPtr) - { - __MSFNSLOG - __SCSIPRINT(_L("--> SCSI MODE SENSE (6)")); - __SCSIPRINT1(_L("len=%d"), aPtr.Length()); + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_10, + "--> SCSI MODE SENSE (6)"); + OstTrace1(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_11, + "len=%d", aPtr.Length()); // Mode Parameter List // SPC-3 7.4.2 // - Mode Parameter Header @@ -61,77 +66,13 @@ { User::Leave(KErrGeneral); } - + TInt mediumType = aPtr[1]; TUint8 deviceSpecificParameter = aPtr[2]; // TInt blockDescriptorLength = aPtr[3]; - __SCSIPRINT2(_L("Medium Type=%d DSP=0x%x"), mediumType, deviceSpecificParameter); - // [1] Medium Type - // 0x00 for SBC - if (mediumType == 0) - { - // [2] Device specific parameter - // SBC-3 6.3.1 - // get the WP bit from the Device Specific parameters - iWriteProtected = (deviceSpecificParameter & 0x80) ? ETrue : EFalse; - } - else - { - // unsupported medium type - iWriteProtected = EFalse; - } - - // [3] Block Descriptor Length - // 0x00 for no descriptors - - // No Block Descriptors - - // No Mode Pages - - } - - -// **** MODE SENSE (10) **** -void TScsiClientModeSense10Resp::DecodeL(const TDesC8& aPtr) - { - __MSFNSLOG - __SCSIPRINT(_L("--> SCSI MODE SENSE (10)")); - __SCSIPRINT1(_L("len=%d"), aPtr.Length()); - // Mode Parameter List - // SPC-3 7.4.2 - // - Mode Parameter Header - // - Block Descriptor(s) - // - Mode Page(s) - - // Mode Parameter Header - // SPC-3 7.4.3 - // [0] Mode Data Length - // [1] Mode Data Length - // [2] Medium Type - // [3] Device-Specific Paramater - // [4] Reserved - // [5] Reserved - // [6] Block Descriptor Length - // [7] Block Descriptor Length - - // validate length - if (aPtr.Length() < KResponseLength) - { - User::Leave(KErrGeneral); - } - - TInt modeDataLength = BigEndian::Get16(&aPtr[0]); - if (aPtr.Length() - 2 > modeDataLength) - { - User::Leave(KErrGeneral); - } - - TInt mediumType = aPtr[2]; - TUint8 deviceSpecificParameter = aPtr[3]; - // TInt blockDescriptorLength = BigEndian::Get32(&aPtr[6]);; - - __SCSIPRINT2(_L("Medium Type=%d DSP=0x%x"), mediumType, deviceSpecificParameter); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_20, + "Medium Type=%d DSP=0x%x", mediumType, deviceSpecificParameter); // [1] Medium Type // 0x00 for SBC if (mediumType == 0) @@ -154,15 +95,82 @@ // No Mode Pages - } + } + + +// **** MODE SENSE (10) **** +void TScsiClientModeSense10Resp::DecodeL(const TDesC8& aPtr) + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_30, + "--> SCSI MODE SENSE (10)"); + OstTrace1(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_31, + "len=%d", aPtr.Length()); + // Mode Parameter List + // SPC-3 7.4.2 + // - Mode Parameter Header + // - Block Descriptor(s) + // - Mode Page(s) + + // Mode Parameter Header + // SPC-3 7.4.3 + // [0] Mode Data Length + // [1] Mode Data Length + // [2] Medium Type + // [3] Device-Specific Paramater + // [4] Reserved + // [5] Reserved + // [6] Block Descriptor Length + // [7] Block Descriptor Length + + // validate length + if (aPtr.Length() < KResponseLength) + { + User::Leave(KErrGeneral); + } + + TInt modeDataLength = BigEndian::Get16(&aPtr[0]); + if (aPtr.Length() - 2 > modeDataLength) + { + User::Leave(KErrGeneral); + } + + TInt mediumType = aPtr[2]; + TUint8 deviceSpecificParameter = aPtr[3]; + // TInt blockDescriptorLength = BigEndian::Get32(&aPtr[6]);; + + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_40, + "Medium Type=%d DSP=0x%x", mediumType, deviceSpecificParameter); + // [1] Medium Type + // 0x00 for SBC + if (mediumType == 0) + { + // [2] Device specific parameter + // SBC-3 6.3.1 + // get the WP bit from the Device Specific parameters + iWriteProtected = (deviceSpecificParameter & 0x80) ? ETrue : EFalse; + } + else + { + // unsupported medium type + iWriteProtected = EFalse; + } + + // [3] Block Descriptor Length + // 0x00 for no descriptors + + // No Block Descriptors + + // No Mode Pages + + } -// **** READ CAPACITY (10) *** +// **** READ CAPACITY (10) *** TInt TScsiClientReadCapacity10Req::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG - __SCSIPRINT(_L("<-- READ CAPACITY 10")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_50, + "<-- READ CAPACITY 10"); TInt length = TScsiClientReq::EncodeRequestL(aBuffer); if (iLba) @@ -177,25 +185,25 @@ void TScsiClientReadCapacity10Resp::DecodeL(const TDesC8& aPtr) - { - __MSFNSLOG - __SCSIPRINT(_L("--> SCSI READ CAPACITY (10)")); + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_60, + "--> SCSI READ CAPACITY (10)"); iLba = BigEndian::Get32(&aPtr[0]); iBlockSize = BigEndian::Get32(&aPtr[4]); - } + } -// **** RdWr10 **** +// **** RdWr10 **** TInt TScsiClientRdWr10Req::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG TInt length = TScsiClientReq::EncodeRequestL(aBuffer); // PROTECT if (iProtect) aBuffer[1] = iProtect << 5; - __SCSIPRINT2(_L("LBA=%08x LEN=%08x"), iLogicalBlockAddress, iBlockTransferLength); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_70, + "LBA=%08x LEN=%08x", iLogicalBlockAddress, iBlockTransferLength); // LOGICAL BLOCK ADDRESS BigEndian::Put32(&aBuffer[2], iLogicalBlockAddress); // TRANSFER LENGTH @@ -203,21 +211,21 @@ return length; } -// **** READ (10) **** +// **** READ (10) **** TInt TScsiClientRead10Req::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG - __SCSIPRINT(_L("<-- SCSI READ (10)")); - TInt length = TScsiClientRdWr10Req::EncodeRequestL(aBuffer); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_80, + "<-- SCSI READ (10)"); + TInt length = TScsiClientRdWr10Req::EncodeRequestL(aBuffer); return length; } -// **** START STOP UNIT **** +// **** START STOP UNIT **** TInt TScsiClientStartStopUnitReq::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG - __SCSIPRINT(_L("--> SCSI START STOP UNIT")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_90, + "--> SCSI START STOP UNIT"); TInt length = TScsiClientReq::EncodeRequestL(aBuffer); // byte 1 mask @@ -237,11 +245,11 @@ } -// **** WRITE (10) **** +// **** WRITE (10) **** TInt TScsiClientWrite10Req::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG - __SCSIPRINT(_L("<-- SCSI WRITE 10")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIBLOCKCMDS_91, + "<-- SCSI WRITE 10"); TInt length = TScsiClientRdWr10Req::EncodeRequestL(aBuffer); return length; diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiclientreq.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiclientreq.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiclientreq.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -20,15 +20,12 @@ #include -#include "debug.h" -#include "msdebug.h" #include "mprotocol.h" #include "tscsiclientreq.h" TInt TScsiClientReq::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG TInt length = 0; switch (GetGroupCode()) { diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiprimarycmds.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiprimarycmds.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiprimarycmds.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -12,7 +12,7 @@ // // Description: // scsiprimarycmds.cpp -// +// // /** @@ -22,10 +22,13 @@ #include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tscsiprimarycmdsTraces.h" +#endif + + #include "msctypes.h" -#include "debug.h" -#include "msdebug.h" - #include "mtransport.h" #include "mprotocol.h" @@ -36,8 +39,8 @@ // **** TEST UNIT READY **** TInt TScsiClientTestUnitReadyReq::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG - __SCSIPRINT(_L("<-- SCSI TEST UNIT READY")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIPRIMARYCMDS_10, + "<-- SCSI TEST UNIT READY"); TInt length = TScsiClientReq::EncodeRequestL(aBuffer); return length; } @@ -46,7 +49,6 @@ // **** REQUEST SENSE **** void TScsiClientRequestSenseResp::DecodeSenseInfo(const TDesC8& aPtr) { - __MSFNSLOG iResponseCode = static_cast(aPtr[0]); iSenseInfo.iSenseCode = aPtr[02]; iSenseInfo.iAdditional = aPtr[12]; @@ -55,9 +57,9 @@ void TScsiClientRequestSenseResp::DecodeL(const TDesC8& aPtr) - { - __MSFNSLOG - __SCSIPRINT(_L("--> SCSI REQUEST SENSE")); + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIPRIMARYCMDS_11, + "--> SCSI REQUEST SENSE"); if (aPtr.Length() < KResponseLength) { // Handle short data. @@ -77,13 +79,12 @@ { DecodeSenseInfo(aPtr); } - } + } // **** INQUIRY **** void TScsiClientInquiryResp::DecodeInquiry(const TDesC8& aPtr) { - __MSFNSLOG iPeripheralInfo.iRemovable = (aPtr[1] & 0x80) ? ETrue : EFalse; iPeripheralInfo.iPeripheralQualifier = aPtr[0] >> 5; @@ -103,9 +104,9 @@ void TScsiClientInquiryResp::DecodeL(const TDesC8& aPtr) - { - __MSFNSLOG - __SCSIPRINT(_L("--> SCSI INQUIRY")); + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIPRIMARYCMDS_12, + "--> SCSI INQUIRY"); if (aPtr.Length() < KResponseLength) { // Handle short data. @@ -125,16 +126,16 @@ { DecodeInquiry(aPtr); } - } + } -// **** PREVENT MEDIA REMOVAL **** +// **** PREVENT MEDIA REMOVAL **** TInt TScsiClientPreventMediaRemovalReq::EncodeRequestL(TDes8& aBuffer) const { - __MSFNSLOG - __SCSIPRINT(_L("<-- SCSI PREVENT MEDIA REMOVAL")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_SCSI, TSCSIPRIMARYCMDS_13, + "<-- SCSI PREVENT MEDIA REMOVAL"); TInt length = TScsiClientReq::EncodeRequestL(aBuffer); - if (iPrevent) + if (iPrevent) aBuffer[4] |= 0x01; return length; } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/protocol/tspcclientinterface.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tspcclientinterface.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tspcclientinterface.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -19,8 +19,11 @@ */ #include -#include "debug.h" -#include "msdebug.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tspcclientinterfaceTraces.h" +#endif #include "msctypes.h" #include "mtransport.h" @@ -40,7 +43,6 @@ TSpcClientInterface::TSpcClientInterface(MTransport& aTransport) : iTransport(aTransport) { - __MSFNLOG } /** @@ -48,7 +50,6 @@ */ TSpcClientInterface::~TSpcClientInterface() { - __MSFNLOG } /** @@ -63,13 +64,12 @@ */ TInt TSpcClientInterface::InquiryL(TPeripheralInfo& aInfo) { - __MSFNLOG TScsiClientInquiryReq inquiryReq; TScsiClientInquiryResp inquiryResp(aInfo); TInt err = iTransport.SendControlCmdL(&inquiryReq, &inquiryResp); - return err; + return err; } @@ -85,17 +85,19 @@ */ TInt TSpcClientInterface::RequestSenseL(TSenseInfo& aSenseInfo) { - __MSFNLOG TScsiClientRequestSenseReq requestSenseReq; TScsiClientRequestSenseResp requestSenseResp; TInt err = iTransport.SendControlCmdL(&requestSenseReq, &requestSenseResp); aSenseInfo = requestSenseResp.iSenseInfo; - __SCSIPRINT4(_L("SCSI SENSE INFO Response%08x Code=%08x, Qual=%08x Add=%08x"), - requestSenseResp.iResponseCode, - aSenseInfo.iSenseCode, aSenseInfo.iQualifier, aSenseInfo.iAdditional); - return err; + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, TSPCCLIENTINTERFACE_10, + "SCSI SENSE INFO Response %x Code=%x", + (TUint32)requestSenseResp.iResponseCode, (TUint32)aSenseInfo.iSenseCode); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_SCSI, TSPCCLIENTINTERFACE_11, + " Qual=%08x Add=%08x", + (TUint32)aSenseInfo.iQualifier, (TUint32)aSenseInfo.iAdditional); + return err; } @@ -109,11 +111,10 @@ */ TInt TSpcClientInterface::TestUnitReadyL() { - __MSFNLOG TScsiClientTestUnitReadyReq testUnitReadyReq; TInt err = iTransport.SendControlCmdL(&testUnitReadyReq); - return err; + return err; } @@ -129,10 +130,9 @@ */ TInt TSpcClientInterface::PreventAllowMediumRemovalL(TBool aPrevent) { - __MSFNLOG TScsiClientPreventMediaRemovalReq preventAllowMediaRemovalReq(aPrevent); TInt err = iTransport.SendControlCmdL(&preventAllowMediaRemovalReq); - return err; + return err; } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/shared/debug.h --- a/userlibandfileserver/fileserver/shostmassstorage/server/shared/debug.h Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -// Copyright (c) 2008-2009 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" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -/** - @file - @internalTechnology -*/ - -#ifndef DEBUG_H -#define DEBUG_H - -//#define _SCSI_DEBUG_PRINT_ -//#define _BOT_DEBUG_PRINT_ -//#define _HOST_DEBUG_PRINT_ -//#define _TESTREPORT_PRINT_ - -#if (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#include -#endif - -#if defined(_SCSI_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -/** Trace - format string */ -#define __SCSIPRINT(t) {RDebug::Print(t);} -/** Trace - format string with 1 param */ -#define __SCSIPRINT1(t,a) {RDebug::Print(t,a);} -/** Trace - format string with 2 params */ -#define __SCSIPRINT2(t,a,b) {RDebug::Print(t,a,b);} -/** Trace - format string with 3 params */ -#define __SCSIPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} -/** Trace - format string with 4 params */ -#define __SCSIPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} -/** Trace - format string with 5 params */ -#define __SCSIPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} -#else -/** NULL definition */ -#define __SCSIPRINT(t) -/** NULL definition */ -#define __SCSIPRINT1(t,a) -/** NULL definition */ -#define __SCSIPRINT2(t,a,b) -/** NULL definition */ -#define __SCSIPRINT3(t,a,b,c) -/** NULL definition */ -#define __SCSIPRINT4(t,a,b,c,d) -/** NULL definition */ -#define __SCSIPRINT5(t,a,b,c,d,e) -#endif - - -#if defined(_BOT_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -/** Trace - format string */ -#define __BOTPRINT(t) {RDebug::Print(t);} -/** Trace - format string with 1 param */ -#define __BOTPRINT1(t,a) {RDebug::Print(t,a);} -/** Trace - format string with 2 params */ -#define __BOTPRINT2(t,a,b) {RDebug::Print(t,a,b);} -/** Trace - format string with 3 params */ -#define __BOTPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} -/** Trace - format string with 4 params */ -#define __BOTPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} -/** Trace - format string with 5 params */ -#define __BOTPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} -#else -/** NULL definition */ -#define __BOTPRINT(t) -/** NULL definition */ -#define __BOTPRINT1(t,a) -/** NULL definition */ -#define __BOTPRINT2(t,a,b) -/** NULL definition */ -#define __BOTPRINT3(t,a,b,c) -/** NULL definition */ -#define __BOTPRINT4(t,a,b,c,d) -/** NULL definition */ -#define __BOTPRINT5(t,a,b,c,d,e) -#endif - - -#if defined(_HOST_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -/** Trace - format string */ -#define __HOSTPRINT(t) {RDebug::Print(t);} -/** Trace - format string with 1 param */ -#define __HOSTPRINT1(t,a) {RDebug::Print(t,a);} -/** Trace - format string with 2 params */ -#define __HOSTPRINT2(t,a,b) {RDebug::Print(t,a,b);} -/** Trace - format string with 3 params */ -#define __HOSTPRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);} -/** Trace - format string with 4 params */ -#define __HOSTPRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} -/** Trace - format string with 5 params */ -#define __HOSTPRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} -#else -/** NULL definition */ -#define __HOSTPRINT(t) -/** NULL definition */ -#define __HOSTPRINT1(t,a) -/** NULL definition */ -#define __HOSTPRINT2(t,a,b) -/** NULL definition */ -#define __HOSTPRINT3(t,a,b,c) -/** NULL definition */ -#define __HOSTPRINT4(t,a,b,c,d) -/** NULL definition */ -#define __HOSTPRINT5(t,a,b,c,d,e) -#endif - - -#if defined(_TESTREPORT_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -/** Trace - format string */ -#define __TESTREPORT(t) {RDebug::Print(t);} -/** Trace - format string with 1 param */ -#define __TESTREPORT1(t,a) {RDebug::Print(t,a);} -/** Trace - format string with 2 params */ -#define __TESTREPORT2(t,a,b) {RDebug::Print(t,a,b);} -/** Trace - format string with 3 params */ -#define __TESTREPORT3(t,a,b,c) {RDebug::Print(t,a,b,c);} -/** Trace - format string with 4 params */ -#define __TESTREPORT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);} -/** Trace - format string with 5 params */ -#define __TESTREPORT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);} -#else -/** NULL definition */ -#define __TESTREPORT(t) -/** NULL definition */ -#define __TESTREPORT1(t,a) -/** NULL definition */ -#define __TESTREPORT2(t,a,b) -/** NULL definition */ -#define __TESTREPORT3(t,a,b,c) -/** NULL definition */ -#define __TESTREPORT4(t,a,b,c,d) -/** NULL definition */ -#define __TESTREPORT5(t,a,b,c,d,e) -#endif - -#endif // DEBUG_H diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/shared/msdebug.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/shared/msdebug.cpp Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -// Copyright (c) 2008-2009 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" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -/** - @file - @internalTechnology -*/ - -#include "msdebug.h" - -#ifdef MSFN_TRACE_ENABLED - -_LIT8(KFnMsgSIn, ">>\t%S\r\n"); -_LIT8(KFnMsgSOut,"<<\t%S\r\n"); -_LIT8(KFnMsgIn, ">>[0x%08x]\t%S\r\n"); -_LIT8(KFnMsgOut,"<<[0x%08x]\t%S\r\n"); - -TMsLogStaticFn::TMsLogStaticFn(const TDesC8& aFunctionName) - { - iFunctionName.Set(aFunctionName); - buf.AppendFormat(KFnMsgSIn, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TMsLogStaticFn::~TMsLogStaticFn() - { - buf.Zero(); - buf.AppendFormat(KFnMsgSOut, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TMsLogFn::TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer) -: iThisPointer(aThisPointer) - { - iFunctionName.Set(aFunctionName); - buf.AppendFormat(KFnMsgIn, iThisPointer, &iFunctionName); - RDebug::RawPrint(buf); - }; - - -TMsLogFn::~TMsLogFn() - { - buf.Zero(); - buf.AppendFormat(KFnMsgOut, iThisPointer, &iFunctionName); - RDebug::RawPrint(buf); - }; - -#endif diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/shared/msdebug.h --- a/userlibandfileserver/fileserver/shostmassstorage/server/shared/msdebug.h Tue Oct 26 11:12:58 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -// Copyright (c) 2008-2009 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" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// msdebug.cpp -// -// - -/** - @file - @internalTechnology -*/ - -#ifndef MSDEBUG_H -#define MSDEBUG_H - -// #define _MSFN_DEBUG_PRINT_ - -#if defined(_MSFN_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE)) -#define MSFN_TRACE_ENABLED -#endif - -#ifdef MSFN_TRACE_ENABLED -#include - - -/** -Logging function to be used with static functions. Prints the function string on -function entry and exit. -*/ -class TMsLogStaticFn - { -public: - static const TInt KLogBufferSize = 0xFF; - - TMsLogStaticFn(const TDesC8& aFunctionName); - - ~TMsLogStaticFn(); - -protected: - TBuf8 buf; - TPtrC8 iFunctionName; - }; - - -/** -Logging function which prints the function string on function entry and exit. -*/ -class TMsLogFn - { -public: - static const TInt KLogBufferSize = 0xFF; - TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer); - - ~TMsLogFn(); - -private: - TBuf8 buf; - TPtrC8 iFunctionName; - void* iThisPointer; - }; - - - -#define __MSFNLOG TMsLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this); -#define __MSFNSLOG TMsLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); -#else -#define __MSFNSLOG -#define __MSFNLOG -#endif - -#endif // MSDEBUG_H - - diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmsserver.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmsserver.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmsserver.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2008-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" @@ -12,7 +12,7 @@ // // Description: // cusbhostmsderver.cpp -// +// // /** @@ -27,30 +27,32 @@ #include "usbmshostpanic.h" #include "cusbhostmssession.h" #include "cusbhostmsserver.h" -#include "msdebug.h" -#include "debug.h" #include "securitypolicy.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cusbhostmsserverTraces.h" +#endif + + /** Constructs a USB mass storage Server */ CUsbHostMsServer* CUsbHostMsServer::NewLC() - { - __MSFNSLOG - CUsbHostMsServer* r = new (ELeave) CUsbHostMsServer(); - CleanupStack::PushL(r); - r->StartL(KUsbHostMsServerName); - return r; - } + { + CUsbHostMsServer* r = new (ELeave) CUsbHostMsServer(); + CleanupStack::PushL(r); + r->StartL(KUsbHostMsServerName); + return r; + } /** Destructor */ CUsbHostMsServer::~CUsbHostMsServer() - { - __MSFNLOG + { // Intentionally left blank - } + } /** @@ -58,9 +60,8 @@ */ CUsbHostMsServer::CUsbHostMsServer() : CPolicyServer(EPriorityHigh,KUsbMsServerPolicy, EGlobalSharableSessions) - { - __MSFNLOG - } + { + } /** @@ -72,20 +73,19 @@ @return CSession2* A pointer to a session object to be used for the client */ CSession2* CUsbHostMsServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMessage*/) const - { - __MSFNSLOG - TVersion v(KUsbHostMsSrvMajorVersionNumber, + { + TVersion v(KUsbHostMsSrvMajorVersionNumber, KUsbHostMsSrvMinorVersionNumber, KUsbHostMsSrvBuildVersionNumber); - if (!User::QueryVersionSupported(v, aVersion)) - User::Leave(KErrNotSupported); + if (!User::QueryVersionSupported(v, aVersion)) + User::Leave(KErrNotSupported); - CUsbHostMsServer* ncThis = const_cast(this); + CUsbHostMsServer* ncThis = const_cast(this); - CUsbHostMsSession* sess = CUsbHostMsSession::NewL(*ncThis); + CUsbHostMsSession* sess = CUsbHostMsSession::NewL(*ncThis); - return sess; - } + return sess; + } /** @@ -94,13 +94,13 @@ @param aError The error that has occurred */ void CUsbHostMsServer::Error(TInt aError) - { - __MSFNLOG - __HOSTPRINT1(_L("CUsbHostMsServer::Error [aError=%d]\n"), aError); + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSSERVER_10, + "CUsbHostMsServer::Error [aError=%d]\n", aError); - Message().Complete(aError); - ReStart(); - } + Message().Complete(aError); + ReStart(); + } /** Increment the open session count (iSessionCount) by one. @@ -108,15 +108,13 @@ @post The number of open sessions is incremented by one */ void CUsbHostMsServer::IncrementSessionCount() - { - __MSFNLOG - __HOSTPRINT1(_L("CUsbHostMsServer::IncrementSessionCount %d\n"), iSessionCount); - __ASSERT_DEBUG(iSessionCount >= 0, User::Panic(KUsbMsHostPanicCat, EUsbMsPanicIllegalIPC)); + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSSERVER_11, + "CUsbHostMsServer::IncrementSessionCount %d", iSessionCount); + __ASSERT_DEBUG(iSessionCount >= 0, User::Panic(KUsbMsHostPanicCat, EUsbMsPanicIllegalIPC)); - ++iSessionCount; - - __HOSTPRINT(_L("CUsbHostMsServer::IncrementSessionCount\n")); - } + ++iSessionCount; + } /** Decrement the open session count (iSessionCount) by one. @@ -124,12 +122,12 @@ @post The number of open sessions is decremented by one */ void CUsbHostMsServer::DecrementSessionCount() - { - __MSFNLOG - __HOSTPRINT1(_L("CUsbHostMsServer::DecrementSessionCount %d\n"), iSessionCount); + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSSERVER_12, + "CUsbHostMsServer::DecrementSessionCount %d", iSessionCount); - __ASSERT_DEBUG(iSessionCount > 0, User::Panic(KUsbMsHostPanicCat, EUsbMsPanicIllegalIPC)); + __ASSERT_DEBUG(iSessionCount > 0, User::Panic(KUsbMsHostPanicCat, EUsbMsPanicIllegalIPC)); - --iSessionCount; - } + --iSessionCount; + } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -20,6 +20,11 @@ #include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cusbhostmssessionTraces.h" +#endif + #include "msctypes.h" #include "shared.h" #include "msgservice.h" @@ -29,91 +34,86 @@ #include "usbmshostpanic.h" #include "cusbhostmsdevicethread.h" #include "cusbhostmssession.h" -#include "msdebug.h" -#include "debug.h" + /** Construct a Symbian OS session object. - param aServer Service the session will be a member of - param aMessage The message from the client. - return A new CUsbHostMsSession object + param aServer Service the session will be a member of + param aMessage The message from the client. + return A new CUsbHostMsSession object */ CUsbHostMsSession* CUsbHostMsSession::NewL(CUsbHostMsServer& aServer) - { - __MSFNSLOG - CUsbHostMsSession* r = new (ELeave) CUsbHostMsSession(aServer); - CleanupStack::PushL(r); - r->ConstructL(); - CleanupStack::Pop(); - return r; - } + { + CUsbHostMsSession* r = new (ELeave) CUsbHostMsSession(aServer); + CleanupStack::PushL(r); + r->ConstructL(); + CleanupStack::Pop(); + return r; + } /** Constructor. - param aServer Service the session will be a member of + param aServer Service the session will be a member of */ CUsbHostMsSession::CUsbHostMsSession(CUsbHostMsServer& aServer) - : iUsbHostMsServer(aServer) - { - __MSFNLOG - } + : iUsbHostMsServer(aServer) + { + } /** 2nd Phase Construction. */ void CUsbHostMsSession::ConstructL() - { - __MSFNLOG - iUsbHostMsServer.IncrementSessionCount(); - __HOSTPRINT1(_L("\tiSessionCount: %d\n"), iUsbHostMsServer.SessionCount()); - } + { + iUsbHostMsServer.IncrementSessionCount(); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSSESSION_10, + "iSessionCount: %d", iUsbHostMsServer.SessionCount()); + } /** Destructor. */ CUsbHostMsSession::~CUsbHostMsSession() - { - __MSFNLOG - - iUsbHostMsServer.DecrementSessionCount(); - iThread.Close(); - __HOSTPRINT1(_L("\tClosed a session -> iSessionCount: %d\n"), iUsbHostMsServer.SessionCount()); - } + { + iUsbHostMsServer.DecrementSessionCount(); + iThread.Close(); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSSESSION_11, + "Closed a session -> iSessionCount: %d", + iUsbHostMsServer.SessionCount()); + } /** Called when a message is received from the client. - param aMessage Message received from the client + param aMessage Message received from the client */ void CUsbHostMsSession::ServiceL(const RMessage2& aMessage) - { - __MSFNLOG - DispatchMessageL(aMessage); - } + { + DispatchMessageL(aMessage); + } /** Handles the request (in the form of a message) received from the client - param aMessage The received message + param aMessage The received message */ void CUsbHostMsSession::DispatchMessageL(const RMessage2& aMessage) - { - __MSFNLOG - TInt r = KErrNone; - switch (aMessage.Function()) - { - case EUsbHostMsRegisterInterface: - TRAP(r, CreateDeviceThreadL(aMessage)); - if(r != KErrNone) - { - aMessage.Complete(r); - return; - } - break; + { + TInt r = KErrNone; + switch (aMessage.Function()) + { + case EUsbHostMsRegisterInterface: + TRAP(r, CreateDeviceThreadL(aMessage)); + if(r != KErrNone) + { + aMessage.Complete(r); + return; + } + break; case EUsbHostMsUnRegisterInterface: if(iCleanupInProgress) { @@ -124,88 +124,88 @@ { iCleanupInProgress = ETrue; } - break; - /* If it is a cleanup then we need to delete the iDeviceThread */ - case EUsbHostMsFinalCleanup: - delete iDeviceThread; - iDeviceThread = NULL; - iThread.Kill(KErrNone); - aMessage.Complete(KErrNone); - return; - default: - break; - } + break; + /* If it is a cleanup then we need to delete the iDeviceThread */ + case EUsbHostMsFinalCleanup: + delete iDeviceThread; + iDeviceThread = NULL; + iThread.Kill(KErrNone); + aMessage.Complete(KErrNone); + return; + default: + break; + } - if (iDeviceThread == NULL) - { - aMessage.Complete(KErrBadHandle); - return; - } + if (iDeviceThread == NULL) + { + aMessage.Complete(KErrBadHandle); + return; + } - if (iCleanupInProgress && aMessage.Function() != EUsbHostMsUnRegisterInterface) + if (iCleanupInProgress && aMessage.Function() != EUsbHostMsUnRegisterInterface) { aMessage.Complete(KErrBadHandle); return; } - r = iDeviceThread->QueueMsg(aMessage); - if (r != KErrNone) - { - aMessage.Complete(r); - return; - } + r = iDeviceThread->QueueMsg(aMessage); + if (r != KErrNone) + { + aMessage.Complete(r); + return; + } - if (iClientStatus && *iClientStatus == KRequestPending) - { - __HOSTPRINT(_L("Signaling device thread to handle message")); - iThread.RequestComplete(iClientStatus, KErrNone); - } - } + if (iClientStatus && *iClientStatus == KRequestPending) + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSSESSION_20, + "Signaling device thread to handle message"); + iThread.RequestComplete(iClientStatus, KErrNone); + } + } void CUsbHostMsSession::CreateDeviceThreadL(const RMessage2& aMessage) - { - __MSFNLOG - THostMassStorageConfig msDeviceConfig; - TPtr8 ptr((TUint8*)&msDeviceConfig,sizeof(THostMassStorageConfig)); + { + THostMassStorageConfig msDeviceConfig; + TPtr8 ptr((TUint8*)&msDeviceConfig,sizeof(THostMassStorageConfig)); - aMessage.ReadL(0, ptr); - __HOSTPRINT1(_L("EUsbHostMsRegisterInterface Token=%d "), msDeviceConfig.iInterfaceToken); + aMessage.ReadL(0, ptr); + OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSSESSION_21, + "EUsbHostMsRegisterInterface Token=%d ", msDeviceConfig.iInterfaceToken); TBuf<32> nameBuf; - nameBuf.Format(_L("Host Ms Thread%8x"), msDeviceConfig.iInterfaceToken); - iDeviceThread = CUsbHostMsDeviceThread::NewL(*this, msDeviceConfig.iInterfaceToken); + nameBuf.Format(_L("Host Ms Thread%8x"), msDeviceConfig.iInterfaceToken); + iDeviceThread = CUsbHostMsDeviceThread::NewL(*this, msDeviceConfig.iInterfaceToken); - RHeap* h = (RHeap*)&User::Allocator(); - TInt maxsize = h->MaxLength(); // loader heap max size = file server heap max size - const TUint KHeapMinSize = 2048; + RHeap* h = (RHeap*)&User::Allocator(); + TInt maxsize = h->MaxLength(); // loader heap max size = file server heap max size + const TUint KHeapMinSize = 2048; - TInt r = iThread.Create(nameBuf, CUsbHostMsDeviceThread::Entry, KDefaultStackSize, KHeapMinSize, maxsize, iDeviceThread); - if(r != KErrNone) - { - delete iDeviceThread; + TInt r = iThread.Create(nameBuf, CUsbHostMsDeviceThread::Entry, KDefaultStackSize, KHeapMinSize, maxsize, iDeviceThread); + if(r != KErrNone) + { + delete iDeviceThread; iDeviceThread = NULL; - User::Leave(r); - } - iThread.SetPriority(EPriorityAbsoluteForeground); - TRequestStatus status; - iThread.Rendezvous(status); - iThread.Resume(); - User::WaitForRequest(status); - if(status != KErrNone) - { - delete iDeviceThread; + User::Leave(r); + } + iThread.SetPriority(EPriorityAbsoluteForeground); + TRequestStatus status; + iThread.Rendezvous(status); + iThread.Resume(); + User::WaitForRequest(status); + if(status != KErrNone) + { + delete iDeviceThread; iDeviceThread = NULL; - iThread.Kill(KErrNone); - User::Leave(status.Int()); - } - } + iThread.Kill(KErrNone); + User::Leave(status.Int()); + } + } void CUsbHostMsSession::MessageRequest(TRequestStatus& aStatus) { - __MSFNLOG iClientStatus = &aStatus; *iClientStatus = KRequestPending; } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/traces/OstTraceDefinitions.h Tue Oct 26 12:49:20 2010 +0100 @@ -0,0 +1,21 @@ +// Copyright (c) 2009 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" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/transport/cbulkonlytransport.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/transport/cbulkonlytransport.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/transport/cbulkonlytransport.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -34,24 +34,26 @@ #include "mprotocol.h" #include "cusbifacehandler.h" #include "cbulkonlytransport.h" -#include "debug.h" -#include "msdebug.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cbulkonlytransportTraces.h" +#endif + CBulkOnlyTransport::CBulkOnlyTransport() -: iBulkOutCbwTd(KCbwPacketSize), - iBulkDataTd(KResponsePacketSize), - iBulkInCswTd(KCswPacketSize) - { - __MSFNLOG - } +: iBulkOutCbwTd(KCbwPacketSize), + iBulkDataTd(KResponsePacketSize), + iBulkInCswTd(KCswPacketSize) + { + } CBulkOnlyTransport::~CBulkOnlyTransport() - { - __MSFNLOG - delete iUsbInterfaceHandler; - UnInitialiseTransport(); - iInterface.Close(); - } + { + delete iUsbInterfaceHandler; + UnInitialiseTransport(); + iInterface.Close(); + } /** Create CBulkOnlyTransport object. @@ -61,170 +63,164 @@ @return CBulkOnlyTransport* Pointer to the created object */ CBulkOnlyTransport* CBulkOnlyTransport::NewL(TUint aInterfaceId) - { - __MSFNSLOG - CBulkOnlyTransport* transport = new (ELeave) CBulkOnlyTransport(); - CleanupStack::PushL(transport); + { + CBulkOnlyTransport* transport = new (ELeave) CBulkOnlyTransport(); + CleanupStack::PushL(transport); transport->ConstructL(aInterfaceId); CleanupStack::Pop(transport); - return transport; - } + return transport; + } void CBulkOnlyTransport::ConstructL(TUint aInterfaceId) { - __MSFNSLOG - User::LeaveIfError(iInterface.Open(aInterfaceId)); - iUsbInterfaceHandler = CUsbInterfaceHandler::NewL(iInterface, iBulkPipeIn); - InitialiseTransport(); + User::LeaveIfError(iInterface.Open(aInterfaceId)); + iUsbInterfaceHandler = CUsbInterfaceHandler::NewL(iInterface, iBulkPipeIn); + InitialiseTransport(); } void CBulkOnlyTransport::Resume() - { - __MSFNSLOG - __BOTPRINT(_L("BOT RESUME")); - - iInterface.CancelPermitSuspend(); - } + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_10, "BOT RESUME"); + iInterface.CancelPermitSuspend(); + } void CBulkOnlyTransport::Suspend(TRequestStatus& aStatus) - { - __MSFNSLOG - __BOTPRINT(_L("BOT SUSPEND")); -// iInterface.PermitRemoteWakeup(ETrue); - iInterface.PermitSuspendAndWaitForResume(aStatus); - } + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_11, "BOT SUSPEND"); +// iInterface.PermitRemoteWakeup(ETrue); + iInterface.PermitSuspendAndWaitForResume(aStatus); + } TInt CBulkOnlyTransport::InitialiseTransport() - { - __MSFNLOG - TInt BulkOutEpAddr; - TInt BulkInEpAddr; - const TUint8 KEpDirectionIn = 0x80; - const TUint8 KEpDirectionOut = 0x00; - const TUint8 KTransferTypeBulk = 0x02; + { + TInt BulkOutEpAddr; + TInt BulkInEpAddr; + const TUint8 KEpDirectionIn = 0x80; + const TUint8 KEpDirectionOut = 0x00; + const TUint8 KTransferTypeBulk = 0x02; - GetEndpointAddress(iInterface,0,KTransferTypeBulk,KEpDirectionOut,BulkOutEpAddr); - GetEndpointAddress(iInterface,0,KTransferTypeBulk,KEpDirectionIn,BulkInEpAddr); - iInterface.OpenPipeForEndpoint(iBulkPipeOut, BulkOutEpAddr, EFalse); - iInterface.OpenPipeForEndpoint(iBulkPipeIn, BulkInEpAddr, EFalse); + GetEndpointAddress(iInterface,0,KTransferTypeBulk,KEpDirectionOut,BulkOutEpAddr); + GetEndpointAddress(iInterface,0,KTransferTypeBulk,KEpDirectionIn,BulkInEpAddr); + iInterface.OpenPipeForEndpoint(iBulkPipeOut, BulkOutEpAddr, EFalse); + iInterface.OpenPipeForEndpoint(iBulkPipeIn, BulkInEpAddr, EFalse); - if (iInterface.RegisterTransferDescriptor(iBulkOutCbwTd) != KErrNone || - iInterface.RegisterTransferDescriptor(iBulkDataTd) != KErrNone || - iInterface.RegisterTransferDescriptor(iBulkInCswTd) != KErrNone) + if (iInterface.RegisterTransferDescriptor(iBulkOutCbwTd) != KErrNone || + iInterface.RegisterTransferDescriptor(iBulkDataTd) != KErrNone || + iInterface.RegisterTransferDescriptor(iBulkInCswTd) != KErrNone) { - return KErrGeneral; + return KErrGeneral; } - if (iInterface.InitialiseTransferDescriptors() != KErrNone) + if (iInterface.InitialiseTransferDescriptors() != KErrNone) { - return KErrGeneral; + return KErrGeneral; } - return KErrNone; - } + return KErrNone; + } void CBulkOnlyTransport::UnInitialiseTransport() - { - __MSFNLOG - iBulkPipeOut.Close(); - iBulkPipeIn.Close(); - } + { + iBulkPipeOut.Close(); + iBulkPipeIn.Close(); + } + TInt CBulkOnlyTransport::GetEndpointAddress(RUsbInterface& aUsbInterface, TInt aInterfaceSetting, TUint8 aTransferType, TUint8 aDirection, TInt& aEndpointAddress) - { - __MSFNLOG - TUsbInterfaceDescriptor alternateInterfaceDescriptor; + { + TUsbInterfaceDescriptor alternateInterfaceDescriptor; - if (aUsbInterface.GetAlternateInterfaceDescriptor(aInterfaceSetting, alternateInterfaceDescriptor)) - { - __BOTPRINT1(_L("GetEndpointAddress : Unable to get alternate interface (%x) descriptor"),aInterfaceSetting); - return KErrGeneral; - } + if (aUsbInterface.GetAlternateInterfaceDescriptor(aInterfaceSetting, alternateInterfaceDescriptor)) + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_20, + "GetEndpointAddress : Unable to get alternate interface (%x) descriptor", aInterfaceSetting); + return KErrGeneral; + } - TUsbGenericDescriptor* descriptor = alternateInterfaceDescriptor.iFirstChild; + TUsbGenericDescriptor* descriptor = alternateInterfaceDescriptor.iFirstChild; - while (descriptor) - { - TUsbEndpointDescriptor* endpoint = TUsbEndpointDescriptor::Cast(descriptor); - if (endpoint) - { - if ((endpoint->Attributes() & aTransferType) == aTransferType) - { - // Found the endpoint address - if ( (endpoint->EndpointAddress() & 0x80) == aDirection) - { - aEndpointAddress = endpoint->EndpointAddress(); - __BOTPRINT(_L("GetEndpointAddress : Endpoint address found")); - return KErrNone; - } - } - } - descriptor = descriptor->iNextPeer; - } + while (descriptor) + { + TUsbEndpointDescriptor* endpoint = TUsbEndpointDescriptor::Cast(descriptor); + if (endpoint) + { + if ((endpoint->Attributes() & aTransferType) == aTransferType) + { + // Found the endpoint address + if ( (endpoint->EndpointAddress() & 0x80) == aDirection) + { + aEndpointAddress = endpoint->EndpointAddress(); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_21, + "GetEndpointAddress : Endpoint address found"); + return KErrNone; + } + } + } + descriptor = descriptor->iNextPeer; + } - // Unable to find the endpoint address - __BOTPRINT(_L("GetEndpointAddress : Unable to find endpoint address matching the specified attributes")); - return KErrNotFound; - } + // Unable to find the endpoint address + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_22, + "GetEndpointAddress : Unable to find endpoint address matching the specified attributes"); + return KErrNotFound; + } void CBulkOnlyTransport::GetMaxLun(TLun* aMaxLun, const RMessage2& aMessage) - { - __MSFNLOG - iUsbInterfaceHandler->GetMaxLun(aMaxLun, aMessage); - } + { + iUsbInterfaceHandler->GetMaxLun(aMaxLun, aMessage); + } TInt CBulkOnlyTransport::Reset() - { - __MSFNLOG - RUsbInterface::TUsbTransferRequestDetails reqDetails; - _LIT8(KNullDesC8,""); + { + RUsbInterface::TUsbTransferRequestDetails reqDetails; + _LIT8(KNullDesC8,""); - reqDetails.iRequestType = 0x21; - reqDetails.iRequest = 0xFF; - reqDetails.iValue = 0x0000; - reqDetails.iIndex = 0x0000; - reqDetails.iFlags = 0x04; // Short transfer OK + reqDetails.iRequestType = 0x21; + reqDetails.iRequest = 0xFF; + reqDetails.iValue = 0x0000; + reqDetails.iIndex = 0x0000; + reqDetails.iFlags = 0x04; // Short transfer OK - iInterface.Ep0Transfer(reqDetails, KNullDesC8, (TDes8 &) KNullDesC8, iStatus); - User::WaitForRequest(iStatus); - __BOTPRINT1(_L("BOT RESET[%d]"), iStatus.Int()); + iInterface.Ep0Transfer(reqDetails, KNullDesC8, (TDes8 &) KNullDesC8, iStatus); + User::WaitForRequest(iStatus); + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_30, + "BOT RESET[%d]", iStatus.Int()); - if (iStatus.Int() != KErrNone) + if (iStatus.Int() != KErrNone) { - return KErrGeneral; + return KErrGeneral; } - return KErrNone; - } + return KErrNone; + } void CBulkOnlyTransport::DoResetRecovery() - { - __MSFNLOG - - __BOTPRINT(_L("BOT RESET RECOVERY")); + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_31, + "BOT RESET RECOVERY"); #ifdef MASSSTORAGE_PUBLISHER TMsPublisher publisher(TMsPublisher::KBotResetProperty); #endif - Reset(); - iBulkPipeIn.ClearRemoteStall(); - iBulkPipeOut.ClearRemoteStall(); - } + Reset(); + iBulkPipeIn.ClearRemoteStall(); + iBulkPipeOut.ClearRemoteStall(); + } void CBulkOnlyTransport::SendCbwL(const MClientCommandServiceReq* aReq, TBotCbw::TCbwDirection aDirection, TUint32 aTransferLength) - { - __MSFNLOG - __BOTPRINT1(_L("Cbw Tag=0x%x"), iCbwTag); + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_40, + "Cbw Tag=0x%x", iCbwTag); - iCbw.SetTag(iCbwTag++); + iCbw.SetTag(iCbwTag++); iCbw.SetDataTransferLength(aTransferLength); iCbw.SetDataTransferDirection(aDirection); iCbw.SetLun(iLun); @@ -236,110 +232,115 @@ iBulkPipeOut.Transfer(iBulkOutCbwTd, iStatus); User::WaitForRequest(iStatus); - TInt r = iStatus.Int(); + TInt r = iStatus.Int(); if (r != KErrNone) { - if (r == KErrUsbStalled) + if (r == KErrUsbStalled) { - __BOTPRINT(_L("Cbw: BulkOut stalled")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_41, + "Cbw: BulkOut stalled"); DoResetRecovery(); } - __BOTPRINT1(_L("Usb transfer error %d"),r); - User::Leave(KErrGeneral); + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_42, + "Usb transfer error %d", r); + User::Leave(KErrGeneral); } - } + } void CBulkOnlyTransport::ReceiveCswL() - { - __MSFNLOG - iBulkInCswTd.SaveData(KCswPacketSize); - iBulkPipeIn.Transfer(iBulkInCswTd, iStatus); - User::WaitForRequest(iStatus); + { + iBulkInCswTd.SaveData(KCswPacketSize); + iBulkPipeIn.Transfer(iBulkInCswTd, iStatus); + User::WaitForRequest(iStatus); - TInt r = iStatus.Int(); - if (r != KErrNone) + TInt r = iStatus.Int(); + if (r != KErrNone) { - if (r == KErrUsbStalled) - { - __BOTPRINT(_L("Csw: Clearing BulkIn stall")); - iBulkPipeIn.ClearRemoteStall(); - iBulkInCswTd.SaveData(KCswPacketSize); - iBulkPipeIn.Transfer(iBulkInCswTd, iStatus); - User::WaitForRequest(iStatus); + if (r == KErrUsbStalled) + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_50, + "Csw: Clearing BulkIn stall"); + iBulkPipeIn.ClearRemoteStall(); + iBulkInCswTd.SaveData(KCswPacketSize); + iBulkPipeIn.Transfer(iBulkInCswTd, iStatus); + User::WaitForRequest(iStatus); #ifdef MASSSTORAGE_PUBLISHER TMsPublisher publisher(TMsPublisher::KStallProperty); #endif - r = iStatus.Int(); - if (r == KErrUsbStalled) + r = iStatus.Int(); + if (r == KErrUsbStalled) { - __BOTPRINT(_L("Csw: BulkIn stalled")); - DoResetRecovery(); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_51, + "Csw: BulkIn stalled"); + DoResetRecovery(); } - } - // Handle other usb error and retry failures - if (r != KErrNone) - { - __BOTPRINT1(_L("Usb transfer error %d"), r); - User::Leave(KErrGeneral); - } + } + // Handle other usb error and retry failures + if (r != KErrNone) + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_52, + "Usb transfer error %d", r); + User::Leave(KErrGeneral); + } } - TPtrC8 data = iBulkInCswTd.Buffer(); - r = iCsw.Decode(data); + TPtrC8 data = iBulkInCswTd.Buffer(); + r = iCsw.Decode(data); if (r != KErrNone) { - __BOTPRINT(_L("Csw: Invalid")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_53, + "Csw: Invalid"); DoResetRecovery(); User::Leave(KErrGeneral); } - } + } TInt CBulkOnlyTransport::SendControlCmdL(const MClientCommandServiceReq* aCommand) - { - __MSFNLOG + { SendCbwL(aCommand, TBotCbw::EDataOut, 0); ReceiveCswL(); return ProcessZeroTransferL(); - } + } TInt CBulkOnlyTransport::SendControlCmdL(const MClientCommandServiceReq* aCommand, MClientCommandServiceResp* aResp) - { - __MSFNLOG - - SendCbwL(aCommand, TBotCbw::EDataIn, aResp->DataLength()); + { + SendCbwL(aCommand, TBotCbw::EDataIn, aResp->DataLength()); - if (aResp->DataLength() > KResponsePacketSize) + if (aResp->DataLength() > KResponsePacketSize) { - __BOTPRINT(_L("Control command response length not supported")); - User::Leave(KErrGeneral); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_60, + "Control command response length not supported"); + User::Leave(KErrGeneral); } - iBulkDataTd.SaveData(KResponsePacketSize); - iBulkPipeIn.Transfer(iBulkDataTd, iStatus); - User::WaitForRequest(iStatus); - TInt r = iStatus.Int(); - if (r != KErrNone) + iBulkDataTd.SaveData(KResponsePacketSize); + iBulkPipeIn.Transfer(iBulkDataTd, iStatus); + User::WaitForRequest(iStatus); + TInt r = iStatus.Int(); + if (r != KErrNone) { - if (r != KErrUsbStalled) - { - __BOTPRINT1(_L("Usb transfer error %d"),r); - User::Leave(KErrGeneral); - } - __BOTPRINT(_L("SendControlCmdL ClearRemoteStall")); - iBulkPipeIn.ClearRemoteStall(); + if (r != KErrUsbStalled) + { + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_61, + "Usb transfer error %d",r); + User::Leave(KErrGeneral); + } + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_62, + "SendControlCmdL ClearRemoteStall"); + iBulkPipeIn.ClearRemoteStall(); ReceiveCswL(); - return KErrCommandStalled; + return KErrCommandStalled; } - TPtrC8 data = iBulkDataTd.Buffer(); + TPtrC8 data = iBulkDataTd.Buffer(); - ReceiveCswL(); + ReceiveCswL(); TUint32 dataReceived = 0; - r = ProcessInTransferL(dataReceived); + r = ProcessInTransferL(dataReceived); if (!r) { TRAP(r, aResp->DecodeL(data)); @@ -356,169 +357,174 @@ // 1 Transcend JetFlashV30 VendorID=JetFlash ProductID=TS#GJFV30 // (# is device size in G) - __BOTPRINT1(_L("Warning: No data received"), dataReceived); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_63, + "Warning: No data received"); } } - return r; - } + return r; + } TInt CBulkOnlyTransport::SendDataRxCmdL(const MClientCommandServiceReq* aCommand, TDes8& aCopyBuf, TInt& aLen) - { - __MSFNLOG - - TInt r = KErrNone; - SendCbwL(aCommand, TBotCbw::EDataIn, aLen); + { + TInt r = KErrNone; + SendCbwL(aCommand, TBotCbw::EDataIn, aLen); // store initial length as data is appended to the buffer TInt startPos = aCopyBuf.Length(); - TInt len = aLen; + TInt len = aLen; - while (len) + while (len) { - if(len > KResponsePacketSize) - iBulkDataTd.SaveData(KResponsePacketSize); - else - iBulkDataTd.SaveData(len); - iBulkPipeIn.Transfer(iBulkDataTd, iStatus); - User::WaitForRequest(iStatus); + if(len > KResponsePacketSize) + iBulkDataTd.SaveData(KResponsePacketSize); + else + iBulkDataTd.SaveData(len); + iBulkPipeIn.Transfer(iBulkDataTd, iStatus); + User::WaitForRequest(iStatus); - r = iStatus.Int(); - if (r != KErrNone) - { - if (r == KErrUsbStalled) - { - __BOTPRINT(_L("SendDataRxCmdL ClearRemoteStall")); - iBulkPipeIn.ClearRemoteStall(); + r = iStatus.Int(); + if (r != KErrNone) + { + if (r == KErrUsbStalled) + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_70, + "SendDataRxCmdL ClearRemoteStall"); + iBulkPipeIn.ClearRemoteStall(); #ifdef MASSSTORAGE_PUBLISHER TMsPublisher publisher(TMsPublisher::KStallProperty); #endif - break; - } - DoResetRecovery(); - __BOTPRINT1(_L("Usb transfer error %d"),r); - User::Leave(KErrGeneral); - } + break; + } + DoResetRecovery(); + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_71, + "Usb transfer error %d", r); + User::Leave(KErrGeneral); + } - TPtrC8 data = iBulkDataTd.Buffer(); - aCopyBuf.Append(data.Ptr(), data.Length()); - if(len > KResponsePacketSize) - len -= KResponsePacketSize; - else - len = 0; + TPtrC8 data = iBulkDataTd.Buffer(); + aCopyBuf.Append(data.Ptr(), data.Length()); + if(len > KResponsePacketSize) + len -= KResponsePacketSize; + else + len = 0; } - ReceiveCswL(); - TUint32 lenReceived = 0; + ReceiveCswL(); + TUint32 lenReceived = 0; - r = ProcessInTransferL(lenReceived); + r = ProcessInTransferL(lenReceived); aLen = lenReceived; aCopyBuf.SetLength(startPos + lenReceived); - return r; - } + return r; + } TInt CBulkOnlyTransport::SendDataTxCmdL(const MClientCommandServiceReq* aCommand, TDesC8& aData, TUint aPos, TInt& aLen) - { - __MSFNLOG - TInt r = KErrNone; + { + TInt r = KErrNone; + + SendCbwL(aCommand, TBotCbw::EDataOut, aLen); - SendCbwL(aCommand, TBotCbw::EDataOut, aLen); - - TInt len = aLen; - TInt length = 0; - iBulkDataTd.SetZlpStatus(RUsbTransferDescriptor::ESuppressZlp); - while (len) + TInt len = aLen; + TInt length = 0; + iBulkDataTd.SetZlpStatus(RUsbTransferDescriptor::ESuppressZlp); + while (len) { - TPtr8 senddata = iBulkDataTd.WritableBuffer(); - senddata.Append(aData.Ptr() + length + aPos, len > KResponsePacketSize? KResponsePacketSize : len); + TPtr8 senddata = iBulkDataTd.WritableBuffer(); + senddata.Append(aData.Ptr() + length + aPos, len > KResponsePacketSize? KResponsePacketSize : len); - iBulkDataTd.SaveData(senddata.Length()); - iBulkPipeOut.Transfer(iBulkDataTd, iStatus); - User::WaitForRequest(iStatus); + iBulkDataTd.SaveData(senddata.Length()); + iBulkPipeOut.Transfer(iBulkDataTd, iStatus); + User::WaitForRequest(iStatus); - if (iStatus.Int() != KErrNone) - { - if (iStatus.Int() == KErrUsbStalled) - { - __BOTPRINT(_L("SendDataTxCmdL ClearRemoteStall")); - iBulkPipeOut.ClearRemoteStall(); + if (iStatus.Int() != KErrNone) + { + if (iStatus.Int() == KErrUsbStalled) + { + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_80, + "SendDataTxCmdL ClearRemoteStall"); + iBulkPipeOut.ClearRemoteStall(); #ifdef MASSSTORAGE_PUBLISHER TMsPublisher publisher(TMsPublisher::KStallProperty); #endif - break; - } - DoResetRecovery(); - __BOTPRINT1(_L("Usb transfer error %d"), r); - User::Leave(KErrGeneral); - } + break; + } + DoResetRecovery(); + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_81, + "Usb transfer error %d", r); + User::Leave(KErrGeneral); + } - if(len > KResponsePacketSize) - { - len -= KResponsePacketSize; - length += KResponsePacketSize; - } - else - { - length += len; - len = 0; - } + if(len > KResponsePacketSize) + { + len -= KResponsePacketSize; + length += KResponsePacketSize; + } + else + { + length += len; + len = 0; + } } - ReceiveCswL(); + ReceiveCswL(); - TUint32 lenSent = 0; - r = ProcessOutTransferL(lenSent); - aLen = lenSent; + TUint32 lenSent = 0; + r = ProcessOutTransferL(lenSent); + aLen = lenSent; - return r; - } + return r; + } TInt CBulkOnlyTransport::ProcessZeroTransferL() { - __MSFNLOG // process 13 cases - __ASSERT_DEBUG(iCbw.iDirection == TBotCbw::EDataOut, User::Invariant()); - __ASSERT_DEBUG(iCbw.iDataTransferLength == 0, User::Invariant()); + __ASSERT_DEBUG(iCbw.iDirection == TBotCbw::EDataOut, User::Invariant()); + __ASSERT_DEBUG(iCbw.iDataTransferLength == 0, User::Invariant()); // Hn - Host expects no data transfers if (!iCsw.IsValidCsw(iCbw.iTag)) { - __BOTPRINT(_L("BOT CSW Invalid")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_90, + "BOT CSW Invalid"); DoResetRecovery(); - User::Leave(KErrGeneral); + User::Leave(KErrGeneral); } if (!iCsw.IsMeaningfulCsw(iCbw.iDataTransferLength)) { - __BOTPRINT(_L("BOT CSW not meaningful")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_91, + "BOT CSW not meaningful"); DoResetRecovery(); - User::Leave(KErrGeneral); + User::Leave(KErrGeneral); } if (iCsw.iStatus == TBotCsw::EPhaseError) { // Case (2) or (3) - __BOTPRINT(_L("BOT Phase Error")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_92, + "BOT Phase Error"); // Reset Recovery DoResetRecovery(); - User::Leave(KErrGeneral); + User::Leave(KErrGeneral); } if (iCsw.iDataResidue != 0) { // should not happen - __BOTPRINT(_L("BOT Residue is invalid!")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_93, + "BOT Residue is invalid!"); // Reset Recovery DoResetRecovery(); - User::Leave(KErrGeneral); + User::Leave(KErrGeneral); } // all ok if here @@ -528,22 +534,23 @@ TInt CBulkOnlyTransport::ProcessInTransferL(TUint32& aDataReceived) { - __MSFNLOG aDataReceived = 0; // process 13 cases - __ASSERT_DEBUG(iCbw.iDirection == TBotCbw::EDataIn, User::Invariant()); + __ASSERT_DEBUG(iCbw.iDirection == TBotCbw::EDataIn, User::Invariant()); // Hi - Host expects to receive data from the device if (!iCsw.IsValidCsw(iCbw.iTag)) { - __BOTPRINT(_L("BOT CSW Invalid")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_100, + "BOT CSW Invalid"); DoResetRecovery(); User::Leave(KErrGeneral); } if (!iCsw.IsMeaningfulCsw(iCbw.iDataTransferLength)) { - __BOTPRINT(_L("BOT CSW not meaningful")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_101, + "BOT CSW not meaningful"); DoResetRecovery(); User::Leave(KErrGeneral); } @@ -551,11 +558,12 @@ if (iCsw.iStatus == TBotCsw::EPhaseError) { - __BOTPRINT(_L("BOT Phase Error")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_102, + "BOT Phase Error"); // Case (7) or (8) // Reset Recovery DoResetRecovery(); - User::Leave(KErrGeneral); + User::Leave(KErrGeneral); } // all ok if here @@ -567,33 +575,35 @@ TInt CBulkOnlyTransport::ProcessOutTransferL(TUint32& aDataReceived) { - __MSFNLOG aDataReceived = 0; // process 13 cases - __ASSERT_DEBUG(iCbw.iDirection == TBotCbw::EDataOut, User::Invariant()); + __ASSERT_DEBUG(iCbw.iDirection == TBotCbw::EDataOut, User::Invariant()); // Ho - Host expects to send data to the device if (!iCsw.IsValidCsw(iCbw.iTag)) { - __BOTPRINT(_L("BOT CSW Invalid")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_110, + "BOT CSW Invalid"); DoResetRecovery(); User::Leave(KErrGeneral); } if (!iCsw.IsMeaningfulCsw(iCbw.iDataTransferLength)) { - __BOTPRINT(_L("BOT CSW not meaningful")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_111, + "BOT CSW not meaningful"); DoResetRecovery(); User::Leave(KErrGeneral); } if (iCsw.iStatus == TBotCsw::EPhaseError) { - __BOTPRINT(_L("BOT Phase Error")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_112, + "BOT Phase Error"); // Case (10) or (13) // Reset Recovery DoResetRecovery(); - User::Leave(KErrGeneral); + User::Leave(KErrGeneral); } // all ok if here @@ -605,9 +615,9 @@ void CBulkOnlyTransport::SetLun(TLun aLun) { - __MSFNLOG iLun = aLun; - __BOTPRINT1(_L("CBulkOnlyTransport::SetLun(%d)"), aLun) + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_120, + "CBulkOnlyTransport::SetLun(%d)", aLun); } @@ -620,23 +630,23 @@ */ void TBotCbw::EncodeL(TPtr8 &aBuffer, const MClientCommandServiceReq* aCommand) const { - __MSFNSLOG - aBuffer.SetLength(KCbwLength); + aBuffer.SetLength(KCbwLength); - TPtr8 commandBlock = aBuffer.MidTPtr(TBotCbw::KCbwCbOffset); + TPtr8 commandBlock = aBuffer.MidTPtr(TBotCbw::KCbwCbOffset); - aBuffer.FillZ(); + aBuffer.FillZ(); TInt cbLength = aCommand->EncodeRequestL(commandBlock); - TUint8* ptr = (TUint8 *) aBuffer.Ptr(); + TUint8* ptr = (TUint8 *) aBuffer.Ptr(); LittleEndian::Put32(&ptr[KCbwSignatureOffset], 0x43425355); LittleEndian::Put32(&ptr[KCbwTagOffset], iTag); LittleEndian::Put32(&ptr[KCbwDataTransferLengthOffset], iDataTransferLength); aBuffer[KCbwFlagOffset] = (iDirection == EDataOut) ? 0x00 : 0x80; aBuffer[KCbwLunOffset] = iLun; aBuffer[KCbwCbLengthOffset] = cbLength; - __BOTPRINT1(_L("BOT TBotCbw::Encode Lun=%d"), iLun); + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_121, + "BOT TBotCbw::Encode Lun=%d", iLun); } @@ -647,10 +657,10 @@ */ TInt TBotCsw::Decode(const TDesC8& aPtr) { - __MSFNLOG if (aPtr.Length() != KCswLength) { - __BOTPRINT1(_L("Invalid CSW length %d"), aPtr.Length()); + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_130, + "Invalid CSW length %d", aPtr.Length()); return KErrGeneral; } @@ -660,7 +670,8 @@ TInt status = aPtr[KCswStatusOffset]; iStatus = static_cast(status); - __BOTPRINT1(_L("BOT CSW Status = %d"), iStatus); + OstTrace1(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_131, + "BOT CSW Status = %d", iStatus); return KErrNone; } @@ -675,7 +686,6 @@ */ TBool TBotCsw::IsValidCsw(TUint32 aTag) const { - __MSFNSLOG if (iSignature != 0x53425355) { return EFalse; @@ -698,7 +708,6 @@ */ TBool TBotCsw::IsMeaningfulCsw(TUint32 aTransferLength) const { - __MSFNSLOG if (iStatus != EPhaseError) { if (iDataResidue > aTransferLength) @@ -712,13 +721,14 @@ #ifdef MASSSTORAGE_PUBLISHER TMsPublisher::TMsPublisher(TPropertyKeys aKey) { - RProperty prop; + RProperty prop; const TUid KUidHostMassStorageCategory = {KMyUid}; - TInt ret = prop.Attach(KUidHostMassStorageCategory, aKey); - __BOTPRINT2(_L("Property Key[%d] attach ret=%d"), aKey, ret); - if (ret == KErrNone) + TInt ret = prop.Attach(KUidHostMassStorageCategory, aKey); + OstTraceExt2(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_140, + "Property Key[%d] attach ret=%d", aKey, ret); + if (ret == KErrNone) { TInt flag; ret = prop.Get(KUidHostMassStorageCategory, aKey, flag); @@ -727,8 +737,10 @@ flag++; ret = prop.Set(KUidHostMassStorageCategory, aKey, flag); } - __BOTPRINT3(_L("Property Set[%d] ret=%d Counter=%d"), aKey, ret, flag); - prop.Close(); + OstTraceExt3(TRACE_SHOSTMASSSTORAGE_BOT, CBULKONLYTRANSPORT_141, + "Property Set[%d] ret=%d Counter=%d", + aKey, ret, flag); + prop.Close(); } } diff -r 94f2adf59133 -r b2826f67641f userlibandfileserver/fileserver/shostmassstorage/server/transport/cusbifacehandler.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/transport/cusbifacehandler.cpp Tue Oct 26 11:12:58 2010 +0100 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/transport/cusbifacehandler.cpp Tue Oct 26 12:49:20 2010 +0100 @@ -30,98 +30,99 @@ #include "mprotocol.h" #include "cusbifacehandler.h" #include "cbulkonlytransport.h" -#include "debug.h" -#include "msdebug.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cusbifacehandlerTraces.h" +#endif CUsbInterfaceHandler* CUsbInterfaceHandler::NewL(RUsbInterface &aInterface, RUsbPipe& aBulkPipeIn) - { - return new (ELeave) CUsbInterfaceHandler(aInterface, aBulkPipeIn); - } + { + return new (ELeave) CUsbInterfaceHandler(aInterface, aBulkPipeIn); + } CUsbInterfaceHandler::CUsbInterfaceHandler(RUsbInterface &aInterface, RUsbPipe& aBulkPipeIn) -: CActive(EPriorityStandard), - iInterface(aInterface), +: CActive(EPriorityStandard), + iInterface(aInterface), iBulkPipeIn(aBulkPipeIn) - { - __MSFNLOG - CActiveScheduler::Add(this); - } + { + CActiveScheduler::Add(this); + } CUsbInterfaceHandler::~CUsbInterfaceHandler() - { - __MSFNLOG - if (iState != ENone) - { - iState = ENone; - iBotGetMaxLun.Complete(KErrCancel); - Cancel(); - } - } + { + if (iState != ENone) + { + iState = ENone; + iBotGetMaxLun.Complete(KErrCancel); + Cancel(); + } + } /** Cancellation of outstanding request */ void CUsbInterfaceHandler::DoCancel() - { - __MSFNLOG - } + { + } /** Completion of USB transport request. */ void CUsbInterfaceHandler::RunL() { - __MSFNLOG - TInt error = iStatus.Int(); + TInt error = iStatus.Int(); - if (error == KErrUsbStalled && iState == EGetMaxLun) + if (error == KErrUsbStalled && iState == EGetMaxLun) { // Devices that do not support multiple LUNs may STALL this command - __BOTPRINT(_L("...KErrUsbStalled")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CUSBIFACEHANLDER_10, + "...KErrUsbStalled"); iBulkPipeIn.ClearRemoteStall(); - error = KErrNone; + error = KErrNone; } - else if (error == KErrNone) + else if (error == KErrNone) { - __BOTPRINT(_L("...KErrNone")); - if (iState == EGetMaxLun) + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CUSBIFACEHANLDER_11, + "...KErrNone"); + if (iState == EGetMaxLun) { - __BOTPRINT(_L("...sending GetMaxLun response")); - *ipGetMaxLun = iBuffer[0]; + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CUSBIFACEHANLDER_12, + "...sending GetMaxLun response"); + *ipGetMaxLun = iBuffer[0]; } } else { - __BOTPRINT(_L("...completeing with KErrGeneral")); + OstTrace0(TRACE_SHOSTMASSSTORAGE_BOT, CUSBIFACEHANLDER_13, + "...completeing with KErrGeneral"); error = KErrGeneral; } iState = ENone; - iBotGetMaxLun.Complete(error); + iBotGetMaxLun.Complete(error); } void CUsbInterfaceHandler::GetMaxLun(TLun* aMaxLun, const RMessage2& aMessage) - { - __MSFNLOG - - /* Send the Get max lun command in the ep0 */ - RUsbInterface::TUsbTransferRequestDetails reqDetails; - _LIT8(KNullDesC8,""); - iBotGetMaxLun = aMessage; - iState = EGetMaxLun; - ipGetMaxLun = aMaxLun; + { + /* Send the Get max lun command in the ep0 */ + RUsbInterface::TUsbTransferRequestDetails reqDetails; + _LIT8(KNullDesC8,""); + iBotGetMaxLun = aMessage; + iState = EGetMaxLun; + ipGetMaxLun = aMaxLun; *ipGetMaxLun = 0; // default response is MaxLUN=0 - reqDetails.iRequestType = 0xA1; - reqDetails.iRequest = 0xFE; - reqDetails.iValue = 0x0000; - reqDetails.iIndex = 0x0000; - reqDetails.iFlags = 0x04; // Short transfer OK + reqDetails.iRequestType = 0xA1; + reqDetails.iRequest = 0xFE; + reqDetails.iValue = 0x0000; + reqDetails.iIndex = 0x0000; + reqDetails.iFlags = 0x04; // Short transfer OK - iBuffer.SetLength(1); - iInterface.Ep0Transfer(reqDetails, KNullDesC8, iBuffer, iStatus); - SetActive(); - } + iBuffer.SetLength(1); + iInterface.Ep0Transfer(reqDetails, KNullDesC8, iBuffer, iStatus); + SetActive(); + }