diff --git a/components/drivers/usb/usbdevice/class/mstorage.c b/components/drivers/usb/usbdevice/class/mstorage.c index 1bde46fffa391479b38c007dc73a2b0553e2b49f..17ea6c23795634bf0949431dd5284d9971d3523e 100644 --- a/components/drivers/usb/usbdevice/class/mstorage.c +++ b/components/drivers/usb/usbdevice/class/mstorage.c @@ -706,7 +706,7 @@ static void _cb_len_calc(ufunction_t func, struct scsi_cmd* cmd, } else { - rt_kprintf("cmd_len error %d\n", cmd->cmd_len); +// rt_kprintf("cmd_len error %d\n", cmd->cmd_len); } } @@ -722,7 +722,7 @@ static rt_bool_t _cbw_verify(ufunction_t func, struct scsi_cmd* cmd, data = (struct mstorage*)func->user_data; if(cmd->cmd_len != cbw->cb_len) { - rt_kprintf("cb_len error\n"); + // rt_kprintf("cb_len error\n"); cmd->cmd_len = cbw->cb_len; } @@ -753,7 +753,7 @@ static rt_bool_t _cbw_verify(ufunction_t func, struct scsi_cmd* cmd, if(cbw->xfer_len < data->cb_data_size) { - rt_kprintf("xfer_len < data_size\n"); + // rt_kprintf("xfer_len < data_size\n"); data->cb_data_size = cbw->xfer_len; data->csw_response.status = 1; } @@ -769,7 +769,7 @@ static rt_size_t _cbw_handler(ufunction_t func, struct scsi_cmd* cmd, RT_ASSERT(func != RT_NULL); RT_ASSERT(cbw != RT_NULL); RT_ASSERT(cmd->handler != RT_NULL); - + data = (struct mstorage*)func->user_data; data->processing = cmd; return cmd->handler(func, cbw); @@ -896,32 +896,32 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup) RT_DEBUG_LOG(RT_DEBUG_USB, ("mstorage_interface_handler\n")); - switch(setup->request) + switch(setup->bRequest) { case USBREQ_GET_MAX_LUN: RT_DEBUG_LOG(RT_DEBUG_USB, ("USBREQ_GET_MAX_LUN\n")); - if(setup->value || setup->length != 1) + if(setup->wValue || setup->wLength != 1) { rt_usbd_ep0_set_stall(func->device); } else { - rt_usbd_ep0_write(func->device, &lun, 1); + rt_usbd_ep0_write(func->device, &lun, setup->wLength); } break; case USBREQ_MASS_STORAGE_RESET: RT_DEBUG_LOG(RT_DEBUG_USB, ("USBREQ_MASS_STORAGE_RESET\n")); - if(setup->value || setup->length != 0) + if(setup->wValue || setup->wLength != 0) { rt_usbd_ep0_set_stall(func->device); } else - { - rt_usbd_ep0_write(func->device, RT_NULL, 0); + { + dcd_ep0_send_status(func->device->dcd); } break; default: