--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/bwins/msmmicsession_over_dummycomponentu.def Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+ ?EjectUsbDrives@RHostMassStorage@@QAEHXZ @ 1 NONAME ; int RHostMassStorage::EjectUsbDrives(void)
+ ?Disconnect@RHostMassStorage@@QAEHXZ @ 2 NONAME ; int RHostMassStorage::Disconnect(void)
+ ?Connect@RHostMassStorage@@QAEHXZ @ 3 NONAME ; int RHostMassStorage::Connect(void)
+ ?Version@RHostMassStorage@@QBE?AVTVersion@@XZ @ 4 NONAME ; class TVersion RHostMassStorage::Version(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmicsession_over_dummycomponentu.def Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+ _ZN16RHostMassStorage10DisconnectEv @ 1 NONAME
+ _ZN16RHostMassStorage14EjectUsbDrivesEv @ 2 NONAME
+ _ZN16RHostMassStorage7ConnectEv @ 3 NONAME
+ _ZNK16RHostMassStorage7VersionEv @ 4 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/eabi/msmmindicatorsessionu.def Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+ _ZN16RHostMassStorage10DisconnectEv @ 1 NONAME
+ _ZN16RHostMassStorage14EjectUsbDrivesEv @ 2 NONAME
+ _ZN16RHostMassStorage7ConnectEv @ 3 NONAME
+ _ZNK16RHostMassStorage7VersionEv @ 4 NONAME
+
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/bld.inf Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/bld.inf Wed Jun 23 20:17:18 2010 +0300
@@ -27,9 +27,11 @@
#if defined(SYMBIAN_ENABLE_USB_OTG_HOST) && !defined(WINS) && !defined(X86GCC)
msmmclient.mmp
+msmmindicatorclient.mmp
#endif
-
PRJ_TESTEXPORTS
../public/msmmclient.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/hostms/msmmclient.h)
+PRJ_EXPORTS
+../public/msmmindicatorclient.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/hostms/msmmindicatorclient.h)
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_over_dummycomponent.mmp Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmclient_over_dummycomponent.mmp Wed Jun 23 20:17:18 2010 +0300
@@ -28,6 +28,6 @@
#include "msmmclient_base.mmp"
-CAPABILITY ProtServ WriteDeviceData CommDD DiskAdmin NetworkControl
+CAPABILITY ProtServ WriteDeviceData CommDD DiskAdmin NetworkControl TrustedUI
MACRO __OVER_DUMMYCOMPONENT__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient.mmp Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* 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 "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
+ @internalComponent
+*/
+
+
+TARGET msmmindicatorsession.dll
+TARGETTYPE dll
+UID 0x1000008d 0x20031571
+
+CAPABILITY All -TCB
+
+#include "msmmindicatorclient_base.mmp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_base.mmp Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 "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
+ @internalComponent
+*/
+
+#include <usb/usblogger.mmh>
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY euser.lib
+
+SOURCEPATH ../src
+
+SOURCE msmmindicatorclient.cpp
+
+USERINCLUDE ../../inc
+USERINCLUDE ../public
+USERINCLUDE ../../server/public
+
+VENDORID 0x70000001
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/group/msmmindicatorclient_over_dummycomponent.mmp Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* 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 "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
+ @internalComponent
+ @test
+*/
+
+
+TARGET msmmicsession_over_dummycomponent.dll
+TARGETTYPE dll
+UID 0x1000008d 0x0F15655A
+
+#include "msmmindicatorclient_base.mmp"
+
+CAPABILITY ProtServ WriteDeviceData CommDD DiskAdmin NetworkControl TrustedUI
+
+MACRO __OVER_DUMMYCOMPONENT__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/public/msmmindicatorclient.h Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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 "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
+ @internalComponent
+*/
+
+#ifndef MSMMINDICATORCLIENT_H
+#define MSMMINDICATORCLIENT_H
+
+#include <e32std.h>
+
+/**
+RHostMassStorage is the interface for Mass Storage Indicator UI to use the MSMM.
+*/
+NONSHARABLE_CLASS(RHostMassStorage) : public RSessionBase
+{
+public:
+ // RHostMassStorage Implementation API to add a session to the running MSMM server
+ IMPORT_C TInt Connect();
+ IMPORT_C TInt Disconnect();
+ IMPORT_C TVersion Version() const;
+
+ /** Dismount USB drives from File System asynchronously. The function will return immediately to the UI with complete status
+ The result of dismounting USB drives will be notified to the MSMM Plugin via CMsmmPolicyPluginBase
+ @return Error code of IPC.
+ */
+ IMPORT_C TInt EjectUsbDrives();
+
+};
+
+#endif // MSMMINDICATORCLIENT_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/client/src/msmmindicatorclient.cpp Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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 "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
+ @internalComponent
+*/
+
+#include <usb/usblogger.h>
+#include <e32cmn.h>
+
+#include "srvdef.h"
+#include "msmmindicatorclient.h"
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "UsbHostMsmmIndicatorClient");
+#endif
+
+// Costants
+const TInt KConnectRetry = 0x2;
+
+
+//---------------------------------------------------------------------------
+// RHostMassStorage
+//
+// Public member functions
+
+EXPORT_C TInt RHostMassStorage::Connect()
+ {
+ LOG_FUNC
+
+ TInt retry = KConnectRetry; // Attempt to add a session to MSMM Server twice
+ TInt ret(KErrNone);
+ FOREVER
+ {
+ ret = CreateSession(KMsmmServerName, Version(), KDefaultMessageSlots);
+ // We are not allowed to start the server
+ if ((KErrNotFound == ret) || (KErrServerTerminated == ret))
+ {
+ LOGTEXT2(_L("Underlying error value = %d"), ret)
+ return KErrNotReady;
+ }
+ if ( KErrNone == ret )
+ {
+ break;
+ }
+ if ((--retry) == 0)
+ {
+ break;
+ }
+ }
+ return ret;
+ }
+
+EXPORT_C TInt RHostMassStorage::Disconnect()
+ {
+ LOG_FUNC
+
+ Close();
+ return KErrNone;
+ }
+
+/**
+ * Called to validate the version of the server we require for this API
+ * @return TVersion The version of MSMM Server that supports this API
+ */
+EXPORT_C TVersion RHostMassStorage::Version() const
+ {
+ LOG_FUNC
+
+ return TVersion(KMsmmServMajorVersionNumber,
+ KMsmmServMinorVersionNumber,
+ KMsmmServBuildVersionNumber);
+ }
+
+/**
+ * Dismount USB drives from File System asynchronously. The function will return immediately to the UI with complete status
+ * The result of dismounting USB drives will be notified to the MSMM Plugin via CMsmmPolicyPluginBase
+ * @return Error code of IPC.
+*/
+
+EXPORT_C TInt RHostMassStorage::EjectUsbDrives()
+ {
+ LOG_FUNC
+
+ TInt ret(KErrNone);
+
+ TIpcArgs usbmsIpcArgs;
+
+ ret = Send(EHostMsmmServerEjectUsbDrives, usbmsIpcArgs);
+
+ return ret;
+ }
+
+
+// End of file
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/bld.inf Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/bld.inf Wed Jun 23 20:17:18 2010 +0300
@@ -23,10 +23,11 @@
PRJ_PLATFORMS
ARMV5 GCCXML
+#include "../client/group/bld.inf"
#include "../server/group/bld.inf"
-#include "../client/group/bld.inf"
#include "../referencepolicyplugin/group/bld.inf"
#include "../refppnotifier/group/bld.inf"
PRJ_EXPORTS
usbhostmsmm.iby /epoc32/rom/include/usbhostmsmm.iby
+
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/msmm_over_dummycomponent_bld.inf Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/msmm_over_dummycomponent_bld.inf Wed Jun 23 20:17:18 2010 +0300
@@ -28,4 +28,5 @@
PRJ_TESTMMPFILES
../server/group/msmmserver_over_dummycomponent.mmp
../client/group/msmmclient_over_dummycomponent.mmp
+../client/group/msmmindicatorclient_over_dummycomponent.mmp
../referencepolicyplugin/group/refpp_over_dummycomponent.mmp
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/usbhostmsmm.iby Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/group/usbhostmsmm.iby Wed Jun 23 20:17:18 2010 +0300
@@ -30,6 +30,7 @@
file=ABI_DIR\USB_DIR\msmmsession.dll Sys\bin\msmmsession.dll
file=ABI_DIR\USB_DIR\msmmserver.exe Sys\bin\msmmserver.exe
+file=ABI_DIR\USB_DIR\msmmindicatorsession.dll Sys\bin\msmmindicatorsession.dll
#endif
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/inc/srvdef.h Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/inc/srvdef.h Wed Jun 23 20:17:18 2010 +0300
@@ -48,6 +48,12 @@
const TUint32 KFDFWSecureId = 0x10282B48;
#endif
+#ifdef __OVER_DUMMYCOMPONENT__
+const TUint32 KSidHbDeviceDialogAppServer = 0x20022FC4; // SID for unit test project
+#else
+const TUint32 KSidHbDeviceDialogAppServer = 0x20022FC5; //SID for indicator UI that will call eject usb drives
+#endif
+
/** The Msmm Version numbers */
const TUint KMsmmServMajorVersionNumber = 1;
const TUint KMsmmServMinorVersionNumber = 0;
@@ -60,6 +66,7 @@
EHostMsmmServerRemoveDevice = 2, // Remove device request
EHostMsmmServerDbgFailNext = 3,
EHostMsmmServerDbgAlloc = 4,
+ EHostMsmmServerEjectUsbDrives = 5, // Dismount USB drives request
EHostMsmmServerEndMarker // Request end mark
};
@@ -67,6 +74,6 @@
const TUint KDefaultMessageSlots = 1;
// Max connection number
-const TInt KMaxClientCount = 1;
+const TInt KMaxClientCount = 2;
#endif // #ifndef SRVDEF_H
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_base.mmp Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_base.mmp Wed Jun 23 20:17:18 2010 +0300
@@ -33,6 +33,7 @@
SOURCE main.cpp
SOURCE msmmserver.cpp
SOURCE msmmsession.cpp
+SOURCE msmmdismountusbdrives.cpp
SOURCE eventqueue.cpp
SOURCE eventhandler.cpp
SOURCE msmmterminator.cpp
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_over_dummycomponent.mmp Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/group/msmmserver_over_dummycomponent.mmp Wed Jun 23 20:17:18 2010 +0300
@@ -27,6 +27,7 @@
UID 0 0x1028653F
LIBRARY dummymsc.lib
+LIBRARY dummyfilesysclient.lib
#include "msmmserver_base.mmp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmdismountusbdrives.h Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,169 @@
+/*
+* 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 "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: Header file for Stylus Tap indicator eject usb drives
+*
+*/
+
+
+#ifndef MSMMDISMOUNTUSBDRIVES_H
+#define MSMMDISMOUNTUSBDRIVES_H
+
+#include <e32base.h>
+#ifdef __OVER_DUMMYCOMPONENT__
+#include "usb/hostms/dummycomponent/dummyfsclient.h"
+#else
+#include <f32file.h>
+#endif
+
+#include "msmm_pub_def.h"
+
+class CDismountTimer;
+class CMsmmPolicyPluginBase;
+
+/**
+ * Timer callback interface to indicate USB drive in use
+ *
+ * This class specifies the function to be called when a timeout occurs.
+ * Used in conjunction with CDismountTimer class
+ *
+ */
+class MTimerNotifier
+ {
+public:
+ /**
+ * The function to be called when a timeout occurs.
+ *
+ */
+ virtual void TimerExpired() = 0;
+ };
+
+/**
+ * An Active Object class to request dismount of usb specific drives and notify the result to MSMM plugin
+ *
+ */
+NONSHARABLE_CLASS( CMsmmDismountUsbDrives ) : public CActive,
+ public MTimerNotifier
+ {
+public:
+ virtual ~CMsmmDismountUsbDrives();
+ static CMsmmDismountUsbDrives* NewL();
+ static CMsmmDismountUsbDrives* NewLC();
+
+public:
+ /**
+ * Send dismount notifications for all usb drives.
+ */
+ void DismountUsbDrives(CMsmmPolicyPluginBase& aPlugin, TUSBMSDeviceDescription& aDevice);
+
+protected:
+ CMsmmDismountUsbDrives();
+ void ConstructL();
+
+private:
+ /**
+ * Send dismount notification via RFs
+ */
+ void DoDismount();
+
+ /**
+ * Callback to CMsmmPolicyPluginBase
+ */
+ void CompleteDismountRequest(const TInt aResult);
+
+private: //from CActive
+ void RunL();
+ void DoCancel();
+
+private: // from MTimerNotifier
+
+ /**
+ * Dismount timer callback
+ */
+ void TimerExpired();
+
+private:
+ /**
+ * Drive index
+ */
+ TInt iDriveIndex;
+ /**
+ * RFs session
+ */
+#ifdef __OVER_DUMMYCOMPONENT__
+ RDummyFs iRFs;
+#else
+ RFs iRFs;
+#endif
+ /**
+ * List of drives
+ */
+ TDriveList iDriveList;
+
+ /**
+ * Dismount timer
+ * Own
+ */
+ CDismountTimer* iDismountTimer;
+
+ /**
+ * Callback API for dismount result
+ * Do not own
+ */
+ CMsmmPolicyPluginBase* iPlugin;
+
+ /**
+ * Device specific details, manufacturer and productid
+ */
+ TPckgBuf<TUSBMSDeviceDescription> iDevicePkgInfo;
+ };
+
+
+/**
+ * Timer interface for dismount request
+ *
+ * This class will notify an object after a specified timeout.
+ *
+ */
+class CDismountTimer : public CTimer
+ {
+public:
+ static CDismountTimer* NewL( MTimerNotifier* aTimeOutNotify );
+ static CDismountTimer* NewLC( MTimerNotifier* aTimeOutNotify);
+ virtual ~CDismountTimer();
+ void CancelTimer();
+ void StartTimer();
+
+protected:
+ /**
+ * From CTimer
+ * Invoked when a timeout occurs
+ *
+ */
+ virtual void RunL();
+
+private:
+ CDismountTimer( MTimerNotifier* aTimeOutNotify );
+ void ConstructL();
+
+private: // Member variables
+
+ /**
+ * The observer for this objects events
+ * Not own.
+ */
+ MTimerNotifier* iNotify;
+ };
+
+
+#endif // MSMMDISMOUNTUSBDRIVES_H
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmserver.h Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmserver.h Wed Jun 23 20:17:18 2010 +0300
@@ -37,6 +37,9 @@
class CMsmmTerminator;
class CDeviceEventQueue;
class CMsmmPolicyPluginBase;
+class THostMsErrData;
+class CMsmmDismountUsbDrives;
+class TUSBMSDeviceDescription;
// Server side resource container class
// Intends to be used by any internal objects (such as sub-command objects)
@@ -66,11 +69,16 @@
// CMsmmServer API
virtual CSession2* NewSessionL(const TVersion& aVersion,
const RMessage2& aMessage) const;
-
+ CPolicyServer::TCustomResult CustomSecurityCheckL(const RMessage2& aMsg,
+ TInt& aAction,
+ TSecurityInfo& aMissing);
+
TInt SessionNumber() const;
void AddSession();
void RemoveSession();
+ void DismountUsbDrivesL(TUSBMSDeviceDescription& aDevice);
+
// From MMsmmSrvProxy
inline CMsmmEngine& Engine() const;
inline RFs& FileServerSession() const;
@@ -87,6 +95,8 @@
RFs iFs;
CMsmmPolicyPluginBase* iPolicyPlugin; // Owned
CDeviceEventQueue* iEventQueue; // Owned
+ CMsmmDismountUsbDrives* iDismountManager; //Singleton to request dismounting usb drives via RFs
+ THostMsErrData* iDismountErrData; // The data nodes try, Owned
};
#include "msmmserver.inl"
#endif // MSMMSERVER_H
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/srvsec.h Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/srvsec.h Wed Jun 23 20:17:18 2010 +0300
@@ -26,6 +26,7 @@
const TInt KMsmmServerRanges[] =
{
EHostMsmmServerAddFunction,
+ EHostMsmmServerEjectUsbDrives, //separate policy check for Eject usb drives client
EHostMsmmServerEndMarker
};
const TUint KMsmmServerRangeCount =
@@ -34,18 +35,21 @@
const TUint8 KMsmmServerElementsIndex[KMsmmServerRangeCount] =
{
0,
+ 1,
CPolicyServer::ENotSupported
};
const CPolicyServer::TPolicyElement KMsmmServerElements[] =
{
{_INIT_SECURITY_POLICY_S1( KFDFWSecureId, ECapabilityCommDD ),
+ CPolicyServer::EFailClient},
+ {_INIT_SECURITY_POLICY_S1( KSidHbDeviceDialogAppServer, ECapabilityTrustedUI ),
CPolicyServer::EFailClient}
};
const CPolicyServer::TPolicy KMsmmServerSecurityPolicy =
{
- 0,
+ CPolicyServer::ECustomCheck,
KMsmmServerRangeCount,
KMsmmServerRanges,
KMsmmServerElementsIndex,
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/public/srverr.h Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/public/srverr.h Wed Jun 23 20:17:18 2010 +0300
@@ -31,6 +31,9 @@
// adding device
EHostMsErrInvalidParameter = 0x4, // Invalid request parameter
EHostMsErrOutOfMemory = 0x5, // Out of memory
+ EHostMsEjectInProgress = 0x6, // eject request commenced
+ EHostMsErrNone = 0x7, // no error == success condition
+ EHostMsErrInUse = 0x8, // Drives in use
EHostMsErrorEndMarker
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmdismountusbdrives.cpp Wed Jun 23 20:17:18 2010 +0300
@@ -0,0 +1,248 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* 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: Active Object to dismount usb drives
+*
+*/
+
+
+#include <usb/usblogger.h>
+#include <usb/hostms/srverr.h>
+#include <usb/hostms/msmmpolicypluginbase.h>
+
+#include "msmmdismountusbdrives.h"
+
+const TInt KDismountTimeOut = 6000000; // 6 seconds
+
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "UsbHostMsmmServer");
+#endif
+
+CMsmmDismountUsbDrives::~CMsmmDismountUsbDrives()
+ {
+ LOG_FUNC
+ Cancel();
+ delete iDismountTimer;
+ iRFs.Close();
+ }
+
+/**
+ * Symbian two phase constructor
+ */
+CMsmmDismountUsbDrives* CMsmmDismountUsbDrives::NewL()
+ {
+ LOG_STATIC_FUNC_ENTRY
+ CMsmmDismountUsbDrives* self = CMsmmDismountUsbDrives::NewLC();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+/**
+ * Symbian two phase constructor. Object pushed to cleanup stack
+ */
+CMsmmDismountUsbDrives* CMsmmDismountUsbDrives::NewLC()
+ {
+ LOG_STATIC_FUNC_ENTRY
+ CMsmmDismountUsbDrives* self = new (ELeave) CMsmmDismountUsbDrives();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+/**
+ * Check the status of current dismount request and continue issuing next if no error
+ */
+void CMsmmDismountUsbDrives::RunL()
+ {
+ LOG_FUNC
+
+ iDismountTimer->CancelTimer();
+
+ // Indicates there has been an error dismounting a usb drive, report immediately to MSMM plugin and
+ // abort the process
+ if ( iStatus != KErrNone )
+ {
+ CompleteDismountRequest( iStatus.Int() );
+ }
+ // Indicates we have reached the end of all usb drives dismounting, in other words a success condition
+ else if ( iDriveIndex == KMaxDrives )
+ {
+ CompleteDismountRequest( KErrNone );
+ }
+ // We still have more drives to traverse
+ else if ( iDriveIndex < KMaxDrives )
+ {
+ DoDismount();
+ }
+ }
+
+/**
+ * Cancel pending notifier and those in queue
+ */
+void CMsmmDismountUsbDrives::DoCancel()
+ {
+ LOG_FUNC
+ iRFs.NotifyDismountCancel(iStatus);
+ }
+
+CMsmmDismountUsbDrives::CMsmmDismountUsbDrives()
+ : CActive(EPriorityStandard)
+ {
+ LOG_FUNC
+ CActiveScheduler::Add(this);
+ }
+
+void CMsmmDismountUsbDrives::ConstructL()
+ {
+ LOG_FUNC
+ User::LeaveIfError( iRFs.Connect());
+ iDismountTimer = CDismountTimer::NewL(this);
+ }
+
+/**
+ * Dismount usb drives
+ */
+void CMsmmDismountUsbDrives::DismountUsbDrives(CMsmmPolicyPluginBase& aPlugin, TUSBMSDeviceDescription& aDevice)
+ {
+ LOG_FUNC
+ Cancel();
+ iPlugin = &aPlugin;
+ TUSBMSDeviceDescription& device = iDevicePkgInfo();
+ device = aDevice;
+ iDriveIndex = 0;
+ iRFs.DriveList( iDriveList );
+ DoDismount();
+ }
+
+/**
+ * Callback to CMsmmPolicyPluginBase with either success or failure message
+ */
+void CMsmmDismountUsbDrives::CompleteDismountRequest(const TInt aResult)
+ {
+ THostMsErrData data;
+ if( aResult == KErrNone )
+ data.iError = EHostMsErrNone;
+ else
+ data.iError = EHostMsErrInUse;
+ data.iE32Error = aResult;
+ data.iManufacturerString = iDevicePkgInfo().iManufacturerString;
+ data.iProductString = iDevicePkgInfo().iProductString;
+ data.iDriveName = 0x0;
+
+ TRAP_IGNORE(iPlugin->SendErrorNotificationL(data));
+ }
+
+/**
+ * Dismount next usb drive
+ */
+void CMsmmDismountUsbDrives::DoDismount()
+ {
+ LOG_FUNC
+ TDriveInfo info;
+ TInt err = KErrNone;
+ for ( ; iDriveIndex < KMaxDrives; iDriveIndex++ )
+ {
+ if ( iDriveList[iDriveIndex] )
+ {
+ err = iRFs.Drive( info , iDriveIndex );
+ if ( info.iConnectionBusType == EConnectionBusUsb &&
+ info.iDriveAtt & KDriveAttExternal &&
+ err == KErrNone )
+ {
+ LOGTEXT(_L("CMsmmDismountUsbDrives::DoDismount Dismount notify request "));
+ iRFs.NotifyDismount( iDriveIndex, iStatus, EFsDismountNotifyClients );
+ iDismountTimer->StartTimer();
+ SetActive();
+ return;
+ }
+ }
+ }
+ // Indicates we have gone through all the drives and no more usb drives left to request dismount
+ CompleteDismountRequest( KErrNone );
+ }
+
+
+/**
+ * Callback function from CDismountTimer after 6 seconds indicating a usb drive is not released by another process, report it as an error
+ */
+void CMsmmDismountUsbDrives::TimerExpired()
+ {
+ LOG_FUNC
+
+ Cancel();
+ iDismountTimer->CancelTimer();
+ CompleteDismountRequest( KErrInUse );
+ }
+
+//CDismountTimer
+
+CDismountTimer* CDismountTimer::NewL( MTimerNotifier* aTimeOutNotify)
+ {
+ LOG_STATIC_FUNC_ENTRY
+ CDismountTimer* self = CDismountTimer::NewLC( aTimeOutNotify );
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CDismountTimer* CDismountTimer::NewLC( MTimerNotifier* aTimeOutNotify )
+ {
+ LOG_STATIC_FUNC_ENTRY
+ CDismountTimer* self = new (ELeave) CDismountTimer( aTimeOutNotify );
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+CDismountTimer::CDismountTimer( MTimerNotifier* aTimeOutNotify):
+ CTimer(EPriorityStandard),
+ iNotify(aTimeOutNotify)
+ {
+ LOG_FUNC
+ }
+
+CDismountTimer::~CDismountTimer()
+ {
+ LOG_FUNC
+ Cancel();
+ }
+
+void CDismountTimer::ConstructL()
+ {
+ LOG_FUNC
+ if ( !iNotify )
+ {
+ User::Leave(KErrArgument);
+ }
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+void CDismountTimer::RunL()
+ {
+ LOG_FUNC
+ // Timer request has completed, so notify the timer's owner
+ iNotify->TimerExpired();
+ }
+void CDismountTimer::CancelTimer()
+ {
+ LOG_FUNC
+ Cancel();
+ }
+
+void CDismountTimer::StartTimer()
+ {
+ LOG_FUNC
+ After( KDismountTimeOut );
+ }
+// End of File
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmserver.cpp Wed Jun 23 20:17:18 2010 +0300
@@ -21,13 +21,14 @@
*/
#include "msmmserver.h"
-#include <usb/hostms/msmmpolicypluginbase.h>
#include "msmm_internal_def.h"
#include "msmmsession.h"
#include "msmmengine.h"
#include "eventqueue.h"
#include "msmmterminator.h"
+#include "msmmdismountusbdrives.h"
+#include <usb/hostms/msmmpolicypluginbase.h>
#include <usb/usblogger.h>
#ifdef __FLOG_ACTIVE
@@ -97,6 +98,26 @@
CleanupStack::PopAndDestroy(2, scheduler);
}
+CPolicyServer::TCustomResult CMsmmServer::CustomSecurityCheckL(
+ const RMessage2& aMsg,
+ TInt& /*aAction*/,
+ TSecurityInfo& /*aMissing*/)
+ {
+ CPolicyServer::TCustomResult returnValue = CPolicyServer::EFail;
+
+ TSecureId ClientSID = aMsg.SecureId();
+
+ if (KFDFWSecureId == ClientSID)
+ {
+ returnValue = CPolicyServer::EPass;
+ }
+ else if ((KSidHbDeviceDialogAppServer == ClientSID) && SessionNumber() > 0)
+ {
+ returnValue = CPolicyServer::EPass;
+ }
+ return returnValue;
+ }
+
// Public functions
// Construction and destruction
CMsmmServer* CMsmmServer::NewLC()
@@ -119,6 +140,8 @@
delete iEventQueue;
delete iEngine;
delete iTerminator;
+ delete iDismountErrData;
+ delete iDismountManager;
REComSession::FinalClose();
#ifndef __OVER_DUMMYCOMPONENT__
@@ -136,7 +159,7 @@
if (KMaxClientCount <= SessionNumber())
{
// There is a connection to MSMM server already.
- // Currently design of MSMM allows only one activated client
+ // Currently design of MSMM can have two clients, one FDF and the other Indicator UI
// at any time.
User::Leave(KErrInUse);
}
@@ -188,6 +211,26 @@
}
}
+void CMsmmServer::DismountUsbDrivesL(TUSBMSDeviceDescription& aDevice)
+ {
+ LOG_FUNC
+ delete iDismountManager;
+ iDismountManager = NULL;
+ iDismountManager= CMsmmDismountUsbDrives::NewL();
+
+ //Also notify the MSMM plugin of beginning of dismounting
+ iDismountErrData->iError = EHostMsEjectInProgress;
+ iDismountErrData->iE32Error = KErrNone;
+ iDismountErrData->iManufacturerString = aDevice.iManufacturerString;
+ iDismountErrData->iProductString = aDevice.iProductString;
+ iDismountErrData->iDriveName = 0x0;
+
+ TRAP_IGNORE(iPolicyPlugin->SendErrorNotificationL(*iDismountErrData));
+
+ // Start dismounting
+ iDismountManager->DismountUsbDrives(*iPolicyPlugin, aDevice);
+ }
+
// Private functions
// CMsmmServer Construction
CMsmmServer::CMsmmServer(TInt aPriority)
@@ -205,6 +248,7 @@
iEventQueue = CDeviceEventQueue::NewL(*this);
iTerminator = CMsmmTerminator::NewL(*iEventQueue);
iPolicyPlugin = CMsmmPolicyPluginBase::NewL();
+ iDismountErrData = new (ELeave) THostMsErrData;
if (!iPolicyPlugin)
{
// Not any policy plugin implementation available
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmsession.cpp Fri Jun 11 15:34:13 2010 +0300
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/msmmsession.cpp Wed Jun 23 20:17:18 2010 +0300
@@ -24,9 +24,9 @@
#include "msmmserver.h"
#include "msmmengine.h"
#include "eventqueue.h"
+#include "msmmnodebase.h"
#include <usb/hostms/srverr.h>
#include <usb/hostms/msmmpolicypluginbase.h>
-#include "msmmnodebase.h"
#include <usb/usblogger.h>
#ifdef __FLOG_ACTIVE
@@ -92,7 +92,10 @@
delete heapObj;
#endif // _DEBUG
break;
-
+
+ case EHostMsmmServerEjectUsbDrives:
+ iServer.DismountUsbDrivesL(iDevicePkg());
+ break;
default:
// Unsupported function number - panic the client
PanicClient(aMessage, EBadRequest);