Make sure that cros_write_firmware returns errors when appropriate

The cros_write_firmware utility does not always return error status,
it should return success is and only if the image was successfully
written to a removable device.

With this change the nonzero error is returned both when the utility
is interrupted while waiting for a device to be plugged in and when
there is more than one removable device found without clearly
indicating which one to use..

  . plug in two removable devices and run the utility, get the

    Please specify destination as '-w sd:<disk_description>'
     - <disk_description> can be either . for the only disk,
       or the full device name, one of listed below:
    /dev/sde - Realtek USB3.0 Card Reader 2.0 GB
    /dev/sdg - Realtek USB3.0 Card Reader 3.9 GB

  . hit ^C while the utility is waiting for the card to be plugged in,
    get the following:

    No removable device found, interrupted

   In both cases exit status is set to 1

Change-Id: Icc385274b04557d058d0cbe01c9a640f3d794fc8
Commit-Queue: Vadim Bendebury <>
Tested-by: Vadim Bendebury <>
Reviewed-by: Simon Glass <>
1 file changed