diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2012-02-09 09:36:07 -0800 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-02-17 10:58:37 -0800 |
commit | ab3e59d66417919efd0e213757254a7c295e6c5a (patch) | |
tree | a35f54eec53410185cfaa77c4fc71af553405669 /common | |
parent | bbf79dff8c882237adf86b6d441b7dba4cecfa6b (diff) |
usb: properly detect empty mass storage media reader
When a USB card reader is empty, it will return "Not Ready - medium not
present" as Key Code Qualifier. In that situation, it's useless waiting
for the full timeout since the result won't change until the user
inserts a card.
U-Boot mass storage returns empty mass storage devices with a size of 0,
skip them in the VBoot devices enumeration.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=None
TEST=On Link, run without a MMC card.
Change-Id: Iac37887742e5738e249f595e0413eec16b391fae
Reviewed-on: https://gerrit.chromium.org/gerrit/15582
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_storage.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/usb_storage.c b/common/usb_storage.c index 2ce2dcd2b21..413562607ac 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--); |