usbengines/usbwatcher/src/cusbwatcher.cpp
branchRCL_3
changeset 6 a15c582fbf97
parent 5 7068aba64af5
child 7 ff9df6630274
--- a/usbengines/usbwatcher/src/cusbwatcher.cpp	Fri Feb 19 23:50:33 2010 +0200
+++ b/usbengines/usbwatcher/src/cusbwatcher.cpp	Fri Mar 12 15:48:40 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 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"
@@ -387,11 +387,13 @@
         case EUsbStarting:
             LOG( "Personality started" );
             Notify( ret );
-            iState = EUsbStarted;
             if( iStopStartScenario )
                 {
                 iStopStartScenario = EFalse;
                 }
+            //check if StartPersonality() fails     
+            LEAVEIFERROR( ret );
+            iState = EUsbStarted;
             break;
 
         case EUsbStopping:
@@ -453,10 +455,21 @@
 // This method is not called cause RunL() never leaves.
 // ----------------------------------------------------------------------------
 //
-TInt CUsbWatcher::RunError(TInt /*aError*/)
+TInt CUsbWatcher::RunError(TInt aError)
     {
     LOG_FUNC
-    // Left empty cause this can't happend
+    
+    LOG2("Returned error: %d, iState: %d", aError, iState);
+    if ( iState == EUsbStarting )
+        {
+        RProperty::Set( KPSUidUsbWatcher,
+                KUsbWatcherSelectedPersonality,
+                KUsbWatcherSelectedPersonalityNone );
+        LOG( "personality set to none" );
+
+        iState = EUsbIdle;
+        }
+    
     return KErrNone;
     }