# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268649882 -7200 # Node ID ff9df66302741b3b78d88f9de64c5857e24b13b9 # Parent a15c582fbf976e98e8b3e35edc0aa75c12dd2a0a Revision: 201009 Kit: 201010 diff -r a15c582fbf97 -r ff9df6630274 usbclasses/usbobexclasscontroller/group/UsbObexClassController.mmp --- a/usbclasses/usbobexclasscontroller/group/UsbObexClassController.mmp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbclasses/usbobexclasscontroller/group/UsbObexClassController.mmp Mon Mar 15 12:44:42 2010 +0200 @@ -28,6 +28,7 @@ SOURCEPATH ../src SOURCE CUsbObexClassImpCollection.cpp SOURCE CUsbObexClassController.cpp +SOURCE obexsmwatcher.cpp USERINCLUDE ../inc diff -r a15c582fbf97 -r ff9df6630274 usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h --- a/usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbclasses/usbobexclasscontroller/inc/CUsbObexClassController.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-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" @@ -23,6 +23,7 @@ #include #include #include +#include "obexsmwatcher.h" const TInt KObexClassPriority = 2; const TInt KObexNumInterfaces = 2; @@ -35,7 +36,7 @@ * * @since S60 V3.1 */ -NONSHARABLE_CLASS(CUsbObexClassController) : public CUsbClassControllerPlugIn +NONSHARABLE_CLASS(CUsbObexClassController) : public CUsbClassControllerPlugIn, public MObexSMObserver { public: /** @@ -53,6 +54,9 @@ virtual void DoCancel(); virtual TInt RunError(TInt aError); +// from MObexSMObserver + void MosmError(TInt aError); + // from base class CUsbClassControllerBase /** @@ -95,6 +99,7 @@ private: // data TRequestStatus* iRequestStatus; CObexUSB* iObexSM; + CObexSMWatcher *iObexSMWatcher; }; #endif // CUSBOBEXCLASSCONTROLLER_H diff -r a15c582fbf97 -r ff9df6630274 usbclasses/usbobexclasscontroller/inc/mobexsmwatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbclasses/usbobexclasscontroller/inc/mobexsmwatcher.h Mon Mar 15 12:44:42 2010 +0200 @@ -0,0 +1,27 @@ +/* +* 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: Monitors Obex ServiceMan errors. +* +*/ + +#ifndef MOBEXSMWATCHER_H +#define MOBEXSMWATCHER_H + +class MObexSMObserver + { +public: + virtual void MosmError(TInt aError) = 0; + }; + +#endif diff -r a15c582fbf97 -r ff9df6630274 usbclasses/usbobexclasscontroller/inc/obexsmwatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbclasses/usbobexclasscontroller/inc/obexsmwatcher.h Mon Mar 15 12:44:42 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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: Monitors Obex ServiceMan errors. +* +*/ + +#ifndef COBEXSMWATCHER_H +#define COBEXSMWATCHER_H + +#include +#include +#include +#include //Publish & Subscribe header +#include "mobexsmwatcher.h" + +/** + * CObexSMWatcher class + * Subscribes to ObexServiceMan property changes to monitor initialization errors + */ +class CObexSMWatcher : public CActive + { +public: + static CObexSMWatcher* NewL(MObexSMObserver& aObserver); + virtual ~CObexSMWatcher(); + + // From CActive + virtual void RunL(); + virtual void DoCancel(); + +protected: + CObexSMWatcher(MObexSMObserver& aObserver); + void ConstructL(); + +private: + // An observer object for obexseviceman P&S keys + MObexSMObserver& iObserver; + // A property object for obexseviceman P&S keys + RProperty iObexSMPostInit; + }; + +#endif diff -r a15c582fbf97 -r ff9df6630274 usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp --- a/usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbclasses/usbobexclasscontroller/src/CUsbObexClassController.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 - 2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002 - 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" @@ -21,6 +21,8 @@ #include #include #include //for CleanupResetAndDestroyPushL +#include + // Panic category only used in debug builds #ifdef _DEBUG _LIT( KObexCcPanicCategory, "OBEXCC" ); @@ -79,6 +81,7 @@ { LOG_FUNC iObexSM = CObexUSB::NewL(); + iObexSMWatcher = CObexSMWatcher::NewL(*this); } // --------------------------------------------------------------------------- @@ -90,7 +93,8 @@ { LOG_FUNC Cancel(); - delete iObexSM; + delete iObexSM; + delete iObexSMWatcher; } // --------------------------------------------------------------------------- @@ -258,5 +262,12 @@ LOGTEXT2(_L8("CUsbObexClassController::RunError aError=%d"), aError); return KErrNone; } - + +void CUsbObexClassController::MosmError(TInt aError) + { + LOG_FUNC + LOGTEXT2(_L8("CUsbObexClassController::MosmError aError=%d"), aError); + Owner().UccnError(aError); + } + // End of File diff -r a15c582fbf97 -r ff9df6630274 usbclasses/usbobexclasscontroller/src/obexsmwatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbclasses/usbobexclasscontroller/src/obexsmwatcher.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -0,0 +1,104 @@ +/* +* 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: Monitors Obex ServiceMan errors. +* +*/ + +#include "obexsmwatcher.h" +#include +#include +#include + +#ifdef __FLOG_ACTIVE +_LIT8(KLogComponent, "UsbObexCcSMW"); +#endif + +/** + * @since S60 V5.2 + */ +CObexSMWatcher* CObexSMWatcher::NewL(MObexSMObserver& aObserver) + { + LOG_STATIC_FUNC_ENTRY + + CObexSMWatcher* self = new (ELeave) CObexSMWatcher(aObserver); + CleanupStack::PushL( self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + * + */ +CObexSMWatcher::~CObexSMWatcher() + { + LOG_FUNC + Cancel(); + iObexSMPostInit.Close(); + } + +/** + * Performs 2nd phase construction. + */ +void CObexSMWatcher::ConstructL() + { + LOG_FUNC + + TInt err = iObexSMPostInit.Attach(KUidObexSMCategory, KObexSMPostInitErrorProperty); + User::LeaveIfError( err); + + RunL(); + } + +/** + * + */ + +CObexSMWatcher::CObexSMWatcher(MObexSMObserver& aObserver) : + CActive(CActive::EPriorityStandard), iObserver(aObserver) + { + LOG_FUNC + CActiveScheduler::Add(this); + } + +/** + * + */ +void CObexSMWatcher::RunL() + { + LOG_FUNC + + LOGTEXT2(_L8(">>CObexSMWatcher::RunL [iStatus=%d]"), iStatus.Int()); + + iObexSMPostInit.Subscribe( iStatus ); + SetActive(); + + TInt value = KErrNone; + TInt err = iObexSMPostInit.Get(value); + if (err == KErrNone && value != KErrNone) + { + iObserver.MosmError(value); + } + + LOGTEXT(_L8("< #include - -#include "cusbotgwatcher.h" +#include -#ifndef STIF -#include "cusbidpinobserver.h" -#include "cusbvbusobserver.h" -#include "cusbotgstateobserver.h" -#include "cusbbusactivityobserver.h" -#include "cusbhosteventnotificationobserver.h" -#include "cusbmessagenotificationobserver.h" -#else -#include "mockcusbidpinobserver.h" -#include "mockcusbvbusobserver.h" -#include "mockcusbotgstateobserver.h" -#include "mockcusbbusactivityobserver.h" -#include "mockcusbhosteventnotificationobserver.h" -#include "mockcusbmessagenotificationobserver.h" -#endif +#include "definitions.h" + +class CUsbOtgWatcher; /** * Base class for usb states @@ -76,12 +63,6 @@ */ virtual ~CUsbState(); - /** - * Two-phased constructor. - * @param aWatcher owner - */ - //static CUsbState* NewL(CUsbOtgWatcher& aWatcher); - protected: /** * default constructor is protected to be able to be inherited be child classes diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehostabase.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostabase.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -65,12 +65,12 @@ virtual void AVBusErrorL(); /** - * VBus error happen + * Become A host */ virtual void AHostL(); /** - * VBus error happen + * become A peripheral */ virtual void APeripheralL(); @@ -90,18 +90,22 @@ * @param aMessage message id */ virtual void MessageNotificationReceivedL(TInt aMessage); + /** * SRP request received */ virtual void SrpReceivedL(); + /** * Connected to hub in wrong level */ virtual void BadHubPositionL(); + /** * VBus error happened */ virtual void VBusErrorL(); + /** * Session request received */ diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehostahost.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostahost.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostahost.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostainitiate.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -102,27 +102,33 @@ // From Host Event notification observer /** * Device is attached - * @param Device event data + * @param aInfo Device event data */ - void DeviceAttachedL(TDeviceEventInformation); + void DeviceAttachedL(TDeviceEventInformation aInfo); + + /** + * Device is detached + * @param aInfo Device event data + */ + void DeviceDetachedL(TDeviceEventInformation aInfo); /** * Device is detached - * @param Device event data + * @param aInfo Device event data */ - void DriverLoadSuccessL(TDeviceEventInformation); + void DriverLoadSuccessL(TDeviceEventInformation aInfo); /** * Drivers loaded partially - * @param Device event data + * @param aInfo Device event data */ - void DriverLoadPartialSuccessL(TDeviceEventInformation); + void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo); /** * Drivers loading failed - * @param Device event data + * @param aInfo Device event data */ - void DriverLoadFailureL(TDeviceEventInformation); + void DriverLoadFailureL(TDeviceEventInformation aInfo); private: // data @@ -133,6 +139,10 @@ */ CUsbTimer* iAttachmentTimer; + /* + * attachment attribute + */ + TBool iDeviceAttached; }; #endif // C_USBSTATEHOSTINITIATE_H diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostaperipheral.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -67,6 +67,11 @@ * Became a host when A */ void AHostL(); + + /** + * Became to Idle when A + */ + void AIdleL(); private: // data diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehostdelayattachedhandle.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostdelayattachedhandle.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelayattachedhandle.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelayhandle.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehostdelaynotattachedhandle.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostdelaynotattachedhandle.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostdelaynotattachedhandle.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -18,7 +18,7 @@ #ifndef C_USBSTATEHOSTDELAYANOTTTACHEDHANDLE_H #define C_USBSTATEHOSTDELAYNOTATTACHEDHANDLE_H -#include "cusbstatehostdelayattachedhandle.h" +#include "cusbstatehostdelayhandle.h" #ifndef STIF #include "cusbtimer.h" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehosthandle.h --- a/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehosthandle.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehosthandledropping.h --- a/usbengines/usbotgwatcher/inc/cusbstatehosthandledropping.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehosthandledropping.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -73,6 +73,11 @@ */ void VBusDownL(); + /** + * VBus error happen + */ + void AVBusErrorL(); + // From Host Event notification observer /** * Device is attached @@ -111,12 +116,17 @@ */ void MessageNotificationReceivedL(TInt aMessage); + /** + * VBus error happened + */ + void VBusErrorL(); + //from CUsbState /** * State id * @return state id */ - virtual TUsbStateIds Id(); + TUsbStateIds Id(); /** * This is called when leaving this state, diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbstatehostundefined.h --- a/usbengines/usbotgwatcher/inc/cusbstatehostundefined.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbstatehostundefined.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -19,6 +19,7 @@ #define C_USBSTATEHOSTUNDEFINED_H #include "cusbstatehostabase.h" + class CUsbOtgWatcher; /** * This class implements behaviour in undefined state (when host) @@ -56,64 +57,90 @@ * This might be used in switching states in watcher. New state object searched by its id * @return Id */ - virtual TUsbStateIds Id(); + TUsbStateIds Id(); // From VBus observer /** * VBus down */ - virtual void VBusDownL(); + void VBusDownL(); /** * VBus UP */ - virtual void VBusUpL(); + void VBusUpL(); /** * VBus error */ - virtual void VBusErrorL(); + void VBusErrorL(); /** * AVBus Error */ - virtual void AVBusErrorL(); + void AVBusErrorL(); /** * Became to Idle when B */ - virtual void BIdleL(); + void BIdleL(); /** * Became to Peripheral when B */ - virtual void BPeripheralL(); + void BPeripheralL(); // From Host Event notification observer /** + * Device is attached + * @param aInfo Device event data + */ + void DeviceAttachedL(TDeviceEventInformation aInfo); + + /** * Device is detached * @param aInfo Device event data */ - virtual void DeviceDetachedL(TDeviceEventInformation aInfo); + void DeviceDetachedL(TDeviceEventInformation aInfo); + + /** + * Drivers successfully loaded + * @param aInfo Device event data + */ + void DriverLoadSuccessL(TDeviceEventInformation aInfo); + + /** + * Drivers loaded partially + * @param aInfo Device event data + */ + void DriverLoadPartialSuccessL(TDeviceEventInformation aInfo); + /** + * Drivers loading failed + * @param aInfo Device event data + */ + void DriverLoadFailureL(TDeviceEventInformation aInfo); // From message notification observer /** * Message received * @param aMessage message id */ - virtual void MessageNotificationReceivedL(TInt aMessage); + void MessageNotificationReceivedL(TInt aMessage); + /** * SRP request received */ - virtual void SrpReceivedL(); + void SrpReceivedL(); + /** * Connected to hub in wrong level */ - virtual void BadHubPositionL(); + void BadHubPositionL(); + /** * Session request received */ - virtual void SessionRequestedL(); + void SessionRequestedL(); private: // data diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbtimer.h --- a/usbengines/usbotgwatcher/inc/cusbtimer.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbtimer.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbvbusobserver.h --- a/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbvbusobserver.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbwaitnotifier.h --- a/usbengines/usbotgwatcher/inc/cusbwaitnotifier.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbwaitnotifier.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/cusbwarningnotifier.h --- a/usbengines/usbotgwatcher/inc/cusbwarningnotifier.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/cusbwarningnotifier.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/debug.h --- a/usbengines/usbotgwatcher/inc/debug.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/debug.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This material, including documentation and any related computer * programs, is protected by copyright controlled by Nokia. All @@ -97,7 +97,7 @@ TPtrC8 iFuncName; }; // =========================================================================== -#else //Real-time logging +#else //LOG_TO_FILE not defined // =========================================================================== #include @@ -127,20 +127,22 @@ }; #endif // LOG_TO_FILE -#define LEAVE( exp ) {volatile TInt err = exp; \ - LOG3( "LEAVE(%d) @file: %s, line: %d", err, __FILE__, __LINE__ );\ - User::Leave( err );} +#define LEAVE( exp ) {volatile TInt err_ = exp; \ + LOG3( "LEAVE(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ + User::Leave( err_ );} -#define LEAVEIFERROR( exp ) {volatile TInt err = exp; if(err < 0) LEAVE(err);} +#define LEAVEIFERROR( exp ) {volatile TInt err__ = exp; \ + if(err__ < 0) LEAVE(err__);} -#define PANIC( exp ) {volatile TInt err = exp; \ - LOG3( "PANIC(%d) @file: %s, line: %d", err, __FILE__, __LINE__ );\ - User::Panic( KUsbPanicModule, err );} - +#define PANIC( exp ) {volatile TInt err_ = exp; \ + LOG3( "PANIC(%d) @file: %s, line: %d", err_, __FILE__, __LINE__ );\ + User::Panic( KUsbPanicModule, err_ );} #define LOG_FUNC TFuncLogger __instrument(TPtrC8((TUint8*)__PRETTY_FUNCTION__)); -#else // _DEBUG +#define ASSERT_PANIC( exp, code ) {if(!(exp)) PANIC(code)} + +#else // _DEBUG not defined // =========================================================================== #define LOG( s ) @@ -151,8 +153,9 @@ #define LOG_FUNC_EXIT #define LEAVE( exp ) User::Leave( exp ); #define LEAVEIFERROR( exp ) User::LeaveIfError( exp ); -#define PANIC( err ) User::Panic( KUsbPanicModule, err ); +#define PANIC( err ) // in non-debug builds PANICs are silent #define LOG_FUNC +#define ASSERT_PANIC( exp, code ) // =========================================================================== #endif // _DEBUG // =========================================================================== diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/definitions.h --- a/usbengines/usbotgwatcher/inc/definitions.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/definitions.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/errors.h --- a/usbengines/usbotgwatcher/inc/errors.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/errors.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -41,7 +41,8 @@ EUsbWatcherCanNotStartSession, EUsbWatcherCanNotEnableDriverLoading, EUsbWatcherCanNotClearBusError, - EUsbWatcherCanNotRaiseVBus + EUsbWatcherCanNotRaiseVBus, + EUsbWatcherNoMemory }; diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/inc/panic.h --- a/usbengines/usbotgwatcher/inc/panic.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/inc/panic.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -14,10 +14,12 @@ * Description: Central place for debug-type macros & functions * */ -#ifndef USBWATCHER_PANIC_H -#define USBWATCHER_PANIC_H +#ifndef C_PANIC_H +#define C_PANIC_H + #include #include + _LIT(KUsbWatcherPanic, "UsbOTGWatcher"); enum TUsbWatcherPanic @@ -118,10 +120,4 @@ }; -/** - * Shows application name and panic code - * @param aPanicId panic id - */ -void Panic(TUsbWatcherPanic aPanicId); - -#endif // USBWATCHER_PANIC_H +#endif // C_PANIC_H diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbbusactivityobserver.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -41,7 +41,7 @@ { LOG_FUNC - User::LeaveIfError(iBusActivity.Attach(KUidUsbManCategory, + LEAVEIFERROR(iBusActivity.Attach(KUidUsbManCategory, KUsbOtgConnectionIdleProperty)); } @@ -92,7 +92,7 @@ if (KErrNone != err) { LOG("ECanNotGetBusActivityProperty" ); - Panic( ECanNotGetBusActivityProperty); + PANIC( ECanNotGetBusActivityProperty); } return (0 == val ? EBusActive : EBusIdle); @@ -111,7 +111,7 @@ if (KErrNotFound != iObservers.Find(&aObserver)) { LOG( "Observer already exists" ); - Panic( EObserverAlreadyExists); + PANIC( EObserverAlreadyExists); return; } iObservers.AppendL(&aObserver); @@ -136,7 +136,7 @@ if (KErrNotFound == i) { LOG( "Observer not found" ); - Panic( ECanNotFindBusActivityObserver); + PANIC( ECanNotFindBusActivityObserver); return; } @@ -202,7 +202,7 @@ default: { LOG("WrongBusState" ); - Panic( EWrongBusState); + PANIC( EWrongBusState); } } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbhosteventnotificationobserver.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -88,7 +88,7 @@ if (KErrNotFound != iObservers.Find(&aObserver)) { LOG("Observer already exists" ); - Panic( EObserverAlreadyExists); + PANIC( EObserverAlreadyExists); return; } @@ -115,7 +115,7 @@ if (KErrNotFound == i) { LOG("Observer not found"); - Panic( ECanNotFindHostEventNotificationObserver); + PANIC( ECanNotFindHostEventNotificationObserver); return; } @@ -210,8 +210,8 @@ { iObservers[i]->DriverLoadPartialSuccessL(dei); } + break; - } case EDriverLoadFailure: { @@ -226,7 +226,7 @@ default: { LOG("WrongDriverLoadStatus" ); - Panic( EWrongDriverLoadStatus); + PANIC( EWrongDriverLoadStatus); } } break; @@ -235,11 +235,9 @@ default: { LOG( "WrongHostEventNotification" ); - Panic( EWrongHostEventNotification); + PANIC( EWrongHostEventNotification); } - } - } // --------------------------------------------------------------------------- diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbidpinobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbidpinobserver.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -41,7 +41,7 @@ { LOG_FUNC - User::LeaveIfError(iIdPin.Attach(KUidUsbManCategory, + LEAVEIFERROR(iIdPin.Attach(KUidUsbManCategory, KUsbOtgIdPinPresentProperty)); } @@ -92,7 +92,7 @@ if (KErrNone != err) { LOG("CanNotGetIdPinProperty" ); - Panic( ECanNotGetIdPinProperty); + PANIC( ECanNotGetIdPinProperty); } return (EFalse == val ? EIdPinOff : EIdPinOn); @@ -110,7 +110,7 @@ if (KErrNotFound != iObservers.Find(&aObserver)) { LOG("Observer already exists" ); - Panic( EObserverAlreadyExists); + PANIC( EObserverAlreadyExists); return; } iObservers.AppendL(&aObserver); @@ -135,7 +135,7 @@ if (KErrNotFound == i) { LOG("Observer not found"); - Panic( ECanNotFindIdPinObserver); + PANIC( ECanNotFindIdPinObserver); return; } @@ -188,7 +188,6 @@ } break; } - ; case EIdPinOff: { @@ -200,12 +199,11 @@ } break; } - ; default: { LOG("WrongIdPinState"); - Panic( EWrongIdPinState); + PANIC( EWrongIdPinState); } } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -182,7 +182,7 @@ default: { LOG1("Unknown timer id = %d", aTimerId) - Panic(EWrongTimerId); + PANIC(EWrongTimerId); } } } @@ -244,9 +244,9 @@ // void CUsbIndicatorNotifier::SetIndicatorL() { - if (!(iOtgWatcher.IsDeviceA())) + if (!(iOtgWatcher.IsDeviceA()) || iOtgWatcher.CurrentHostState()->Id() == EUsbStateHostAPeripheral) { - // if B, than other party (usbwatcher) takes care of usb indicator + // if B or peripheral, than other party (usbwatcher) takes care of usb indicator // in combined usbwatcher (if role swap allowed) one class has to manage usb indicator return; } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbmessagenotificationobserver.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -89,7 +89,7 @@ if (KErrNotFound != iObservers.Find(&aObserver)) { LOG("Observer already exists"); - Panic( EObserverAlreadyExists); + PANIC( EObserverAlreadyExists); return; } iObservers.AppendL(&aObserver); @@ -114,7 +114,7 @@ if (KErrNotFound == i) { LOG("Observer not found" ) - Panic( ECanNotFindMessageNotificationObserver); + PANIC( ECanNotFindMessageNotificationObserver); return; } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbnotenotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbnotenotifier.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -110,12 +110,13 @@ if (IsActive()) { - Panic( ENotifierIsActiveAlready); + PANIC( ENotifierIsActiveAlready); return; - } - + } + iNotifIdPckg() = iUsbNoteNotifier.iNotifId; - iNotifier.StartNotifierAndGetResponse(iStatus, iUsbNoteNotifier.iCat, iNotifIdPckg, iRes); + iNotifier.StartNotifierAndGetResponse(iStatus, iUsbNoteNotifier.iCat, + iNotifIdPckg, iRes); SetActive(); } @@ -130,7 +131,7 @@ LOG1( "iStatus = %d" , iStatus.Int()); // if error occured, deal with it in RunError - User::LeaveIfError(iStatus.Int()); + LEAVEIFERROR(iStatus.Int()); iNotifier.CancelNotifier(iUsbNoteNotifier.iCat); diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbnotifmanager.cpp --- a/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbnotifmanager.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -114,7 +114,7 @@ { LOG_FUNC - User::LeaveIfError(iNotifier.Connect()); + LEAVEIFERROR(iNotifier.Connect()); iIndicatorNotifier = CUsbIndicatorNotifier::NewL(*this, aOtgWatcher); @@ -179,7 +179,7 @@ CUsbNotifier* notifier(NULL); if (aCat == KUsbUiNotifOtgError) { - __ASSERT_ALWAYS(aObserver != NULL, Panic(EWrongNotifierCategory)); + ASSERT_PANIC(aObserver != NULL, EWrongNotifierCategory); notifier = CUsbWaitNotifier::NewL(iNotifier, *this, aNotifId); } else if (aCat == KUsbUiNotifOtgWarning) @@ -189,7 +189,7 @@ else { LOG1("Unexpected aCat = 0x%X", aCat ); - Panic(EWrongNotifierCategory); + PANIC(EWrongNotifierCategory); } CleanupStack::PushL(notifier); diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbotgstateobserver.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -39,7 +39,7 @@ { LOG_FUNC - User::LeaveIfError(iOtgState.Attach(KUidUsbManCategory, + LEAVEIFERROR(iOtgState.Attach(KUidUsbManCategory, KUsbOtgStateProperty)); } @@ -88,7 +88,7 @@ if (KErrNone != err) { LOG("CanNotGetOtgStateProperty" ); - Panic( ECanNotGetOtgStateProperty); + PANIC( ECanNotGetOtgStateProperty); } return (TUsbOtgState) val; @@ -107,7 +107,7 @@ if (KErrNotFound != iObservers.Find(&aObserver)) { LOG( "Observer already exists" ); - Panic( EObserverAlreadyExists); + PANIC( EObserverAlreadyExists); return; } iObservers.AppendL(&aObserver); @@ -132,7 +132,7 @@ if (KErrNotFound == i) { LOG("Observer not found"); - Panic( ECanNotFindOtgStateObserver); + PANIC( ECanNotFindOtgStateObserver); return; } @@ -245,7 +245,7 @@ default: { LOG("WrongOtgState" ); - Panic( EWrongOtgState); + PANIC( EWrongOtgState); } } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbotgwatcher.cpp --- a/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -64,28 +64,28 @@ #endif #ifndef STIF - User::LeaveIfError(RProperty::Define(KPSUidUsbWatcher, - KUsbWatcherIsPeripheralConnected, RProperty::EInt, - KAlwaysPassPolicy, KLocalServicesPolicy)); + LEAVEIFERROR(RProperty::Define(KPSUidUsbWatcher, + KUsbWatcherIsPeripheralConnected, RProperty::EInt, + KAlwaysPassPolicy, KLocalServicesPolicy)); - User::LeaveIfError(RProperty::Set(KPSUidUsbWatcher, - KUsbWatcherIsPeripheralConnected, - KUsbWatcherPeripheralIsNotConnected)); + LEAVEIFERROR(RProperty::Set(KPSUidUsbWatcher, + KUsbWatcherIsPeripheralConnected, + KUsbWatcherPeripheralIsNotConnected)); #endif iUsbServiceControl = CUsbServiceControl::NewL(*this, iUsb); - User::LeaveIfError(iStates.Append(CUsbStateHostUndefined::NewL(*this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(*this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(*this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(*this))); + LEAVEIFERROR(iStates.Append(CUsbStateHostUndefined::NewL(*this))); + LEAVEIFERROR(iStates.Append(CUsbStateHostAInitiate::NewL(*this))); + LEAVEIFERROR(iStates.Append(CUsbStateHostAHost::NewL(*this))); + LEAVEIFERROR(iStates.Append(CUsbStateHostAPeripheral::NewL(*this))); - User::LeaveIfError(iStates.Append(CUsbStateHostDelayAttachedHandle::NewL( - *this))); - User::LeaveIfError(iStates.Append( - CUsbStateHostDelayNotAttachedHandle::NewL(*this))); - User::LeaveIfError(iStates.Append( - CUsbStateHostHandleDropping::NewL(*this))); + LEAVEIFERROR(iStates.Append(CUsbStateHostDelayAttachedHandle::NewL( + *this))); + LEAVEIFERROR(iStates.Append( + CUsbStateHostDelayNotAttachedHandle::NewL(*this))); + LEAVEIFERROR(iStates.Append( + CUsbStateHostHandleDropping::NewL(*this))); iIdPinObserver = CUsbIdPinObserver::NewL(); iVBusObserver = CUsbVBusObserver::NewL(); @@ -122,7 +122,7 @@ // EXPORT_C TBool CUsbOtgWatcher::IsDeviceA() { - __ASSERT_DEBUG(iIdPinObserver != NULL, Panic(EIdPinObserverNULLPointer)); + ASSERT_PANIC(iIdPinObserver != NULL, EIdPinObserverNULLPointer); return (iIdPinObserver->IdPin() == CUsbIdPinObserver::EIdPinOn ? ETrue : EFalse); @@ -356,7 +356,7 @@ if (KErrNone != err) { LOG( "ErrorStoppingUsbServices" ); - Panic(ECanNotStopUsbServices); + PANIC(ECanNotStopUsbServices); } } @@ -366,7 +366,7 @@ // void CUsbOtgWatcher::IdPinErrorL(TInt aError) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); HandleHostProblemL(EUsbWatcherIdPinError, EUsbStateHostHandleDropping); } @@ -378,7 +378,7 @@ // void CUsbOtgWatcher::VBusDownL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->VBusDownL(); } @@ -388,7 +388,7 @@ // void CUsbOtgWatcher::VBusUpL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->VBusUpL(); } @@ -398,7 +398,7 @@ // void CUsbOtgWatcher::VBusObserverErrorL(TInt aError) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); HandleHostProblemL(EUsbWatcherVBusObserverError, EUsbStateHostHandleDropping); } @@ -410,7 +410,7 @@ // void CUsbOtgWatcher::AIdleL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->AIdleL(); } @@ -420,7 +420,7 @@ // void CUsbOtgWatcher::AHostL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->AHostL(); } @@ -430,7 +430,7 @@ // void CUsbOtgWatcher::APeripheralL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->APeripheralL(); } @@ -440,7 +440,7 @@ // void CUsbOtgWatcher::AVBusErrorL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->AVBusErrorL(); } @@ -450,7 +450,7 @@ // void CUsbOtgWatcher::BIdleL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->BIdleL(); } @@ -460,7 +460,7 @@ // void CUsbOtgWatcher::BPeripheralL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->BPeripheralL(); } @@ -470,7 +470,7 @@ // void CUsbOtgWatcher::BHostL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->BHostL(); } @@ -480,7 +480,7 @@ // void CUsbOtgWatcher::OtgStateErrorL(TInt aError) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); HandleHostProblemL(EUsbWatcherOtgStateError, EUsbStateHostHandleDropping); } @@ -491,7 +491,7 @@ // void CUsbOtgWatcher::BusIdleL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->BusIdleL(); } @@ -501,7 +501,7 @@ // void CUsbOtgWatcher::BusActiveL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->BusActiveL(); } @@ -511,7 +511,7 @@ // void CUsbOtgWatcher::BusActivityErrorL(TInt aError) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); // no action, continue } @@ -522,7 +522,7 @@ // void CUsbOtgWatcher::DeviceAttachedL(TDeviceEventInformation aTdi) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->DeviceAttachedL(aTdi); } @@ -532,7 +532,7 @@ // void CUsbOtgWatcher::DeviceDetachedL(TDeviceEventInformation aTdi) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->DeviceDetachedL(aTdi); } @@ -542,7 +542,7 @@ // void CUsbOtgWatcher::DriverLoadSuccessL(TDeviceEventInformation aTdi) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->DriverLoadSuccessL(aTdi); } @@ -552,7 +552,7 @@ // void CUsbOtgWatcher::DriverLoadPartialSuccessL(TDeviceEventInformation aTdi) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->DriverLoadPartialSuccessL(aTdi); } @@ -562,7 +562,7 @@ // void CUsbOtgWatcher::DriverLoadFailureL(TDeviceEventInformation aTdi) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->DriverLoadFailureL(aTdi); } @@ -572,7 +572,7 @@ // void CUsbOtgWatcher::HostEventNotificationErrorL(TInt aError) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); HandleHostProblemL(EUsbWatcherHostEventNotificationError, EUsbStateHostHandleDropping); } @@ -584,7 +584,7 @@ // void CUsbOtgWatcher::MessageNotificationReceivedL(TInt aMessage) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->MessageNotificationReceivedL(aMessage); } @@ -594,7 +594,7 @@ // void CUsbOtgWatcher::BadHubPositionL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->BadHubPositionL(); } @@ -604,7 +604,7 @@ // void CUsbOtgWatcher::VBusErrorL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->VBusErrorL(); } @@ -614,7 +614,7 @@ // void CUsbOtgWatcher::SrpReceivedL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->SrpReceivedL(); } @@ -624,7 +624,7 @@ // void CUsbOtgWatcher::SessionRequestedL() { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); iHostState->SessionRequestedL(); } @@ -634,7 +634,7 @@ // void CUsbOtgWatcher::MessageNotificationErrorL(TInt aError) { - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadHostState)); + ASSERT_PANIC(iHostState != NULL, EBadHostState); HandleHostProblemL(EUsbWatcherMessageNotificationError, EUsbStateHostHandleDropping); } @@ -737,7 +737,7 @@ // CUsbStateHostHandle* CUsbOtgWatcher::HostHandle(TUsbStateIds aInState) const { - __ASSERT_DEBUG(iStates[aInState] != NULL, Panic(EBadState)); + ASSERT_PANIC(iStates[aInState] != NULL, EBadState); return (CUsbStateHostHandle*) iStates[aInState]; } @@ -760,13 +760,15 @@ // sets new state // be careful to add states into States in exactly the same order as they enumerated - // this method will work right as long as states, which in the enumeration, is added to the list iStates in the same order as they enumerated - // and no one state is added, if all previous states are not added. no need to add all states, but if added - previous all must be added. + // this method will work right as long as states, which in the enumeration, is added + // to the list iStates in the same order as they enumerated and no one state is added, + // if all previous states are not added. no need to add all states, but if added - + // previous all must be added. // For the general case, when some states added, some not, this method has to implement search by state ID. for this CUsbOtgWatcher::Id() is maintained. iState = iStates[aNewStateId]; - __ASSERT_DEBUG(iState != NULL, Panic(EBadState)); + ASSERT_PANIC(iState != NULL, EBadState); iState->JustAdvancedToThisStateL(); // do any initial activity, once advanced to the state @@ -790,13 +792,15 @@ // set new state // be careful to add states into States in exactly the same order as they enumerated - // this method will work right as long as states, which in the enumeration, is added to the list iStates in the same order as they enumerated - // and no one state is added, if all previous states are not added. no need to add all states, but if added - previous all must be added. - // For the general case, when some states added, some not, this method has to implement search by state Id. for this CUsbOtgWatcher::Id() is maintained. + // this method will work right as long as states, which in the enumeration, is added + // to the list iStates in the same order as they enumerated and no one state is added, + // if all previous states are not added. no need to add all states, but if added - + // previous all must be added. + // For the general case, when some states added, some not, this method has to implement search by state ID. for this CUsbOtgWatcher::Id() is maintained. iHostState = iStates[aNewStateId]; - __ASSERT_DEBUG(iHostState != NULL, Panic(EBadState)); + ASSERT_PANIC(iHostState != NULL, EBadState) iHostState->JustAdvancedToThisStateL(); // checks if there are conditions for advancing to another state(s) @@ -857,6 +861,8 @@ LOG1( "aError = %d" , aError); + iUsbServiceRequest = CUsbServiceControl::ERequestUndefined; + switch (aError) { case KErrInUse: @@ -869,12 +875,19 @@ { break; // do normal routine } + case KErrNoMemory: + { + HandleHostProblemL(EUsbWatcherNoMemory, + EUsbStateHostHandleDropping); + return; + } - default: // handle the issue + default: + // handle the issue { if (iUsbServiceRequest == CUsbServiceControl::EStartUsbService) // Handle only start issues { - HandleHostProblemL(EUsbWatcherCanNotStartUsbServices, + HandleHostProblemL(EUsbWatcherNoMemory, EUsbStateHostHandleDropping); } @@ -899,6 +912,7 @@ switch (serviceState) { case EUsbServiceIdle: // just stopped usb service + { LOG("UsbServiceState == EUsbServiceIdle" ); // do nothing @@ -906,6 +920,7 @@ } case EUsbServiceStarted: // just started usb service + { LOG( "UsbServiceState == EUsbServiceStarted" ); @@ -918,25 +933,27 @@ LOG("UsbServiceState == EUsbServiceStarting" ); // should not receive that, due to call back is called when service stopped or started // therefore scream - // no break statement here + PANIC(EUnexpectedUsbServiceState); + break; } case EUsbServiceStopping: { LOG("UsbServiceState == EUsbServiceStopping" ); // should not receive that, due to call back is called when service stopped or started // therefore scream - // no break statement here + PANIC(EUnexpectedUsbServiceState); + break; } case EUsbServiceFatalError: { LOG( "UsbServiceState == EUsbServiceFatalError" ); - Panic(EUnexpectedUsbServiceState); + PANIC(EUnexpectedUsbServiceState); break; } default: { - Panic(EUnknownUsbServiceState); + PANIC(EUnknownUsbServiceState); } } } @@ -964,27 +981,27 @@ if (iIdPinObserver != IdPinObserver()) { - User::Leave(KErrGeneral); + LEAVE(KErrGeneral); } if (iOtgStateObserver != OtgStateObserver()) { - User::Leave(KErrGeneral); + LEAVE(KErrGeneral); } if (iBusActivityObserver != BusActivityObserver()) { - User::Leave(KErrGeneral); + LEAVE(KErrGeneral); } if (iHostEventNotificationObserver != HostEventNotificationObserver()) { - User::Leave(KErrGeneral); + LEAVE(KErrGeneral); } if (iMessageNotificationObserver != MessageNotificationObserver()) { - User::Leave(KErrGeneral); + LEAVE(KErrGeneral); } LOG( "Observers destructors" ); @@ -1003,22 +1020,22 @@ LOG("Creating states"); - User::LeaveIfError(iStates.Append(CUsbStateHostUndefined::NewL(*this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAInitiate::NewL(*this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAHost::NewL(*this))); - User::LeaveIfError(iStates.Append(CUsbStateHostAPeripheral::NewL(*this))); - User::LeaveIfError(iStates.Append(CUsbStateHostDelayAttachedHandle::NewL( + LEAVEIFERROR(iStates.Append(CUsbStateHostUndefined::NewL(*this))); + LEAVEIFERROR(iStates.Append(CUsbStateHostAInitiate::NewL(*this))); + LEAVEIFERROR(iStates.Append(CUsbStateHostAHost::NewL(*this))); + LEAVEIFERROR(iStates.Append(CUsbStateHostAPeripheral::NewL(*this))); + LEAVEIFERROR(iStates.Append(CUsbStateHostDelayAttachedHandle::NewL( *this))); - User::LeaveIfError(iStates.Append( + LEAVEIFERROR(iStates.Append( CUsbStateHostDelayNotAttachedHandle::NewL(*this))); - User::LeaveIfError(iStates.Append( + LEAVEIFERROR(iStates.Append( CUsbStateHostHandleDropping::NewL(*this))); LOG("Check State()" ); if (iStates[EUsbStateHostAInitiate] != State(EUsbStateHostAInitiate)) { - User::Leave(KErrGeneral); + LEAVE(KErrGeneral); } LOG("Check CurrentHostState()" ); @@ -1027,14 +1044,14 @@ if (iStates[EUsbStateHostAInitiate] != CurrentHostState()) { - User::Leave(KErrGeneral); + LEAVE(KErrGeneral); } LOG("NotifManager and WarningNotifier." ); CUsbNotifManager* usbnotifmanager = CUsbNotifManager::NewL(*this); RNotifier rnotifier; - User::LeaveIfError(rnotifier.Connect()); + LEAVEIFERROR(rnotifier.Connect()); CUsbWarningNotifier* usbnotifier = CUsbWarningNotifier::NewL(rnotifier, *usbnotifmanager, EUsbOtgPartiallySupportedDevice); usbnotifier->IsFeedbackNeeded(); @@ -1082,7 +1099,7 @@ if (KErrNotFound != iOtgStateObservers.Find(&aObserver)) { LOG( "Observer already exists" ); - Panic(EObserverAlreadyExists); + PANIC(EObserverAlreadyExists); return; } iOtgStateObservers.AppendL(&aObserver); @@ -1101,7 +1118,7 @@ if (KErrNotFound == i) { LOG( "Observer not found" ); - Panic(ECanNotFindUsbOtgWatcherStateObserver); + PANIC(ECanNotFindUsbOtgWatcherStateObserver); return; } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbservicecontrol.cpp --- a/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbservicecontrol.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -166,7 +166,7 @@ } default: { - Panic( EUnknownUsbServiceState); + PANIC( EUnknownUsbServiceState); } } @@ -248,7 +248,7 @@ } default: { - Panic( EUnknownUsbServiceState); + PANIC( EUnknownUsbServiceState); } } return KErrNone; @@ -372,7 +372,7 @@ } default: { - Panic( EUnknownUsbServiceState); + PANIC( EUnknownUsbServiceState); } } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstate.cpp --- a/usbengines/usbotgwatcher/src/cusbstate.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstate.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -15,6 +15,7 @@ * */ +#include "cusbotgwatcher.h" #include "cusbstate.h" #include "panic.h" @@ -148,7 +149,7 @@ void CUsbState::IdPinOffL() { LOG_FUNC - Panic(EIdPinOffNotExpected); + PANIC(EIdPinOffNotExpected); } // --------------------------------------------------------------------------- @@ -158,7 +159,7 @@ void CUsbState::IdPinOnL() { LOG_FUNC - Panic(EIdPinOnNotExpected); + PANIC(EIdPinOnNotExpected); } // From VBus observer @@ -169,7 +170,7 @@ void CUsbState::VBusDownL() { LOG_FUNC - Panic(EVBusDownNotExpected); + PANIC(EVBusDownNotExpected); } // --------------------------------------------------------------------------- @@ -179,7 +180,7 @@ void CUsbState::VBusUpL() { LOG_FUNC - Panic(EVBusUpNotExpected); + PANIC(EVBusUpNotExpected); } // From OTG state observer @@ -190,7 +191,7 @@ void CUsbState::AIdleL() { LOG_FUNC - Panic(EAIdleNotExpected); + PANIC(EAIdleNotExpected); } // --------------------------------------------------------------------------- @@ -200,7 +201,7 @@ void CUsbState::AHostL() { LOG_FUNC - Panic(EAHostNotExpected); + PANIC(EAHostNotExpected); } // --------------------------------------------------------------------------- @@ -210,7 +211,7 @@ void CUsbState::APeripheralL() { LOG_FUNC - Panic(EAPeripheralNotExpected); + PANIC(EAPeripheralNotExpected); } // --------------------------------------------------------------------------- @@ -220,7 +221,7 @@ void CUsbState::AVBusErrorL() { LOG_FUNC - Panic(EAVBusErrorNotExpected); + PANIC(EAVBusErrorNotExpected); } // --------------------------------------------------------------------------- @@ -230,7 +231,7 @@ void CUsbState::BIdleL() { LOG_FUNC - Panic(EBIdleNotExpected); + PANIC(EBIdleNotExpected); } // --------------------------------------------------------------------------- @@ -240,7 +241,7 @@ void CUsbState::BPeripheralL() { LOG_FUNC - Panic(EBPeripheralNotExpected); + PANIC(EBPeripheralNotExpected); } // --------------------------------------------------------------------------- @@ -250,7 +251,7 @@ void CUsbState::BHostL() { LOG_FUNC - Panic(EBHostNotExpected); + PANIC(EBHostNotExpected); } // From bus activity observer @@ -261,7 +262,7 @@ void CUsbState::BusIdleL() { LOG_FUNC - Panic(EBusIdleNotExpected); + PANIC(EBusIdleNotExpected); } // --------------------------------------------------------------------------- @@ -271,7 +272,7 @@ void CUsbState::BusActiveL() { LOG_FUNC - Panic(EBusActiveNotExpected); + PANIC(EBusActiveNotExpected); } // From Host Event notification observer @@ -282,7 +283,7 @@ void CUsbState::DeviceAttachedL(TDeviceEventInformation) { LOG_FUNC - Panic(EDeviceAttachedNotExpected); + PANIC(EDeviceAttachedNotExpected); } // --------------------------------------------------------------------------- @@ -292,7 +293,7 @@ void CUsbState::DeviceDetachedL(TDeviceEventInformation) { LOG_FUNC - Panic(EDeviceDetachedNotExpected); + PANIC(EDeviceDetachedNotExpected); } // --------------------------------------------------------------------------- @@ -302,7 +303,7 @@ void CUsbState::DriverLoadSuccessL(TDeviceEventInformation) { LOG_FUNC - Panic(EDriverLoadSuccessNotExpected); + PANIC(EDriverLoadSuccessNotExpected); } // --------------------------------------------------------------------------- @@ -312,7 +313,7 @@ void CUsbState::DriverLoadPartialSuccessL(TDeviceEventInformation) { LOG_FUNC - Panic(EDriverLoadPartialSuccessNotExpected); + PANIC(EDriverLoadPartialSuccessNotExpected); } // --------------------------------------------------------------------------- @@ -322,7 +323,7 @@ void CUsbState::DriverLoadFailureL(TDeviceEventInformation) { LOG_FUNC - Panic(EDriverLoadFailureNotExpected); + PANIC(EDriverLoadFailureNotExpected); } // --------------------------------------------------------------------------- @@ -332,7 +333,7 @@ void CUsbState::BadHubPositionL() { LOG_FUNC - Panic(EBadHubPositionNotExpected); + PANIC(EBadHubPositionNotExpected); } // --------------------------------------------------------------------------- @@ -342,7 +343,7 @@ void CUsbState::VBusErrorL() { LOG_FUNC - Panic(EVBusErrorNotExpected); + PANIC(EVBusErrorNotExpected); } // --------------------------------------------------------------------------- @@ -352,7 +353,7 @@ void CUsbState::MessageNotificationReceivedL(TInt) { LOG_FUNC - Panic(EMessageNotificationNotExpected); + PANIC(EMessageNotificationNotExpected); } // --------------------------------------------------------------------------- @@ -362,7 +363,7 @@ void CUsbState::SrpReceivedL() { LOG_FUNC - Panic(ESrpNotExpected); + PANIC(ESrpNotExpected); } // --------------------------------------------------------------------------- @@ -372,5 +373,5 @@ void CUsbState::SessionRequestedL() { LOG_FUNC - Panic(ESessionRequestNotExpected); + PANIC(ESessionRequestNotExpected); } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehostabase.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostabase.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -20,6 +20,7 @@ #include #include +#include "cusbotgwatcher.h" #include "cusbstatehostabase.h" #include "cusbstatehosthandledropping.h" @@ -44,6 +45,7 @@ void CUsbStateHostABase::ConstructL() { LOG_FUNC + CUsbState::ConstructL(); } // --------------------------------------------------------------------------- @@ -151,7 +153,7 @@ case KErrUsbOtgHnpEnableProblem:// = -6687; case KErrUsbOtgVbusError:// = -6690; - // hosterrors.h + // hosterrors.h case KErrUsbConfigurationHasNoInterfaces: case KErrUsbInterfaceCountMismatch: case KErrUsbDuplicateInterfaceNumbers: @@ -164,10 +166,10 @@ break; } - // OTGDI + // OTGDI case KErrUsbOtgPeriphNotSupported: // = -6688, for OPT only - // USBDI + // USBDI case KErrUsbRequestsPending: case KErrUsbBadAddress: case KErrUsbNoAddress: @@ -189,7 +191,7 @@ case KErrUsbEventOverflow: case KErrUsbBadDeviceAttached: - // hosterrors.h + // hosterrors.h case KErrUsbUnsupportedDevice: { LOG( "UnsupportedDevice" ); @@ -238,10 +240,17 @@ { LOG_FUNC + if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) + { + LOG( "Session is ongoing (VBus high); ignore SRP request." ); + return; + } + TInt err = iWatcher.Usb().BusRespondSrp(); - if (KErrNone != err) + LOG1( "BusRespondSrp() error = %d" , err ); + + if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) { - LOG1( "BusRespondSrp error = %d" , err ); iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping); } @@ -258,16 +267,16 @@ if (iWatcher.VBusObserver()->VBus() == CUsbVBusObserver::EVBusUp) { // session already ongoing; BusRequest() in this case returns KErrUsbOtgBadState... - LOG( "VBus is already UP; ignore Session request." ); + LOG( "Session is ongoing (VBus high); ignore Session Request." ); return; } TInt err = iWatcher.Usb().BusRequest(); - if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) // sometimes this also comes... + LOG1( "BusRequest() err = %d" , err); + + if (KErrNone != err && KErrUsbOtgVbusAlreadyRaised != err) { - LOG1( "BusRequestError err = %d" , err); iWatcher.HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandleDropping); - return; } } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehostahost.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostahost.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -17,6 +17,7 @@ #include #include +#include #include "cusbstatehostahost.h" #include "cusbnotifmanager.h" @@ -92,7 +93,7 @@ // do general things CUsbStateHostABase::JustAdvancedToThisStateL(); - User::LeaveIfError(RProperty::Set(KPSUidUsbWatcher, + LEAVEIFERROR(RProperty::Set(KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected, KUsbWatcherPeripheralIsConnected)); @@ -106,7 +107,7 @@ { LOG_FUNC - User::LeaveIfError(RProperty::Set(KPSUidUsbWatcher, + LEAVEIFERROR(RProperty::Set(KPSUidUsbWatcher, KUsbWatcherIsPeripheralConnected, KUsbWatcherPeripheralIsNotConnected)); @@ -131,5 +132,5 @@ void CUsbStateHostAHost::BadHubPositionL() { LOG_FUNC - Panic( EBadHubPositionEventNotExpected); + PANIC( EBadHubPositionEventNotExpected); } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostainitiate.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -15,8 +15,11 @@ * */ #include +#include +#include "cusbotgwatcher.h" #include "cusbstatehostainitiate.h" + #ifndef STIF #include "cusbtimer.h" #include "cusbnotifmanager.h" @@ -36,7 +39,7 @@ // --------------------------------------------------------------------------- // CUsbStateHostAInitiate::CUsbStateHostAInitiate(CUsbOtgWatcher& aWatcher) : - CUsbStateHostABase(aWatcher) + CUsbStateHostABase(aWatcher), iDeviceAttached(EFalse) { } @@ -115,6 +118,10 @@ // do general things CUsbStateHostABase::JustAdvancedToThisStateL(); + // clear this attribute, and wait for attachment + // one attchment has to correspond to only one detachment + iDeviceAttached = EFalse; // to catch not corresponding Detachment, if any + TInt err = iWatcher.Usb().EnableFunctionDriverLoading(); if (KErrNone != err) @@ -136,7 +143,7 @@ while (count < maxTrial && KErrNone != busReqErr) { busReqErr = iWatcher.Usb().BusRequest(); - LOG1( "BusRequest() err = %d" , err); + LOG1( "BusRequest() busReqErr = %d" , busReqErr); if (KErrNone != busReqErr) { @@ -184,7 +191,7 @@ default: { LOG1( "Unknown timer id = %d", aTimerId ); - Panic( EWrongTimerId); + PANIC( EWrongTimerId); } } } @@ -208,6 +215,7 @@ { LOG_FUNC + iDeviceAttached = ETrue; iAttachmentTimer->Cancel(); // check if an OTG device connected @@ -228,30 +236,55 @@ return; } - if (KErrNone != aTdi.iError) + switch (aTdi.iError) + // error in attachement { - switch (aTdi.iError) - // error in attachement + case KErrNone: + { + break; + } + case KErrUsbDeviceDetachedDuringDriverLoading: + { + //do not show error, due to device is already detached + // Device Detachment will not come after this (it was not attached yet) + // therefore emulate detachment + // content of aTdi is not important, due to detachment anyway + DeviceDetachedL(aTdi); + break; + } + case KErrBadPower: + { + LOG( "TooMuchPower" ); + HandleL(EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration, + EUsbStateHostDelayNotAttachedHandle); + break; + } + default: { - case KErrBadPower: - { - LOG( "TooMuchPower" ); - HandleL( - EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration, - EUsbStateHostDelayNotAttachedHandle); - break; - } - default: - { - LOG1("AttachmentError aTdi.iError = %d" , aTdi.iError ); - HandleL(EUsbWatcherErrUnsupportedDevice, - EUsbStateHostHandleDropping); - break; - } + LOG1("AttachmentError aTdi.iError = %d" , aTdi.iError ); + HandleL(EUsbWatcherErrUnsupportedDevice, + EUsbStateHostHandleDropping); } + } + } - return; +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostAInitiate::DeviceDetachedL(TDeviceEventInformation aTdi) + { + LOG_FUNC + + // iDeviceAttached is used here to avoid one more state creation (init->attached->detached) + // due to purpose of this state only to wait for drivers load + if (!iDeviceAttached) + { + PANIC(EDeviceDetachedNotExpected) } + + // go out, and go in to the same state + ChangeHostStateL( EUsbStateHostAInitiate); } // --------------------------------------------------------------------------- @@ -269,11 +302,23 @@ // --------------------------------------------------------------------------- // void CUsbStateHostAInitiate::DriverLoadPartialSuccessL( - TDeviceEventInformation) + TDeviceEventInformation aDei) { LOG_FUNC - iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgWarning, - EUsbOtgPartiallySupportedDevice, NULL); + + switch (aDei.iError) + { + case KErrUsbDeviceDetachedDuringDriverLoading: + { + //do not show warning, due to device is already detached + break; + } + default: + { + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgWarning, + EUsbOtgPartiallySupportedDevice, NULL); + } + } ChangeHostStateL( EUsbStateHostAHost); } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostaperipheral.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -79,7 +79,6 @@ } // From OTG state observer - // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- @@ -90,3 +89,12 @@ ChangeHostStateL( EUsbStateHostAInitiate); } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostAPeripheral::AIdleL() + { + LOG_FUNC + ChangeHostStateL( EUsbStateHostAInitiate); + } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehostdelayattachedhandle.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostdelayattachedhandle.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostdelayattachedhandle.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -125,7 +125,7 @@ default: { LOG1("Unexpected request id = %d" , iWhat ); - Panic( EUnexpectedSituationToHandle); + PANIC( EUnexpectedSituationToHandle); break; } } @@ -165,7 +165,7 @@ default: { LOG1( "Unknown timer id = %d", aTimerId ); - Panic( EWrongTimerId); + PANIC( EWrongTimerId); } } } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostdelayhandle.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -15,6 +15,7 @@ * */ +#include "cusbotgwatcher.h" #include "cusbstatehostdelayhandle.h" #include "errors.h" @@ -60,7 +61,7 @@ { LOG_FUNC // this is not expected, due to in this state vbus already up, since entering the state - Panic( EVBusUpNotExpected); + PANIC( EVBusUpNotExpected); } // From Host Event notification observer diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehostdelaynotattachedhandle.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostdelaynotattachedhandle.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostdelaynotattachedhandle.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -118,7 +118,7 @@ default: { LOG1("Unexpected request id = %d", iWhat); - Panic( EUnexpectedSituationToHandle); + PANIC( EUnexpectedSituationToHandle); break; } } @@ -146,7 +146,7 @@ TDeviceEventInformation) { LOG_FUNC - Panic( EDeviceDetachedNotExpected); + PANIC( EDeviceDetachedNotExpected); } @@ -163,14 +163,14 @@ case ETooMuchPowerRequiredTimer: { LOG("ETooMuchPowerRequiredTimer" ); - HandleL(EUsbWatcherErrDeviceRequiresTooMuchPower, + HandleL(EUsbWatcherErrUnsupportedDevice, EUsbStateHostHandleDropping); break; } default: { LOG1("Unknown timer id = %d", aTimerId ); - Panic( EWrongTimerId); + PANIC( EWrongTimerId); } } } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehosthandle.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehosthandledropping.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -18,7 +18,9 @@ #include #include +#include "cusbotgwatcher.h" #include "cusbstatehosthandledropping.h" + #ifndef STIF #include "cusbnotifmanager.h" #else @@ -160,7 +162,8 @@ // no break here } - // no break statement for following cases + // no break statement for following cases + case EUsbWatcherNoMemory: case EUsbWatcherIdPinError: case EUsbWatcherVBusObserverError: case EUsbWatcherHostEventNotificationError: @@ -178,7 +181,7 @@ default: { LOG1("Unexpected situation to be handled iWhat = %d" , iWhat ); - Panic( EUnexpectedSituationToHandle); + PANIC( EUnexpectedSituationToHandle); break; } @@ -253,6 +256,13 @@ EUsbOtgErrorInConnection, this); break; } + case EUsbWatcherNoMemory: + { + LOG("EUsbWatcherNoMemory" ); + iWatcher.NotifManager()->ShowNotifierL(KUsbUiNotifOtgError, + EUsbOtgErrorNoMemory, this); + break; + } case EUsbWatcherCanNotStartUsbServices: { LOG("EUsbWatcherCanNotStartUsbServices" ); @@ -277,7 +287,7 @@ default: { LOG1("Unexpected situation to be handled iWhat = %d", iWhat ); - Panic( EUnexpectedSituationToHandle); + PANIC( EUnexpectedSituationToHandle); break; } } @@ -309,6 +319,16 @@ // // --------------------------------------------------------------------------- // +void CUsbStateHostHandleDropping::AVBusErrorL() + { + LOG_FUNC + iWatcher.Usb().BusClearError(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// void CUsbStateHostHandleDropping::DeviceAttachedL( TDeviceEventInformation aDevEventInfo) { @@ -380,3 +400,13 @@ } } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostHandleDropping::VBusErrorL() + { + LOG_FUNC + iWatcher.Usb().BusClearError(); + } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp --- a/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbstatehostundefined.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -15,6 +15,7 @@ * */ +#include "cusbotgwatcher.h" #include "cusbstatehostundefined.h" #include "definitions.h" @@ -111,7 +112,6 @@ // --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- -// void CUsbStateHostUndefined::AVBusErrorL() { LOG_FUNC @@ -137,7 +137,47 @@ } // From host state observer -void CUsbStateHostUndefined::DeviceDetachedL(TDeviceEventInformation /*aInfo*/) +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostUndefined::DeviceAttachedL(TDeviceEventInformation) + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostUndefined::DeviceDetachedL(TDeviceEventInformation) + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostUndefined::DriverLoadSuccessL(TDeviceEventInformation) + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostUndefined::DriverLoadPartialSuccessL(TDeviceEventInformation) + { + LOG_FUNC + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CUsbStateHostUndefined::DriverLoadFailureL(TDeviceEventInformation) { LOG_FUNC } @@ -178,5 +218,5 @@ void CUsbStateHostUndefined::BadHubPositionL() { LOG_FUNC - Panic( EBadHubPositionNotExpected); + PANIC( EBadHubPositionNotExpected); } diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbtimer.cpp --- a/usbengines/usbotgwatcher/src/cusbtimer.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbtimer.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -48,7 +48,7 @@ void CUsbTimer::ConstructL() { LOG_FUNC - User::LeaveIfError(iTimer.CreateLocal()); + LEAVEIFERROR(iTimer.CreateLocal()); } // --------------------------------------------------------------------------- @@ -91,7 +91,7 @@ if (KErrNone != iStatus.Int()) { - User::Leave(iStatus.Int()); + LEAVE(iStatus.Int()); } iObserver.TimerElapsedL(iTimerId); diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbvbusobserver.cpp --- a/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbvbusobserver.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" @@ -41,7 +41,7 @@ { LOG_FUNC - User::LeaveIfError(iVBus.Attach(KUidUsbManCategory, + LEAVEIFERROR(iVBus.Attach(KUidUsbManCategory, KUsbOtgVBusPoweredProperty)); } @@ -91,7 +91,7 @@ if (KErrNone != err) { LOG("CanNotGetVBusProperty" ) - Panic( ECanNotGetVBusProperty); + PANIC( ECanNotGetVBusProperty); } return (0 == val ? EVBusDown : EVBusUp); @@ -109,7 +109,7 @@ if (KErrNotFound != iObservers.Find(&aObserver)) { LOG( "Observer already exists" ); - Panic( EObserverAlreadyExists); + PANIC( EObserverAlreadyExists); return; } @@ -134,7 +134,7 @@ if (KErrNotFound == i) { LOG("Observer not found" ); - Panic( ECanNotFindVBusObserver); + PANIC( ECanNotFindVBusObserver); return; } @@ -204,10 +204,9 @@ default: { LOG("WrongVBusState"); - Panic( EWrongVBusState); + PANIC( EWrongVBusState); } } - } // --------------------------------------------------------------------------- diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbwaitnotifier.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp --- a/usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbotgwatcher/src/cusbwarningnotifier.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 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" diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbwatcher/conf/usbwatcher.confml Binary file usbengines/usbwatcher/conf/usbwatcher.confml has changed diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbwatcher/conf/usbwatcher_101F8801.crml Binary file usbengines/usbwatcher/conf/usbwatcher_101F8801.crml has changed diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbwatcher/rom/mtp_symbian_temp.iby --- a/usbengines/usbwatcher/rom/mtp_symbian_temp.iby Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbwatcher/rom/mtp_symbian_temp.iby Mon Mar 15 12:44:42 2010 +0200 @@ -103,13 +103,6 @@ data=EPOCROOT##epoc32\data\Z\resource\mtp\2001FCAE.rsc resource\mtp\2001FCAE.rsc #endif MTPIMAGEDP_IBY -// mediasyncserver.iby -#ifndef MEDIASYNCSERVER_IBY -#define MEDIASYNCSERVER_IBY -file=ABI_DIR\BUILD_DIR\rmediasyncserver.dll SHARED_LIB_DIR\rmediasyncserver.dll -file=ABI_DIR\BUILD_DIR\mediasyncserver.exe PROGRAMS_DIR\mediasyncserver.exe -#endif // MEDIASYNCSERVER_IBY - // mtp_statusservice.iby #ifndef MTP_STATUSSERVICE_IBY #define MTP_STATUSSERVICE_IBY diff -r a15c582fbf97 -r ff9df6630274 usbengines/usbwatcher/src/cusbwatcher.cpp --- a/usbengines/usbwatcher/src/cusbwatcher.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbengines/usbwatcher/src/cusbwatcher.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -26,6 +26,7 @@ #include #include #include //for global system state +#include //FeatureManager #include "cusbwatcher.h" #include "cusbactivestate.h" @@ -1007,9 +1008,28 @@ TInt CUsbWatcher::GetChargingPersonalityId( TInt& aPersonalityId ) { LOG_FUNC + + TUint32 chargingKey( KUsbWatcherChargingDefaultPersonality ); + // Check if it is now in certificate test mode + TRAPD(ret, FeatureManager::InitializeLibL()); + LOG1( "FeatureManager::InitializeLibL(): %d", ret ); + if ( KErrNone == ret ) + { + if( FeatureManager::FeatureSupported( + KFeatureIdEnableIsiCommunicationInUsbChargingMode ) ) + { + chargingKey = KUsbWatcherCertTestChargingPersonality; + LOG( "KFeatureIdEnableIsiCommunicationInUsbChargingMode true" ); + } + else + { + LOG( "KFeatureIdEnableIsiCommunicationInUsbChargingMode false" ); + } + FeatureManager::UnInitializeLib(); + } - TInt ret = iPersonalityRepository->Get( - KUsbWatcherChargingDefaultPersonality, aPersonalityId ); + ret = iPersonalityRepository->Get( chargingKey, aPersonalityId ); + LOG2( "ret = %d ( aPersonalityId: %d )", ret, aPersonalityId ); return ret; } diff -r a15c582fbf97 -r ff9df6630274 usbservices_plat/usb_notifier_api/inc/usbuinotif.h --- a/usbservices_plat/usb_notifier_api/inc/usbuinotif.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbservices_plat/usb_notifier_api/inc/usbuinotif.h Mon Mar 15 12:44:42 2010 +0200 @@ -148,7 +148,8 @@ EUsbOtgUnsupportedDevice, EUsbOtgHubUnsupported, EUsbOtgErrorInConnection, - EUsbOtgErrorAttachTimedOut + EUsbOtgErrorAttachTimedOut, + EUsbOtgErrorNoMemory }; #endif // USBUINOTIF_H diff -r a15c582fbf97 -r ff9df6630274 usbservices_plat/usb_personality_api_header/inc/UsbWatcherInternalCRKeys.h --- a/usbservices_plat/usb_personality_api_header/inc/UsbWatcherInternalCRKeys.h Fri Mar 12 15:48:40 2010 +0200 +++ b/usbservices_plat/usb_personality_api_header/inc/UsbWatcherInternalCRKeys.h Mon Mar 15 12:44:42 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-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 @@ const TUint32 KUsbWatcherChargingDefaultPersonality = 0x00000003; +const TUint32 KUsbWatcherCertTestChargingPersonality = 0x00000004; + #endif // USBWATCHERINTERNALCRKEYS_H // End of File \ No newline at end of file diff -r a15c582fbf97 -r ff9df6630274 usbuis/usbuinotif/src/usbuinotifdialerwatcher.cpp --- a/usbuis/usbuinotif/src/usbuinotifdialerwatcher.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbuis/usbuinotif/src/usbuinotifdialerwatcher.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include "usbuinotifdialerwatcher.h" diff -r a15c582fbf97 -r ff9df6630274 usbuis/usbuinotif/src/usbuinotifotgerror.cpp --- a/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Fri Mar 12 15:48:40 2010 +0200 +++ b/usbuis/usbuinotif/src/usbuinotifotgerror.cpp Mon Mar 15 12:44:42 2010 +0200 @@ -80,6 +80,7 @@ iStringIds.AppendL( R_USB_OTG_ERROR_HUB_UNSUPPORTED); iStringIds.AppendL( R_USB_OTG_ERROR_UNRECOVERABLE); iStringIds.AppendL( R_USB_OTG_ERROR_ATTACH_TIMEDOUT); + iStringIds.AppendL( R_USB_ERROR_MEMORY_NOT_ENOUGH); } // ----------------------------------------------------------------------------