From ae783b0b1afb61928fd0038275d2450956e9cc9c Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 31 Jul 2018 13:54:47 +0700 Subject: [PATCH] update tinyusb, set scsi sense key for unsupported commands --- lib/tinyusb | 2 +- ports/nrf/usb/usb_msc_flash.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/tinyusb b/lib/tinyusb index cf6c534c19..191b73b58c 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit cf6c534c1974f4efeb5c136697d1f1028e6aa34a +Subproject commit 191b73b58c5ad6a098c652f31459ef39078a484b diff --git a/ports/nrf/usb/usb_msc_flash.c b/ports/nrf/usb/usb_msc_flash.c index 7972a408b8..384ef55780 100644 --- a/ports/nrf/usb/usb_msc_flash.c +++ b/ports/nrf/usb/usb_msc_flash.c @@ -82,8 +82,13 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, resplen = 0; break; - // negative means error -> tusb could stall and/or response with failed status - default: return -1; + default: + // Set Sense = Invalid Command Operation + tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00); + + // negative means error -> tinyusb could stall and/or response with failed status + resplen = -1; + break; } // return len must not larger than bufsize