summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2015-02-02 18:20:10 +0000
committerhselasky <hselasky@FreeBSD.org>2015-02-02 18:20:10 +0000
commitc5880225ff8728678a96990b4f6b3e7807ac2c6e (patch)
tree509f1f16a382fff6573dbd6e9f77943782507df7
parentfce5f51901deee183ae750dd0e916eaf2ae07f96 (diff)
downloadFreeBSD-src-c5880225ff8728678a96990b4f6b3e7807ac2c6e.zip
FreeBSD-src-c5880225ff8728678a96990b4f6b3e7807ac2c6e.tar.gz
Separate out detection of prevent and allow medium removal quirk.
PR: 185747 MFC after: 1 week
-rw-r--r--sys/dev/usb/usb_msctest.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/sys/dev/usb/usb_msctest.c b/sys/dev/usb/usb_msctest.c
index 91b2292..c77afd0 100644
--- a/sys/dev/usb/usb_msctest.c
+++ b/sys/dev/usb/usb_msctest.c
@@ -113,6 +113,8 @@ static uint8_t scsi_request_sense[] = { 0x03, 0x00, 0x00, 0x00, 0x12, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static uint8_t scsi_read_capacity[] = { 0x25, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
+static uint8_t scsi_prevent_removal[] = { 0x1e, 0, 0, 0, 1, 0 };
+static uint8_t scsi_allow_removal[] = { 0x1e, 0, 0, 0, 0, 0 };
#ifndef USB_MSCTEST_BULK_SIZE
#define USB_MSCTEST_BULK_SIZE 64 /* dummy */
@@ -702,10 +704,28 @@ usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index)
USB_MS_HZ);
if (err != 0) {
+ if (err != ERR_CSW_FAILED)
+ goto error;
+ DPRINTF("Test unit ready failed\n");
+ }
+ err = bbb_command_start(sc, DIR_OUT, 0, NULL, 0,
+ &scsi_prevent_removal, sizeof(scsi_prevent_removal),
+ USB_MS_HZ);
+
+ if (err == 0) {
+ err = bbb_command_start(sc, DIR_OUT, 0, NULL, 0,
+ &scsi_allow_removal, sizeof(scsi_allow_removal),
+ USB_MS_HZ);
+ }
+
+ if (err != 0) {
if (err != ERR_CSW_FAILED)
goto error;
+ DPRINTF("Device doesn't handle prevent and allow removal\n");
+ usbd_add_dynamic_quirk(udev, UQ_MSC_NO_PREVENT_ALLOW);
}
+
timeout = 1;
retry_sync_cache:
@@ -718,11 +738,9 @@ retry_sync_cache:
if (err != ERR_CSW_FAILED)
goto error;
- DPRINTF("Device doesn't handle synchronize cache "
- "and prevent allow medium removal\n");
+ DPRINTF("Device doesn't handle synchronize cache\n");
usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE);
- usbd_add_dynamic_quirk(udev, UQ_MSC_NO_PREVENT_ALLOW);
} else {
/*
@@ -749,13 +767,10 @@ retry_sync_cache:
goto retry_sync_cache;
DPRINTF("Device most likely doesn't "
- "handle synchronize cache nor"
- "prevent allow medium removal\n");
+ "handle synchronize cache\n");
usbd_add_dynamic_quirk(udev,
UQ_MSC_NO_SYNC_CACHE);
- usbd_add_dynamic_quirk(udev,
- UQ_MSC_NO_PREVENT_ALLOW);
} else {
if (err != ERR_CSW_FAILED)
goto error;
OpenPOWER on IntegriCloud