+\r
+                               /* Abort if device removed */\r
+                               if (USB_HostState == HOST_STATE_Unattached)\r
+                                 break;\r
+\r
+                               /* Check to see if the attached device is ready for new commands */\r
+                               ErrorCode = MassStore_TestUnitReady(0);\r
+                                 \r
+                               /* If attached device is ready, abort the loop */\r
+                               if (!(ErrorCode))\r
+                                 break;\r
+\r
+                               /* If an error othe than a logical command failure (indicating device busy) returned, abort */\r
+                               if (ErrorCode != MASS_STORE_SCSI_COMMAND_FAILED)\r