diff options
-rw-r--r-- | common/usb_storage.c | 9 | ||||
-rw-r--r-- | lib/vbexport/boot_device.c | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/common/usb_storage.c b/common/usb_storage.c index 2ce2dcd2b2..413562607a 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -968,6 +968,15 @@ static int usb_test_unit_ready(ccb *srb, struct us_data *ss) if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD) return 0; usb_request_sense(srb, ss); + /* Check the Key Code Qualifier, if it matches + * "Not Ready - medium not present" + * (the sense Key equals 0x2 and the ASC is 0x3a) + * return immediatly as the medium being absent won't change + * unless there is a user action. + */ + if ((srb->sense_buf[2] == 0x02) && + (srb->sense_buf[12] == 0x3a)) + return -1; wait_ms(100); } while (retry--); diff --git a/lib/vbexport/boot_device.c b/lib/vbexport/boot_device.c index 8b842e1a0a..11daea2176 100644 --- a/lib/vbexport/boot_device.c +++ b/lib/vbexport/boot_device.c @@ -50,7 +50,7 @@ int boot_device_matches(const block_dev_desc_t *dev, { *flags = dev->removable ? VB_DISK_FLAG_REMOVABLE : VB_DISK_FLAG_FIXED; - return (*flags & disk_flags) == disk_flags; + return (*flags & disk_flags) == disk_flags && dev->lba; } /** |