[Components][Driver][USB][Class]fix msc class
@@ -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;
}
@@ -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:
