# HG changeset patch # User Fionntina Carville # Date 1287762679 -3600 # Node ID b279b6be9e20a1f4a2c224300ee91d7435bee4d4 # Parent 25c602fd1f2664a4bdaa6098505b8e96781790b8# Parent ee9b31ff95f7a72ebb5875516b6ace4610f7cd61 Merge RCL_3 fixes diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppdialog.h diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/inc/refppnotifier.h diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/dialog.rss diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/host/functiondrivers/ms/msmm/refppnotifier/src/refppnotifier.cpp diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/subcommands.cpp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/subcommands.cpp Thu Sep 02 17:31:43 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/subcommands.cpp Fri Oct 22 16:51:19 2010 +0100 @@ -142,6 +142,9 @@ { LOG_FUNC + TRequestStatus* status = &iHandler.Status(); + User::RequestComplete(status, KErrCancel); + if(iInterfaceNode) { iInterfaceNode->iUsbMsDevice.Remove(); diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h --- a/usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h Thu Sep 02 17:31:43 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/INC/CUsbDevice.h Fri Oct 22 16:51:19 2010 +0100 @@ -1,5 +1,5 @@ /** -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -34,11 +34,12 @@ #include #include #include +#include class CUsbDeviceStateWatcher; class CUsbClassControllerBase; class CUsbServer; -class MUsbDeviceNotify; +class MUsbDeviceNotifyInternal; class CPersonality; class CUsbmanExtensionPlugin; @@ -60,7 +61,7 @@ * asynchronously, one by one. Its RunL function will be called after each * start/stop. */ -NONSHARABLE_CLASS(CUsbDevice) : public CActive, public MUsbClassControllerNotify, public MUsbmanExtensionPluginObserver +NONSHARABLE_CLASS(CUsbDevice) : public CActive, public MUsbClassControllerNotify, public MUsbmanExtensionPluginObserver, public MUsbThermalNotify { public: class TUsbDeviceDescriptor @@ -89,8 +90,8 @@ void EnumerateClassControllersL(); void AddClassControllerL(CUsbClassControllerBase* aClassController, TLinearOrder order); - void RegisterObserverL(MUsbDeviceNotify& aObserver); - void DeRegisterObserver(MUsbDeviceNotify& aObserver); + void RegisterObserverL(MUsbDeviceNotifyInternal& aObserver); + void DeRegisterObserver(MUsbDeviceNotifyInternal& aObserver); void StartL(); void Stop(); @@ -112,6 +113,7 @@ const RPointerArray& Personalities() const; const CPersonality* GetPersonality(TInt aPersonalityId) const; void ValidatePersonalitiesL(); + void StartThermalMonitoring(); void ReadPersonalitiesL(); void SetDefaultPersonalityL(); void LoadFallbackClassControllersL(); @@ -128,7 +130,10 @@ public: // from MUsbmanExtensionPluginObserver RDevUsbcClient& MuepoDoDevUsbcClient(); void MuepoDoRegisterStateObserverL(MUsbDeviceNotify& aObserver); - + +public: // from MUsbThermalNotify + void UsbThermalStateChange(TInt aLastError, TInt aValue); + protected: CUsbDevice(CUsbServer& aUsbServer); void ConstructL(); @@ -153,7 +158,9 @@ private: RPointerArray iSupportedClasses; RPointerArray iObservers; + RPointerArray iThermalObservers; RPointerArray iExtensionPlugins; + TUsbDeviceState iDeviceState; TUsbServiceState iServiceState; TInt iLastError; diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h --- a/usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h Thu Sep 02 17:31:43 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/INC/CUsbSession.h Fri Oct 22 16:51:19 2010 +0100 @@ -1,5 +1,5 @@ /** -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -30,6 +30,8 @@ #include "MUsbDeviceNotify.h" #include +#include "musbdevicenotifyinternal.h" + #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV #include "musbotghostnotifyobserver.h" #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV @@ -39,7 +41,7 @@ // (any state can only appear in the queue once) const TInt KDeviceStatesQueueSize = KUsbDeviceStates + 1; const TInt KOtgHostMessageQueueSize = KDeviceStatesQueueSize * 2; - +const TInt KUsbThermalStateSize = 5; // // Forward declarations // @@ -51,7 +53,7 @@ * Implements a Session of a Symbian OS server for the RUsb API */ NONSHARABLE_CLASS(CUsbSession) : public CSession2 - , public MUsbDeviceNotify + , public MUsbDeviceNotifyInternal #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV , public MUsbOtgHostNotifyObserver #endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV @@ -64,10 +66,11 @@ virtual void ServiceL(const RMessage2& aMessage); virtual void CreateL(); - // MUsbDeviceNotify + // MUsbDeviceNotifyInternal virtual void UsbDeviceStateChange(TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState); virtual void UsbServiceStateChange(TInt aLastError, TUsbServiceState aOldState, TUsbServiceState aNewState); - + virtual void UsbThermalStateChange(TInt aLastError, TInt aNewValue); + #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV // MUsbOtgHostNotifyObserver virtual void UsbOtgHostMessage(TInt aMessage); @@ -108,7 +111,10 @@ TInt SetCtlSessionMode(const RMessage2& aMessage); TInt RegisterMsgObserver(const RMessage2& aMessage, TBool& aComplete); TInt DeRegisterMsgObserver(); - + + // Thermal info + void ForwardThermalMessage(); + // OTG TInt BusRequest(); TInt BusRespondSrp(); @@ -161,6 +167,7 @@ TBool iPersonalityCfged; TFixedArray iDeviceStateQueue; + TUsbDeviceState iNotifiedDevState; TBool iObserverQueueEvents; TInt iDevStateQueueHead; @@ -169,7 +176,9 @@ #ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV static CUsbSession* iCtlSession; TBool iSessionCtlMode; - + TInt iUsbThermalLevel; + TBool iThernalLevelMsgPending; + RMessage2 iMsgObserverMessage; TBool iMsgObserverOutstanding; TFixedArray iMsgQueue; diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/usbman/server/INC/musbdevicenotifyinternal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/usbman/server/INC/musbdevicenotifyinternal.h Fri Oct 22 16:51:19 2010 +0100 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* 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 MUSBDEVICENOTIFYINTERNAL_H +#define MUSBDEVICENOTIFYINTERNAL_H + +#include +#include +/** + * The MUsbDeviceNotifyInternal class + * This is an internal class which is used for usb package only. + */ +class MUsbDeviceNotifyInternal : public MUsbDeviceNotify, public MUsbThermalNotify + { +public: + /** + * Called when the USB service state has changed + * + * @param aLastError The last error code detected + * @param aOldState The previous service state + * @param aNewState The new service state + */ + virtual void UsbServiceStateChange(TInt aLastError, TUsbServiceState aOldState, TUsbServiceState aNewState) = 0; + + /** + * Called when the USB device state has changed + * + * @param aLastError The last error code detected + * @param aOldState The previous device state + * @param aNewState The new device state + */ + virtual void UsbDeviceStateChange(TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState) = 0; + + /** + * Called when the thermal infomation had changed + * + * @param aLastError The last error code detected + * @param aNewValue The new value of thermal + */ + virtual void UsbThermalStateChange(TInt aLastError, TInt aNewValue) = 0; + }; + +#endif // MUSBDEVICENOTIFYINTERNAL_H + \ No newline at end of file diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp Thu Sep 02 17:31:43 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbDevice.cpp Fri Oct 22 16:51:19 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -31,6 +31,7 @@ #include #include "UsbUtils.h" #include +#include "musbdevicenotifyinternal.h" #ifdef USE_DUMMY_CLASS_CONTROLLER #include "CUsbDummyClassController.h" @@ -74,6 +75,7 @@ EUidArrayNotEmpty, }; +const TInt KUsbThermalInterfaceImplementationID = 0x10286a9c; CUsbDevice* CUsbDevice::NewL(CUsbServer& aUsbServer) /** @@ -117,6 +119,7 @@ // we don't want to call ResetAndDestroy, because we don't own // the observers themselves. iObservers.Reset(); + iThermalObservers.Reset(); #ifndef __WINS__ LOGTEXT2(_L8("about to delete device state watcher @ %08x"), (TUint32) iDeviceStateWatcher); @@ -260,9 +263,29 @@ LOGTEXT(_L8("<GetInterface(TUid::Uid(KUsbThermalInterfaceImplementationID)); + if(res != NULL) + { + LOGTEXT(_L8("<< UsbThermal Monitor plugin Found")); + MUsbThermalPluginInterface* tif = static_cast(res); + + // register ourself as an observer of thermal infor. + tif->RegisterThermalObserver(*this); + break; + } + } + } + void CUsbDevice::EnumerateClassControllersL() /** * Loads all USB class controllers at startup. @@ -353,7 +376,7 @@ } } -void CUsbDevice::RegisterObserverL(MUsbDeviceNotify& aObserver) +void CUsbDevice::RegisterObserverL(MUsbDeviceNotifyInternal& aObserver) /** * Register an observer of the device. * Presently, the device supports watching state. @@ -363,11 +386,11 @@ { LOG_FUNC - LEAVEIFERRORL(iObservers.Append(&aObserver)); + LEAVEIFERRORL(iThermalObservers.Append(&aObserver)); } -void CUsbDevice::DeRegisterObserver(MUsbDeviceNotify& aObserver) +void CUsbDevice::DeRegisterObserver(MUsbDeviceNotifyInternal& aObserver) /** * De-registers an existing device observer. * @@ -376,10 +399,10 @@ { LOG_FUNC - TInt index = iObservers.Find(&aObserver); + TInt index = iThermalObservers.Find(&aObserver); if (index >= 0) - iObservers.Remove(index); + iThermalObservers.Remove(index); } @@ -403,6 +426,9 @@ iLastError = KErrNone; StartCurrentClassController(); + + StartThermalMonitoring(); + } void CUsbDevice::Stop() @@ -434,11 +460,18 @@ // Change state straight away in case any of the clients check it TUsbServiceState oldState = iServiceState; iServiceState = aState; - TUint length = iObservers.Count(); + TUint length = iThermalObservers.Count(); for (TUint i = 0; i < length; i++) { - iObservers[i]->UsbServiceStateChange(LastError(), oldState, + iThermalObservers[i]->UsbServiceStateChange(LastError(), oldState, + iServiceState); + } + + length = iObservers.Count(); + for (TUint j = 0; j < length; j++) + { + iObservers[j]->UsbServiceStateChange(LastError(), oldState, iServiceState); } @@ -506,11 +539,17 @@ // Change state straight away in case any of the clients check it TUsbDeviceState oldState = iDeviceState; iDeviceState = state; - TUint length = iObservers.Count(); - + + TUint length = iThermalObservers.Count(); for (TUint i = 0; i < length; i++) { - iObservers[i]->UsbDeviceStateChange(LastError(), oldState, iDeviceState); + iThermalObservers[i]->UsbDeviceStateChange(LastError(), oldState, iDeviceState); + } + + length = iObservers.Count(); + for (TUint j = 0; j < length; j++) + { + iObservers[j]->UsbDeviceStateChange(LastError(), oldState, iDeviceState); } } } @@ -1078,7 +1117,10 @@ iLastError = KErrNone; StartCurrentClassController(); - } + + StartThermalMonitoring(); + + } TInt CUsbDevice::CurrentPersonalityId() const /** @@ -1551,5 +1593,25 @@ */ { LOGTEXT2(_L8("CUsbDevice::MuepoDoRegisterStateObserverL aObserver = 0x%08x"),&aObserver); - RegisterObserverL(aObserver); + + // Don't use RegisterObserverL() interface anymore, because + // aObserver is MUsbDeviceNotify + LEAVEIFERRORL(iObservers.Append(&aObserver)); } + +void CUsbDevice::UsbThermalStateChange(TInt aLastError, TInt aValue) + { + LOG_FUNC + + TUint length = iThermalObservers.Count(); + LOGTEXT2(_L8("CUsbDevice::UsbThermalStateChange found %d observers"),length); + if( length == 0) + { + return; + } + + for (TUint i = 0; i < length; i++) + { + iThermalObservers[i]->UsbThermalStateChange(aLastError, aValue); + } + } diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp --- a/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Thu Sep 02 17:31:43 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/SRC/CUsbSession.cpp Fri Oct 22 16:51:19 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -78,6 +78,9 @@ LOG_FUNC iUsbServer->IncrementSessionCount(); +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + iThernalLevelMsgPending = EFalse; +#endif // SYMBIAN_ENABLE_USB_OTG_HOST_PRIV } @@ -413,7 +416,30 @@ // is next called. } } - +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV +void CUsbSession::UsbThermalStateChange(TInt /*aLastError*/, TInt aNewValue) +#else +void CUsbSession::UsbThermalStateChange(TInt /*aLastError*/, TInt /*aNewValue*/) +#endif + { +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + LOG_FUNC + + // Update local copy with the latest value from P&S key + iUsbThermalLevel = aNewValue; + + // Forward it to upper layer if there is a client pending there + if (iMsgObserverOutstanding) + { + ForwardThermalMessage(); + } + else + { + iThernalLevelMsgPending = ETrue; + } +#endif //SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + } + /** * Dequeues an event and completes the observer's request with it. */ @@ -450,6 +476,25 @@ } } +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + +void CUsbSession::ForwardThermalMessage() + { + LOG_FUNC + + TPckg pckg(iUsbThermalLevel); + + // Mark no pending since we're going to complete client request. + iMsgObserverOutstanding = EFalse; + + // Mark no new thermal message need to be forward + iThernalLevelMsgPending = EFalse; + + const TInt err = iMsgObserverMessage.Write(0, pckg); + iMsgObserverMessage.Complete(err); + } +#endif //SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + /** * Handles the request (in the form of a the message) received from the client * @@ -883,14 +928,14 @@ LOGTEXT(_L8(" Reset Device Event Queue")); iDevStateQueueHead = 0; iDevStateQueueTail = 0; - iObserverQueueEvents = ETrue; + iObserverQueueEvents = ETrue; } else if (iDevStateQueueHead != iDevStateQueueTail) { // event(s) queued, we can de-queue one now UsbDeviceDequeueEvent(); } - + return KErrNone; } @@ -915,7 +960,9 @@ iServiceObserverMessage = aMessage; iServiceObserverOutstanding = ETrue; + aComplete = EFalse; + return KErrNone; } @@ -1924,7 +1971,15 @@ // event(s) queued, we can de-queue one now UsbMsgDequeue(); } - + +#ifdef SYMBIAN_ENABLE_USB_OTG_HOST_PRIV + if (iThernalLevelMsgPending) + { + ForwardThermalMessage(); + aComplete = ETrue; + } +#endif + return KErrNone; } diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/usbman/server/group/BLD.INF --- a/usbmgmt/usbmgr/usbman/server/group/BLD.INF Thu Sep 02 17:31:43 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/group/BLD.INF Fri Oct 22 16:51:19 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -27,7 +27,8 @@ ../public/usbshared.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/usbshared.h) ../public/usbotgdefs.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usbotgdefs.h) ../public/usbhostdefs.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usbhostdefs.h) -./backup_registration.xml /epoc32/data/z/private/101fe1db/backup_registration.xml +../public/musbthermalnotify.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(musbthermalnotify.h) +./backup_registration.xml /epoc32/data/z/private/101fe1db/backup_registration.xml PRJ_TESTEXPORTS diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/usbman/server/public/MUsbDeviceNotify.h --- a/usbmgmt/usbmgr/usbman/server/public/MUsbDeviceNotify.h Thu Sep 02 17:31:43 2010 +0100 +++ b/usbmgmt/usbmgr/usbman/server/public/MUsbDeviceNotify.h Fri Oct 22 16:51:19 2010 +0100 @@ -15,16 +15,9 @@ * */ -/** @file - * - * The mixin used by the USB Device object to notify all of - * it's observers of any state changes that occur - * - * Copyright (c) 1997-2007 Symbian Ltd. All rights reserved. - */ -#ifndef __MUSBDEVICENOTIFY_H__ -#define __MUSBDEVICENOTIFY_H__ +#ifndef MUSBDEVICENOTIFY_H +#define MUSBDEVICENOTIFY_H #include @@ -59,5 +52,5 @@ virtual void UsbDeviceStateChange(TInt aLastError, TUsbDeviceState aOldState, TUsbDeviceState aNewState) = 0; }; -#endif +#endif //MUSBDEVICENOTIFY_H diff -r ee9b31ff95f7 -r b279b6be9e20 usbmgmt/usbmgr/usbman/server/public/musbthermalnotify.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbmgmt/usbmgr/usbman/server/public/musbthermalnotify.h Fri Oct 22 16:51:19 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* 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 MUSBTHERMALNOTIFY_H +#define MUSBTHERMALNOTIFY_H + +#include + +// Class used to be used as callbacks to report thermal information +class MUsbThermalNotify + { +public: + /** + * Called by thermal monitor plugin when there is any changes about thermal info + * + * @param aLastError The last error code detected + * @param aValue The new value of thermal + */ + virtual void UsbThermalStateChange(TInt aLastError, TInt aValue) = 0; + }; + +/** + * This class is used by usbman server to register itself as an observer of + * system thermal event. + */ +class MUsbThermalPluginInterface + { +public: + virtual void RegisterThermalObserver(MUsbThermalNotify& aThermalObserver) = 0; + }; + +#endif //MUSBTHERMALNOTIFY_H