Revision: 201011 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 31 Mar 2010 23:11:08 +0300
branchRCL_3
changeset 8 bb32eca979b3
parent 7 ff9df6630274
child 9 1a297fa72b1e
Revision: 201011 Kit: 201013
package_definition.xml
usbengines/usbdevcon/src/cusbdevcon.cpp
usbengines/usblocodplugin/inc/usblcdactive.h
usbengines/usblocodplugin/src/usblcdactive.cpp
usbengines/usbotgwatcher/inc/cusbindicatornotifier.h
usbengines/usbotgwatcher/inc/cusbpersonalityswitch.h
usbengines/usbotgwatcher/inc/cusbstatehostaidle.h
usbengines/usbotgwatcher/inc/cusbstatehostainitiatebase.h
usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp
usbengines/usbotgwatcher/src/cusbpersonalityswitch.cpp
usbengines/usbotgwatcher/src/cusbstatehostaidle.cpp
usbengines/usbotgwatcher/src/cusbstatehostainitiatebase.cpp
usbengines/usbotgwatcher/src/panic.cpp
usbengines/usbwatcher/rom/mtp_symbian_temp.iby
usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp
usbservices_plat/usb_notifier_api/inc/usbuinotif.h
usbuis/usbuinotif/data/usbuinotif.rss
usbuis/usbuinotif/loc/usbuinotif.loc
usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp
--- a/package_definition.xml	Mon Mar 15 12:44:42 2010 +0200
+++ b/package_definition.xml	Wed Mar 31 23:11:08 2010 +0300
@@ -14,7 +14,7 @@
       <component id="pictbridgeengine" filter="s60" name="PictBridge Engine">
         <unit bldFile="usbclasses/pictbridgeengine/group"/>
       </component>
-      <component id="usbphoneasmodem" filter="s60" name="USB Phone As Modem">
+      <component id="usbphoneasmodem" filter="s60" name="USB Phone as Modem" introduced="^3">
         <unit bldFile="usbclasses/usbphoneasmodem/group"/>
       </component>
     </collection>
@@ -31,7 +31,7 @@
       <component id="usbremotepersonality" filter="s60" name="USB Remote Personality">
         <unit bldFile="usbengines/usbremotepersonality/group"/>
       </component>
-      <component id="usbotgwatcher" filter="s60" name="USB OTG Watcher">
+      <component id="usbotgwatcher" filter="s60" name="USB OTG Watcher" introduced="^3">
         <unit bldFile="usbengines/usbotgwatcher/group"/>
       </component>
     </collection>
@@ -50,9 +50,12 @@
       </component>
     </collection>
     <collection id="usbservices_info" name="USB Services Info" level="plugin">
-      <component id="usbservices_plat" filter="s60" name="USB Services Platform Interfaces">
+      <component id="usbservices_plat" filter="s60" name="USB Services Platform Interfaces" class="api">
         <unit bldFile="usbservices_plat/group"/>
       </component>
-    </collection>
+      <component id="usbservices_test" filter="s60,test,api_test" name="USB Services Tests">
+        <unit bldFile="tsrc/group"/>
+      </component>
+    </collection>        
   </package>
 </SystemDefinition>
--- a/usbengines/usbdevcon/src/cusbdevcon.cpp	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbengines/usbdevcon/src/cusbdevcon.cpp	Wed Mar 31 23:11:08 2010 +0300
@@ -260,8 +260,7 @@
         FLOG( _L( "[USBDEVCON]\tCUsbDevCon::RunL Exiting usbdevcon" ) );      
         
         // Shutdown timer is finished, exit program
-        CUsbDevCon:: ~CUsbDevCon(); // destruct resources
-        User::Exit(KErrNone);
+        CActiveScheduler::Stop(); // destruct resources
         }
     }
 
--- a/usbengines/usblocodplugin/inc/usblcdactive.h	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbengines/usblocodplugin/inc/usblcdactive.h	Wed Mar 31 23:11:08 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006 - 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"
@@ -65,8 +65,12 @@
     CUsbLcdActive(MLocodBearerPluginObserver& aObserver);
 
     void ConstructL();
-    void Start();    
-    void NotifyLcd(TBool aUsbStatus);
+    void Start();
+    /**
+     * Handle the change of selected USB personality.
+     * @param aNewPersonalityId current selected USB personality ID.
+     */
+    void HandleUsbPersonalityChange( TInt aNewPersonalityId );
 
 private: // data
 
--- a/usbengines/usblocodplugin/src/usblcdactive.cpp	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbengines/usblocodplugin/src/usblcdactive.cpp	Wed Mar 31 23:11:08 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006 - 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"
@@ -79,26 +79,14 @@
     else
        {
 
-        TInt ret = RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, value);
-        LOGTEXT2(_L8("CUsbLcdActive::RunL() Personality = %d"), value);  
+        TInt ret = iProperty.Get( value );
+        LOGTEXT3(_L8("Personality: %d, ret: %d"), value, ret);  
         iProperty.Subscribe(iStatus);
         SetActive();
         if (ret == KErrNone)
-        { 
-        switch (value)
-            {
-            case KUsbPersonalityIdPCSuite:
-            case KUsbPersonalityIdPCSuiteMTP:
-                NotifyLcd(ETrue);
-                LOGTEXT(_L8("CUsbLcdActive::RunL() in PC Suite mode"));
-                break;
-               
-            default:
-                NotifyLcd(EFalse);
-                LOGTEXT(_L8("CUsbLcdActive::RunL() mode is not PC Suite"));
-                break;
-            }
-        }    
+            { 
+            HandleUsbPersonalityChange( value );
+            }    
        }
     }
 
