diff options
| author | sakumisu <[email protected]> | 2024-09-27 19:00:38 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2024-09-27 19:03:33 +0800 |
| commit | 2b6eebcbb253d2e8e1cca9a48222d160d2745157 (patch) | |
| tree | e1ee13e5acef6651326671e877105e730b575525 | |
| parent | ab59beebd407450650baf703f60f321fbcbec485 (diff) | |
fix(class/msc/usbh_msc): when device stalls by usbh_msc_get_maxlun, ingore error and set lun=0, refs:#259
| -rw-r--r-- | class/msc/usbh_msc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/class/msc/usbh_msc.c b/class/msc/usbh_msc.c index d420408b..1327175f 100644 --- a/class/msc/usbh_msc.c +++ b/class/msc/usbh_msc.c @@ -278,7 +278,12 @@ static int usbh_msc_connect(struct usbh_hubport *hport, uint8_t intf) ret = usbh_msc_get_maxlun(msc_class, g_msc_buf[msc_class->sdchar - 'a']); if (ret < 0) { - return ret; + if (ret == -USB_ERR_STALL) { + USB_LOG_WRN("Device does not support multiple LUNs\r\n"); + g_msc_buf[msc_class->sdchar - 'a'][0] = 0; + } else { + return ret; + } } USB_LOG_INFO("Get max LUN:%u\r\n", g_msc_buf[msc_class->sdchar - 'a'][0] + 1); @@ -372,7 +377,6 @@ static int usbh_msc_disconnect(struct usbh_hubport *hport, uint8_t intf) return ret; } - int usbh_msc_scsi_write10(struct usbh_msc *msc_class, uint32_t start_sector, const uint8_t *buffer, uint32_t nsectors) { struct CBW *cbw; |
