Do not fail right away if removable media not found

When cros_write_firmware is invoked and no removable device is found,
the utility terminates with a failure. It is better to have it prompt
the user to plug in a card and wait for it to happen.

Also, introduce a way to suppress the ellipsis addition to progress
messages, display a spinning wheel instead to demonstrate that the
program is waiting.

BUG=none
TEST=manual
  . run the utility without the SD card plugged in, observe it spin
    waiting for the user to insert a card. Verify that ^C terminates
    the utility gracefully.

Change-Id: I61af5319e8443fe3c54bad16b57769228fcbfd74
Reviewed-on: https://gerrit.chromium.org/gerrit/49437
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/host/lib/write_firmware.py b/host/lib/write_firmware.py
index e029d0b..10c7693 100644
--- a/host/lib/write_firmware.py
+++ b/host/lib/write_firmware.py
@@ -714,11 +714,20 @@
       payload: Full path to payload.
     """
     disk = None
-    disks = self._ListUsbDisks()
 
-    if not disks:
-      self._out.Error('No removable devices found')
-      self._out.Error('Did you forget to plug in the SD card?')
+    # If no removable devices found - prompt user and wait for one to appear.
+    disks = self._ListUsbDisks()
+    try:
+      spinner = '|/-\\'
+      index = 0
+      while not disks:
+        self._out.ClearProgress()
+        self._out.Progress('No removable devices found, plug something in %s '
+                           % spinner[index], trailer='')
+        index = (index + 1) % len(spinner)
+        disks = self._ListUsbDisks()
+        time.sleep(.2)
+    except KeyboardInterrupt:
       return
 
     if dest.startswith(':'):