@@ -145,17 +133,33 @@
     LOG_FUNC
     iProperty.Subscribe(iStatus);
     SetActive();
+    // Check the starting state
+    TInt usbPersonalityId( KUsbWatcherSelectedPersonalityNone );
+    TInt ret = iProperty.Get( usbPersonalityId );
+    if ( ( ret == KErrNone ) && 
+        ( usbPersonalityId != KUsbWatcherSelectedPersonalityNone ) )
+        {
+        HandleUsbPersonalityChange( usbPersonalityId ); 
+        }
     }
      
+
 // ---------------------------------------------------------------------------
-// This function notifying LoCoD framewark about active USB personality
-// If Personality == 113 (PC Suite), then ETrue; in all other cases is EFalse 
+// This function handles the USB active personality change, and notify LoCoD
+// framework whether PC Suite is active 
 // ---------------------------------------------------------------------------
 //
-void CUsbLcdActive::NotifyLcd(TBool aUsbStatus)
+void CUsbLcdActive::HandleUsbPersonalityChange( TInt aNewPersonalityId )
     {
     LOG_FUNC
-    iObserver.NotifyBearerStatus(ELocodBearerUSB, aUsbStatus);
+    LOGTEXT2( _L8( "aNewPersonalityId: %d"), aNewPersonalityId );
+    TBool isPcSuiteActive( EFalse );
+    if ( ( aNewPersonalityId == KUsbPersonalityIdPCSuite ) ||
+         ( aNewPersonalityId == KUsbPersonalityIdPCSuiteMTP ) )
+        {
+        isPcSuiteActive = ETrue;
+        }
+    iObserver.NotifyBearerStatus( ELocodBearerUSB, isPcSuiteActive );
     }
     
 //End of file
--- a/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbengines/usbotgwatcher/inc/cusbindicatornotifier.h	Wed Mar 31 23:11:08 2010 +0300
@@ -22,7 +22,7 @@
 #include <AknNotifyStd.h>       // SAknSmallIndicatorParams
 #include <AknNotifySignature.h> // SAknNotifierPackage
 #include <avkon.hrh>            // EAknIndicatorUSBConnection
-#include "cusbtimer.h"
+
 #include "cusbnotifier.h"
 #include "cusbvbusobserver.h"
 #include "cusbotgwatcher.h"
@@ -31,7 +31,7 @@
  * Class implements functionality of showing/blinking usb indicator
  * Class does not provide method to get response from the user
  */
-NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbTimerObserver, MUsbOtgWatcherStateObserver, MUsbVBusObserver
+NONSHARABLE_CLASS( CUsbIndicatorNotifier ): public CUsbNotifier, MUsbOtgWatcherStateObserver, MUsbVBusObserver
     {
 public:
     /**
@@ -80,13 +80,6 @@
      */
     virtual void Close();
 
-    // From MUsbTimerObserver
-    /**
-     * Timer elapsed
-     * @param Timer id
-     */
-    void TimerElapsedL(TUsbTimerId aTimerId);
-
 private:
 
     /**
@@ -135,13 +128,6 @@
     CUsbOtgWatcher& iOtgWatcher;
 
     /**
-     * Switch timer for showing/hiding the usb indicator interleavingly for 
-     * animating the indicator. 
-     * Own
-     */
-    CUsbTimer* iIconBlinkingTimer;
-
-    /**
      * Current indicator state
      */
     TInt iIndicatorState;
--- a/usbengines/usbotgwatcher/inc/cusbpersonalityswitch.h	Mon Mar 15 12:44:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "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:  Personality switch function.
- *
-*/
-
-#ifndef C_USBPERSONALITYSWITCH_H
-#define C_USBPERSONALITYSWITCH_H
-
-#include <e32base.h>
-#include <d32usbdi.h> 
-
-const TInt KGetAllPersonalitiesReq = 0x82;
-const TInt KSetPersonalityReq = 0x89;
-
-const TInt KNumOfPersShift = 3;
-const TInt KCurrPersShift = 2;
-const TInt KFirstPersonalityIdShift = 4;
-const TInt KLenghtOfPersonalityData = 2;
-
-class MUsbPersonalitySwitchObserver
-    {
-public:
-    enum TState
-        {
-        EIdle = 0,
-        ERequestingAllPersonalities,
-        ERequestingSetPersonality,
-        EGetAllPersonalitiesCompleted,
-        ESetPersonalityCompleted,
-        ERequestCancelled,
-        ERequestFailed
-        };
-public:
-    virtual void UsbPersonalitySwitchStateChangedL(TState aState, TInt aData) = 0;
-    };
-
-/* *
- * Reads personalities, if possible, switches peripheral to mass storage.
- * It is assumed that USB is started already
- */
-NONSHARABLE_CLASS(CUsbPersonalitySwitch) : public CActive
-    {
-    enum TState
-    {
-    EIdle = 0,
-    EGetAllPersonalities,
-    ESetPersonality /*,
-    EGetAllPersResult,
-    EGetSetPersResult*/
-    };
-    
-public:
-
-    /**
-     * Two-phased constructor
-     *
-     * @param aObserver will get call back
-     * @param aTimerId timer id
-     */
-    static CUsbPersonalitySwitch * NewL(MUsbPersonalitySwitchObserver* aObserver);
-
-    /**
-     * Destructor.
-     */
-    virtual ~CUsbPersonalitySwitch();
-
-    /**
-     * calls RunL after aMilliseconds
-     * @param aMilliseconds time in millisecs
-     */
-    TInt SwitchPersonalityL(TUint32 aDeviceId, TInt aPersonalityToBeSet);
-    
-    void CancelSwitchPersonalityL();
-
-public:
-
-    // from base class CActive
-    /**
-     * Called when request is completed
-     */
-    void RunL();
-
-    /**
-     * called when RunL leaves
-     * @param aError error code
-     * @return error code
-     */
-    TInt RunError(TInt aError);
-
-    /**
-     * Called when request is cancelled
-     */
-    void DoCancel();
-
-private:
-
-    /**
-     * Default constructor
-     * @param aObserver will get call back
-     * @param aTimerId timer id 
-     */
-    CUsbPersonalitySwitch(MUsbPersonalitySwitchObserver* aObserver);
-
-    /**
-     * 2nd phase construction
-     */
-    void ConstructL();
-    
-    void Reset();
-
-private:
-    // data
-
-    /**
-     * Observer
-     * not own
-     */
-    MUsbPersonalitySwitchObserver* iObserver;
-    
-    RUsbInterface iUsbInterface;
-
-    /**
-     * timer id
-     */
-    TInt iPersonalityToBeSet;
-    
-    RUsbInterface::TUsbTransferRequestDetails iTransfer;
-    
-    RBuf8 iSendData;
-    
-    RBuf8 iRcvData;
-    
-    TState iState;
-    };
-
-#endif //  C_USBPERSONALITYSWITCH_H
--- a/usbengines/usbotgwatcher/inc/cusbstatehostaidle.h	Mon Mar 15 12:44:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "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:  Iplementation of the concret state
- *
-*/
-
-
-#ifndef C_USBSTATEHOSTAIDLE_H
-#define C_USBSTATEHOSTAIDLE_H
-
-#include "cusbotgwatcher.h"
-#include "cusbstatehostainitiatebase.h"
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
-
-/**
- *  This class implements basic behaviour in Idle state (VBus down, IdPin on)
- *
- */
-NONSHARABLE_CLASS( CUsbStateHostAIdle ) : public CUsbStateHostAInitiateBase
-
-    {
-
-public:
-
-    /**
-     * Two-phased constructor.
-     * @param aWatcher owner
-     */
-    static CUsbStateHostAIdle* NewL(CUsbOtgWatcher* aWatcher);
-
-    /**
-     * Destructor.
-     */
-    virtual ~CUsbStateHostAIdle();
-
-private:
-
-    /**
-     * Default construction
-     * @param aWatcher owner
-     */
-    CUsbStateHostAIdle(CUsbOtgWatcher* aWatcher);
-
-    /**
-     * 2nd phase construction
-     */
-    void ConstructL();
-
-    //from CUsbState
-    /**
-     * State id
-     * @return state id
-     */
-    TUsbStateIds Id();
-
-    /**
-     * This is called when switched to this state, 
-     * because If all conditions for transition to another state exist, nothing will 
-     * trigger it and transition will not happen. This forces the transition in such cases.
-     *
-     */
-    void JustAdvancedToThisStateL();
-
-    };
-
-#endif //  C_USBSTATEHOSTAIDLE_H
--- a/usbengines/usbotgwatcher/inc/cusbstatehostainitiatebase.h	Mon Mar 15 12:44:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implements concrete state
- *
-*/
-
-
-#ifndef C_USBSTATEHOSTAINITIATEBASE_H
-#define C_USBSTATEHOSTAINITIATEBASE_H
-
-#include "cusbotgwatcher.h"
-#include "cusbstatehostabase.h"
-#include "cusbpersonalityswitch.h"
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
-
-/**
- *  This class implements besic behaviour when Id pin on, and vbus just turned down or just turned on,
- *  specific concrete case/state is implemented in subclass
- */
-NONSHARABLE_CLASS( CUsbStateHostAInitiateBase ) : public CUsbStateHostABase,
-        MUsbTimerObserver, MUsbPersonalitySwitchObserver
-
-    {
-    friend class CTestUsbOtgWatcher;
-
-public:
-
-    /**
-     * Destructor.
-     */
-    virtual ~CUsbStateHostAInitiateBase();
-
-    // From MUsbTimerObserver
-    /**
-     * timer expired call back
-     * @param aTimerId timer id
-     */
-    void TimerElapsedL(TUsbTimerId aTimerId);
-    
-    void UsbPersonalitySwitchStateChangedL(MUsbPersonalitySwitchObserver::TState aState, TInt aData);
-
-protected:
-
-    /**
-     * Default construction
-     * @param aWatcher owner
-     */
-    CUsbStateHostAInitiateBase(CUsbOtgWatcher* aWatcher);
-
-    /**
-     * 2nd phase construction
-     */
-    void ConstructL();
-
-    //from CUsbState
-
-    /**
-     * This is called when switched to this state, 
-     * because If all conditions for transition to another state exist, nothing will 
-     * trigger it and transition will not happen. This forces the transition in such cases.
-     *
-     */
-    virtual void JustBeforeLeavingThisStateL();
-
-    // From VBus observer
-    /**
-     * VBus down
-     */
-    virtual void VBusDownL();
-    /**
-     * VBus UP
-     */
-    virtual void VBusUpL();
-
-    /**
-     * AHost
-     */
-    virtual void AHostL();
-
-    /**
-     * APeripheral
-     */
-    virtual void APeripheralL();
-
-    // From Host Event notification observer
-    /**
-     * Device is attached
-     * @param Device event data
-     */
-    virtual void DeviceAttachedL(TDeviceEventInformation);
-    /**
-     * Device is detached
-     * @param Device event data
-     */
-    virtual void DriverLoadSuccessL(TDeviceEventInformation);
-    /**
-     * Drivers loaded partially
-     * @param Device event data
-     */
-    virtual void DriverLoadPartialSuccessL(TDeviceEventInformation);
-    /**
-     * Drivers loading failed
-     * @param Device event data
-     */
-    virtual void DriverLoadFailureL(TDeviceEventInformation);
-
-    // From message notification observer
-    /**
-     * SRP request received
-     */
-    virtual void SrpReceivedL();
-
-protected:
-    // data
-
-    /*
-     * attachment timer
-     * own
-     */
-    CUsbTimer* iAttachmentTimer;
-    
-    CUsbPersonalitySwitch* iUsbPersonalitySwitch;
-    };
-
-#endif //  C_USBSTATEHOSTAINITIATEBASE_H
--- a/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbengines/usbotgwatcher/src/cusbindicatornotifier.cpp	Wed Mar 31 23:11:08 2010 +0300
@@ -54,7 +54,6 @@
     LOG_FUNC
 
     Close();
-    delete iIconBlinkingTimer;
 
     if (iOtgWatcher.VBusObserver())
         {
@@ -95,11 +94,8 @@
     // Subscribe for otg watcher states change notifications
     iOtgWatcher.SubscribeL(*this);
 
-    iIconBlinkingTimer = CUsbTimer::NewL(*this, EIconBlinkingTimer);
-
     // check here for condition to set usb indicator
     SetIndicatorL();
-
     }
 
 // ---------------------------------------------------------------------------
@@ -114,8 +110,6 @@
 
     LOG1("aVisible = %d" , aVisible);
 
-    iIconBlinkingTimer->Cancel();
-
     SetIndicatorStateL(aVisible
                                 ? EAknIndicatorStateOn
                                    : EAknIndicatorStateOff);
@@ -129,8 +123,7 @@
     {
     LOG_FUNC
 
-    // Will be canceled if active in After()
-    iIconBlinkingTimer->After(0);
+    SetIndicatorStateL( EAknIndicatorStateAnimate );
     }
 
 // ---------------------------------------------------------------------------
@@ -152,42 +145,10 @@
     {
     LOG_FUNC
 
-    iIconBlinkingTimer->Cancel();
     TRAP_IGNORE( ShowStaticL(EFalse) );
     }
 
 // ---------------------------------------------------------------------------
-// From MUsbTimerObserver
-// ---------------------------------------------------------------------------
-// 
-void CUsbIndicatorNotifier::TimerElapsedL(TUsbTimerId aTimerId)
-    {
-    switch (aTimerId)
-        {
-        case EIconBlinkingTimer:
-            {
-            SetIndicatorStateL(iIndicatorState
-                                               ? EAknIndicatorStateOn
-                                                  : EAknIndicatorStateOff);
-
-            iIndicatorState
-                    = (iIndicatorState == EAknIndicatorStateOn
-                                                               ? EAknIndicatorStateOff
-                                                                  : EAknIndicatorStateOn);
-
-            // Will be canceled if active in After()
-            iIconBlinkingTimer->After(KUsbIndicatorBlinkingInterval);
-            break;
-            }
-        default:
-            {
-            LOG1("Unknown timer id = %d", aTimerId)
-            PANIC(EWrongTimerId);
-            }
-        }
-    }
-
-// ---------------------------------------------------------------------------
 // Set USB indicator On or Off
 // ---------------------------------------------------------------------------
 //
--- a/usbengines/usbotgwatcher/src/cusbpersonalityswitch.cpp	Mon Mar 15 12:44:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,299 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "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:  Switches personality
- *
-*/
-
-#include <e32base.h>
-#include <usb.h>
-#include <usbpersonalityids.h>
-
-#include "cusbpersonalityswitch.h"
-
-#include "panic.h"
-#include "debug.h"
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-CUsbPersonalitySwitch::CUsbPersonalitySwitch(
-        MUsbPersonalitySwitchObserver* aObserver) :
-    CActive(CActive::EPriorityStandard), iObserver(aObserver), iState(EIdle)
-    {
-    CActiveScheduler::Add(this);
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-CUsbPersonalitySwitch::~CUsbPersonalitySwitch()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::~CUsbPersonalitySwitch" ) );
-    Cancel();
-    iUsbInterface.Close();
-    iSendData.Close();
-    iRcvData.Close();
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbPersonalitySwitch::ConstructL()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::ConstructL" ) );
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-CUsbPersonalitySwitch* CUsbPersonalitySwitch::NewL(
-        MUsbPersonalitySwitchObserver* aObserver)
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::NewL" ) );
-
-    CUsbPersonalitySwitch* self = new (ELeave) CUsbPersonalitySwitch(
-            aObserver);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self); // pop self
-    return self;
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-TInt CUsbPersonalitySwitch::SwitchPersonalityL(TUint32 aDeviceId,
-        TInt aPersonalityToBeSet)
-    {
-        FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::SwitchPersonality aDeviceId %d, aPersonalityToBeSet %d" ), aDeviceId, aPersonalityToBeSet))
-
-    if (IsActive() || EIdle != iState)
-        {
-        Cancel();
-        iObserver->UsbPersonalitySwitchStateChangedL(
-                MUsbPersonalitySwitchObserver::ERequestCancelled, KErrNone);
-        }
-
-    // create usb interface for the device id
-    TUint32 token(0); // = RFdc.InterfaceToken();
-    TInt err = iUsbInterface.Open(token);
-
-        FTRACE(FPrint(_L("[USBOTGWATCHER]\tCUsbPersonalitySwitch::SwitchPersonality UsbInterface Open err = %d" ), err));
-    if (KErrNone != err)
-        {
-        return err;
-        }
-
-    iPersonalityToBeSet = aPersonalityToBeSet;
-
-    // get list of supported personalities
-    iTransfer.iRequestType = KUsbRequestType_DirToHost
-            | KUsbRequestType_TypeVendor | KUsbRequestType_DestDevice;
-
-    iTransfer.iRequest = KGetAllPersonalitiesReq;
-    iTransfer.iValue = 0;
-    iTransfer.iIndex = 0;
-    iTransfer.iFlags
-            = RUsbInterface::TUsbTransferRequestDetails::EShortTransferOk;
-
-    Reset();
-
-    iState = EGetAllPersonalities;
-
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::SwitchPersonalityL Sending GetAllPersonalities request." ) );
-    iUsbInterface.Ep0Transfer(iTransfer, iSendData, iRcvData, iStatus);
-    SetActive();
-
-    iObserver->UsbPersonalitySwitchStateChangedL(
-            MUsbPersonalitySwitchObserver::ERequestingAllPersonalities,
-            KErrNone);
-
-    return KErrNone;
-    }
-
-void CUsbPersonalitySwitch::CancelSwitchPersonalityL()
-    {
-        FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::CancelSwitchPersonalityL"));
-
-    if (IsActive())
-        {
-        Cancel();
-        iObserver->UsbPersonalitySwitchStateChangedL(
-                MUsbPersonalitySwitchObserver::ERequestCancelled, KErrNone);
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbPersonalitySwitch::RunL()
-    {
-
-    if (KErrNone != iStatus.Int())
-        {
-            FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL iStatus %d" ), iStatus.Int()));
-        User::Leave(iStatus.Int());
-        }
-
-    switch (iState)
-        {
-
-        case EGetAllPersonalities:
-            {
-                FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL GetAllPersonalities completed."));
-
-            TInt numOfPersonalities = iRcvData[KNumOfPersShift];
-                FTRACE(FPrint(_L("[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Amount of personalities in peripheral = %d" ), numOfPersonalities));
-
-            // if no personalities then return
-            if (0 == numOfPersonalities)
-                {
-                    FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL No personailies found in peripheral."));
-                Reset();
-                iObserver->UsbPersonalitySwitchStateChangedL(
-                        MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
-                        KErrNotFound);
-                return;
-                }
-
-            // if needed pers already set, then return
-            TInt currentPersonality = iRcvData[KCurrPersShift];
-            if (iPersonalityToBeSet == currentPersonality)
-                {
-                    FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Needed personality already set in peripheral."));
-                Reset();
-                iObserver->UsbPersonalitySwitchStateChangedL(
-                        MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
-                        KErrInUse);
-                return;
-                }
-
-            // check if device supports needed personality
-            TInt count(0);
-            while (count < numOfPersonalities && iPersonalityToBeSet
-                    != iRcvData[KFirstPersonalityIdShift
-                            + KLenghtOfPersonalityData * count])
-                {
-                ++count;
-                }
-
-            if (count == numOfPersonalities) // not found == not supported
-                {
-                    FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Peripheral does not support needed personality."));
-                Reset();
-                iObserver->UsbPersonalitySwitchStateChangedL(
-                        MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
-                        KErrNotFound);
-                return;
-                }
-
-            iObserver->UsbPersonalitySwitchStateChangedL(
-                    MUsbPersonalitySwitchObserver::EGetAllPersonalitiesCompleted,
-                    KErrNone);
-
-            // set personality
-            iTransfer.iRequestType = KUsbRequestType_DirToDev
-                    | KUsbRequestType_TypeVendor | KUsbRequestType_DestDevice;
-
-            iTransfer.iRequest = KSetPersonalityReq;
-            iTransfer.iValue = iPersonalityToBeSet;
-            iTransfer.iIndex = 0;
-            iTransfer.iFlags
-                    = RUsbInterface::TUsbTransferRequestDetails::EShortTransferOk;
-
-            iSendData.Close();
-            iRcvData.Close();
-
-            iState = ESetPersonality;
-
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL Sending SetPersonality request." ) );
-            iUsbInterface.Ep0Transfer(iTransfer, iSendData, iRcvData, iStatus);
-            SetActive();
-            iObserver->UsbPersonalitySwitchStateChangedL(
-                    MUsbPersonalitySwitchObserver::ERequestingSetPersonality,
-                    KErrNone);
-
-            break;
-            }
-        case ESetPersonality:
-            {
-                FLOG(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL SetPersonality completed."));
-            Reset();
-            iObserver->UsbPersonalitySwitchStateChangedL(
-                    MUsbPersonalitySwitchObserver::ESetPersonalityCompleted,
-                    KErrNone);
-
-            break;
-            }
-            /*  case EGetAllPersResult:
-             {
-             FLOG( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL GetAllPersResult completed.");
-
-             break;
-             }
-             case EGetSetPersResult:
-             {
-             FLOG( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunL GetSetPersResult completed.");
-
-             break;
-             }  */
-
-        case EIdle: // do not break 
-        default:
-            {
-            Panic(EUnexpectedUsbSwitchPersonalityState);
-            }
-        }
-
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-TInt CUsbPersonalitySwitch::RunError(TInt aError)
-    {
-        FTRACE(FPrint(_L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::RunError aError %d" ), aError ));
-    Reset();
-    TRAP_IGNORE (iObserver->UsbPersonalitySwitchStateChangedL(
-            MUsbPersonalitySwitchObserver::ERequestFailed, aError) );
-    return KErrNone;
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbPersonalitySwitch::DoCancel()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::DoCancel" ) )
-
-    iUsbInterface.CancelEP0Transfer();
-    Reset();
-    }
-
-void CUsbPersonalitySwitch::Reset()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbPersonalitySwitch::Reset" ) )
-
-    iState = EIdle;
-    iSendData.Close();
-    iRcvData.Close();
-    }
--- a/usbengines/usbotgwatcher/src/cusbstatehostaidle.cpp	Mon Mar 15 12:44:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "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:  Implementation
- *
-*/
-
-
-#include "cusbstatehostaidle.h"
-#include "cusbnotifmanager.h"
-
-#ifndef STIF
-#include "cusbtimer.h"
-#else
-#include "mockcusbtimer.h"
-#endif
-#include "definitions.h"
-
-#include "errors.h"
-#include "debug.h"
-#include "panic.h"
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAIdle::CUsbStateHostAIdle(CUsbOtgWatcher* aWatcher) :
-    CUsbStateHostAInitiateBase(aWatcher)
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAIdle::ConstructL()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::ConstructL" ) );
-
-    CUsbStateHostAInitiateBase::ConstructL();
-    }
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-
-CUsbStateHostAIdle* CUsbStateHostAIdle::NewL(CUsbOtgWatcher* aWatcher)
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::NewL" ) );
-
-    CUsbStateHostAIdle* self = new (ELeave) CUsbStateHostAIdle(aWatcher);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAIdle::~CUsbStateHostAIdle()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::~CUsbStateHostAIdle" ) );
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-TUsbStateIds CUsbStateHostAIdle::Id()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::Id" ) );
-
-    return EUsbStateHostAIdle;
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAIdle::JustAdvancedToThisStateL()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAIdle::JustAdvancedToThisStateL" ) );
-
-    iWatcher->PrintStateToLog();
-    
-    // do BusDrop, if Up
-    if (CUsbVBusObserver::EVBusUp == iWatcher->VBusObserver()->VBus())
-        {
-        TInt err = iWatcher->Usb().BusDrop();
-        if (err != KErrNone)
-            {
-            err = iWatcher->Usb().BusClearError();
-            if (KErrNone != err)
-                {
-                iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
-                }
-            }
-        }
-    }
--- a/usbengines/usbotgwatcher/src/cusbstatehostainitiatebase.cpp	Mon Mar 15 12:44:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,318 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "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:  Implementation
- *
-*/
-
-
-#include <usbuinotif.h>
-#include <usbpersonalityids.h>
-
-#include "cusbstatehostainitiatebase.h"
-#ifndef STIF
-#include "cusbnotifmanager.h"
-#include "cusbtimer.h"
-#else
-#include "mockcusbnotifmanager.h"
-#include "mockcusbtimer.h"
-#endif
-
-#include "definitions.h"
-#include "errors.h"
-
-#include "debug.h"
-#include "panic.h"
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAInitiateBase::CUsbStateHostAInitiateBase(
-        CUsbOtgWatcher* aWatcher) :
-    CUsbStateHostABase(aWatcher)
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::ConstructL()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::ConstructL" ) );
-
-    CUsbStateHostABase::ConstructL();
-
-    iAttachmentTimer = CUsbTimer::NewL(this, EDeviceAttachmentTimer);
-
-    //iUsbPersonalitySwitch = CUsbPersonalitySwitch::NewL(this);
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-CUsbStateHostAInitiateBase::~CUsbStateHostAInitiateBase()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::~CUsbStateHostAInitiateBase" ) );
-
-    delete iAttachmentTimer;
-    //delete iUsbPersonalitySwitch;
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::JustBeforeLeavingThisStateL()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::JustBeforeLeavingThisStateL" ) );
-    iAttachmentTimer->Cancel();
-    }
-
-// From TimerObserver
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::TimerElapsedL(TUsbTimerId aTimerId)
-    {
-    switch (aTimerId)
-        {
-        case EDeviceAttachmentTimer:
-            {
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::TimerElapsedL - AttachmentTimer" ) );
-            HandleL(EUsbWatcherErrDandlingCable, EUsbStateHostHandle);
-            break;
-            }
-        default:
-            {
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::TimerElapsedL - Unknown timer" ) );
-            Panic(EWrongTimerId);
-            }
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::VBusUpL()
-    {
-    // start timer, waiting for device attachment
-    iAttachmentTimer->After(KTimeToWaitForDeviceAttachment);
-    }
-
-// From VBus observer
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::VBusDownL()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::VBusDownL" ) );
-    iAttachmentTimer->Cancel();
-
-    CUsbStateHostABase::VBusDownL();
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::AHostL()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::AHostL" ) );
-    // do nothing
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::APeripheralL()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostABase::AHostL" ) );
-    ChangeHostStateL(EUsbStateHostAPeripheral);
-    }
-
-// From Host Event notification observer
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DeviceAttachedL(TDeviceEventInformation aTdi)
-    {
-        FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iDeviceId = %d" ), aTdi.iDeviceId));
-        FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iEventType = %d" ), aTdi.iEventType));
-        FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iError = %d" ), aTdi.iError));
-        FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iDriverLoadStatus = %d" ), aTdi.iDriverLoadStatus));
-        FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iVid = %d" ), aTdi.iVid));
-        FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL aTdi.iPid = %d" ), aTdi.iPid));
-
-    iAttachmentTimer->Cancel();
-    
-    // check if an OTG device connected
-    TOtgDescriptor otgDescriptor;
-    
-    // ignore all the errors, assume we connected to not otg
-    TInt err  = iWatcher->Usb().GetOtgDescriptor(aTdi.iDeviceId, otgDescriptor);
-             
-    TBool hnpSupported(otgDescriptor.iAttributes & EUsbOtgHNPSupported);
-    TBool srpSupported(otgDescriptor.iAttributes & EUsbOtgSRPSupported);
-    
-    FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL GetOtgDescriptor err = %d, HNP supported = %d, SRP supported = %d" ), err, hnpSupported, srpSupported));
-             
-    // OTG device supports both hnp and srp
-    if(hnpSupported && srpSupported)
-        {
-        
-        HandleL(EUsbWatcherConnectedToOTG, EUsbStateHostHandle);
-        return;
-        }
-            
-    if (KErrNone != aTdi.iError)
-        {
-        switch (aTdi.iError)
-            // error in attachement
-            {
-            case KErrBadPower:
-                {
-                    FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL TooMuchPower" ) );
-                    HandleL(EUsbWatcherErrDeviceRequiresTooMuchPowerOnEnumeration, EUsbStateHostDelayHandle);
-                    break;
-                }
-            default:
-                {
-                    FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DeviceAttachedL AttachmentError" ) );
-                    HandleL(EUsbWatcherErrUnsupportedDevice, EUsbStateHostHandle);
-                    break;
-                }
-
-            }
-        
-        return;
-        }
-
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DriverLoadSuccessL(TDeviceEventInformation)
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DriverLoadSuccessL" ) );
-    ChangeHostStateL(EUsbStateHostAHost);
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DriverLoadPartialSuccessL(
-        TDeviceEventInformation)
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DriverLoadPartialSuccessL" ) );
-    iWatcher->NotifManager()->ShowNotifierL(KUsbUiNotifOtgWarning,
-            EUsbOtgPartiallySupportedDevice, NULL);
-    ChangeHostStateL(EUsbStateHostAHost);
-
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::DriverLoadFailureL(
-        TDeviceEventInformation aDei)
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::DriverLoadFailureL" ) );
-
-    // try initiate to switch to mass storage
-  /*  if (KErrNone != iUsbPersonalitySwitch->SwitchPersonalityL(aDei.iDeviceId,
-            KUsbPersonalityIdMS ))
-        {*/
-        HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayHandle);
-      //  }
-    }
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CUsbStateHostAInitiateBase::SrpReceivedL()
-    {
-        FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::SrpReceivedL" ) );
-    if (CUsbVBusObserver::EVBusUp != iWatcher->VBusObserver()->VBus())
-        {
-        TInt err = iWatcher->Usb().BusRespondSrp();
-        if (KErrNone != err)
-            {
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::SrpReceivedL BusRespondSrp error" ) );
-            iWatcher->HandleHostProblemL(EUsbWatcherErrorInConnection, EUsbStateHostHandle);
-            }
-        }
-    }
-
-void CUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL(
-        MUsbPersonalitySwitchObserver::TState aState, TInt aData)
-    {
-        FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL aState = %d aData = %d" ), TInt(aState), aData));
-
-    switch (aState)
-        {
-        case ERequestingAllPersonalities:
-            {
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestingAllPersonalities" ) );
-            break;
-            }
-        case ERequestingSetPersonality:
-            {
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestingSetPersonality" ) );
-            break;
-            }
-        case EGetAllPersonalitiesCompleted:
-            {
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL EGetAllPersonalitiesCompleted" ) );
-            if (KErrNotFound == aData)
-                {
-                // no supported or needed personality/ies in the peripheral
-                HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayHandle);
-                }
-            break;
-            }
-        case ESetPersonalityCompleted:
-            {
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ESetPersonalityCompleted" ) );
-
-            break;
-            }
-        case ERequestCancelled:
-            {
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestCancelled" ) );
-            break;
-            }
-        case ERequestFailed:
-            {
-                FLOG( _L( "[USBOTGWATCHER]\tCUsbStateHostAInitiateBase::UsbPersonalitySwitchStateChangedL ERequestFailed" ) );
-            HandleL(EUsbWatcherErrDriversNotFound, EUsbStateHostDelayHandle);
-            break;
-            }
-        default:
-            {
-            Panic(EUnexpectedUsbSwitchPersonalityState);
-            }
-        }
-    }
--- a/usbengines/usbotgwatcher/src/panic.cpp	Mon Mar 15 12:44:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "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:  Central place for debug-type macros & functions
- *
- */
-
-#include "panic.h"
-
-void Panic(TUsbWatcherPanic aCategory)
-    {
-#ifdef _DEBUG
-    User::Panic(KUsbWatcherPanic, aCategory);
-#endif
-    }
--- a/usbengines/usbwatcher/rom/mtp_symbian_temp.iby	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbengines/usbwatcher/rom/mtp_symbian_temp.iby	Wed Mar 31 23:11:08 2010 +0300
@@ -122,6 +122,7 @@
 ECOM_PLUGIN(mtpmetadataservice.dll, mtpmetadataservice.rsc)
 // MTP plugin registration resource file
 data=EPOCROOT##epoc32\data\Z\resource\mtp\2001A9A3.rsc  resource\mtp\2001A9A3.rsc
+data=EPOCROOT##epoc32\data\Z\deviceexperiences\default\en-us\A42998DC-D9BD-4287-A2EA-46116889443C.devicemetadata-ms deviceexperiences\default\en-us\A42998DC-D9BD-4287-A2EA-46116889443C.devicemetadata-ms
 #endif // SYMBIAN_EXCLUDE_MTP
 #endif // MTP_METADATASERVICE_IBY
 
--- a/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp	Wed Mar 31 23:11:08 2010 +0300
@@ -317,12 +317,21 @@
     
     LOG2("Returned error: %d, iState: %d", aError, iState);
 
-    if (KErrNoMemory == aError)
+    switch ( aError )
         {
-        iQueryParams().iQuery = EUSBNotEnoughRam;
-        iPersonalityParams->PersonalityNotifier().ShowQuery(KQueriesNotifier, 
-    	            iQueryParams, iDummyBuf);
-    }
+        case KErrNoMemory:
+            iQueryParams().iQuery = EUSBNotEnoughRam;
+            iPersonalityParams->PersonalityNotifier().ShowQuery(KQueriesNotifier, 
+    	                iQueryParams, iDummyBuf);
+            break;
+        case KErrDiskFull:
+            iQueryParams().iQuery = EUSBDiskFull;
+            iPersonalityParams->PersonalityNotifier().ShowQuery(KQueriesNotifier, 
+    	                iQueryParams, iDummyBuf);
+            break;
+        default:
+        	LOG( "Ignored" );
+        }
 
     //only handle error when TryStart fails now
 	//clean up work to be done in the personality
--- a/usbservices_plat/usb_notifier_api/inc/usbuinotif.h	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbservices_plat/usb_notifier_api/inc/usbuinotif.h	Wed Mar 31 23:11:08 2010 +0300
@@ -64,7 +64,8 @@
     EUSBPossibleDataLossMMC,
     EUSBChangeFromMassStorage,
     EUSBNoMemoryCard,
-    EUSBNotEnoughRam
+    EUSBNotEnoughRam,
+    EUSBDiskFull
    };
 
 /**
--- a/usbuis/usbuinotif/data/usbuinotif.rss	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbuis/usbuinotif/data/usbuinotif.rss	Wed Mar 31 23:11:08 2010 +0300
@@ -264,5 +264,8 @@
 
 RESOURCE TBUF r_usb_error_memory_not_enough { 
     buf = qtn_usb_error_memory_not_enough; }
+
+RESOURCE TBUF r_usb_error_disk_full { 
+    buf = qtn_usb_error_disk_full; }
 	
 // End of File
--- a/usbuis/usbuinotif/loc/usbuinotif.loc	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbuis/usbuinotif/loc/usbuinotif.loc	Wed Mar 31 23:11:08 2010 +0300
@@ -139,11 +139,16 @@
 //
 #define qtn_usb_otg_general_mass_storage_error "General Mass storage error"
 
+// End of USB_OTG
+
 //d: Memory not enough or full error
 //l: popup_note_window
 //r: 5.2
 #define qtn_usb_error_memory_not_enough "Memory full. Close some applications and try to connect USB cable again"
 
-// End of USB_OTG
+//d: Disk full error
+//l: popup_note_window
+//r: 5.2
+#define qtn_usb_error_disk_full "Disk full. Remove some files and try to connect USB cable again."
 
 // End of File
--- a/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp	Mon Mar 15 12:44:42 2010 +0200
+++ b/usbuis/usbuinotif/src/usbuinqueriesnotifiermdrv.cpp	Wed Mar 31 23:11:08 2010 +0300
@@ -287,23 +287,22 @@
         {
         case EUSBStorageMediaFailure:
             {
-                FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBStorageMediaFailure"));
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBStorageMediaFailure"));
             stringHolder = StringLoader::LoadLC( R_USB_STORAGE_MEDIA_FAILURE );
             aCoverDialogId = EUSBCoverStorageMediaFailure;
             break;
             }
         case EUSBChangeFromMassStorage:
             {
-                FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBChangeFromMassStorage"));
-            stringHolder = StringLoader::LoadLC(
-                    R_USB_CHANGE_FROM_MASS_STORAGE );
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBChangeFromMassStorage"));
+            stringHolder = StringLoader::LoadLC( R_USB_CHANGE_FROM_MASS_STORAGE );
             aIsCancelKey = ETrue;
             aCoverDialogId = EUSBCoverChangeFromMassStorage;
             break;
             }
         case EUSBNoMemoryCard:
             {
-                FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBNoMemoryCard"));
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBNoMemoryCard"));
             stringHolder = StringLoader::LoadLC( R_USB_NO_MEMORY_CARD );
             aCoverDialogId = EUSBCoverNoMemoryCard;
             break;
@@ -317,11 +316,19 @@
             aIsErrorQuery = ETrue;
             break;
             }
+        case EUSBDiskFull:
+          	{
+            FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::EUSBDiskFull"));
+            stringHolder = StringLoader::LoadLC( R_USB_ERROR_DISK_FULL );
+            aCoverDialogId = EUSBCoverNoMemoryCard;
+            //set flag to change the icon of querydialog (see QueryUserResponseL())
+            aIsErrorQuery = ETrue;
+            break;
+            }
         default:
             {
-                FTRACE( FPrint(
-                                _L( "[USBUINOTIF]\t CUSBUIQueriesNotifier::ERROR! Unknown query type: %d" ),
-                                iQueryType ) );
+            FTRACE( FPrint( _L( "[USBUINOTIF]\t CUSBUIQueriesNotifier::ERROR! Unknown query type: %d" ),
+                            iQueryType ) );
             }
         }
     FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::GetQueryAttributesLC completed"));