userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp
changeset 271 dc268b18d709
parent 176 af6ec97d9189
child 294 039a3e647356
child 297 b2826f67641f
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp	Mon Sep 13 15:16:07 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp	Wed Sep 22 10:53:45 2010 +0100
@@ -173,11 +173,16 @@
         {
         if (iUsbHostMsDevice->IsSuspended())
             {
-            // request resume 
-            Unlock();
-            iUsbHostMsDevice->Resume(iStatus);
-            SetActive();
-            return;
+
+            RMessage2 msg = iRMessage2[iDequeueIndex];      
+            if (msg.Function() != EUsbHostMsSuspendLun)
+                {
+                // request resume 
+                Unlock();
+                iUsbHostMsDevice->Resume(iStatus);
+                SetActive();
+                return;
+                }            
             }
         }
 
@@ -309,8 +314,11 @@
 		return;
 	case EUsbHostMsUnRegisterInterface:
 		// Check whether all luns have got uninitialised. 
-		for(TInt i = 0, j = iUsbHostMsDevice->GetMaxLun(); i <= j; i++)
-			TRAP_IGNORE(iUsbHostMsDevice->RemoveLunL(i));
+        if (iUsbHostMsDevice)
+            {
+            for(TInt i = 0, j = iUsbHostMsDevice->GetMaxLun(); i <= j; i++)
+                TRAP_IGNORE(iUsbHostMsDevice->RemoveLunL(i));
+            }
 		TRAP(ret, UnRegisterInterfaceL(aMessage));
 		break;
 	case EUsbHostMsRegisterLun: