diff --git a/sys/dev/usb/usb_msctest.c b/sys/dev/usb/usb_msctest.c --- a/sys/dev/usb/usb_msctest.c +++ b/sys/dev/usb/usb_msctest.c @@ -118,6 +118,13 @@ static uint8_t scsi_prevent_removal[] = { 0x1e, 0, 0, 0, 1, 0 }; static uint8_t scsi_allow_removal[] = { 0x1e, 0, 0, 0, 0, 0 }; +/** + * The first byte refers to the position in usb_quirk_str[], + * found in usb_quirk.c + */ +static uint8_t scsi_quirk_no_test_unit_ready[] = { 0x1b, 0, 0, 0, 0, 0 }; +static uint8_t scsi_quirk_no_sync_cache[] = { 0x20, 0, 0, 0, 0, 0 }; + #ifndef USB_MSCTEST_BULK_SIZE #define USB_MSCTEST_BULK_SIZE 64 /* dummy */ #endif @@ -836,6 +843,22 @@ timeout = 1; + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_quirk_no_test_unit_ready, sizeof(scsi_quirk_no_test_unit_ready), + USB_MS_HZ); + if (err == 0) { + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_TEST_UNIT_READY); + /* fall through */ + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_quirk_no_sync_cache, sizeof(scsi_quirk_no_sync_cache), + USB_MS_HZ); + if (err == ERR_CSW_FAILED) { + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + goto error; + } + retry_sync_cache: err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, &scsi_sync_cache, sizeof(scsi_sync_cache), @@ -917,9 +940,7 @@ DPRINTF("Device did not respond, enabling all quirks\n"); - usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); usbd_add_dynamic_quirk(udev, UQ_MSC_NO_PREVENT_ALLOW); - usbd_add_dynamic_quirk(udev, UQ_MSC_NO_TEST_UNIT_READY); /* Need to re-enumerate the device */ usbd_req_re_enumerate(udev, NULL);