[Components][Driver][USB][Class]fix msc class

This commit is contained in:
MiraculousConch 2017-11-29 14:26:15 +08:00
parent c64fa9f059
commit e875128115
1 changed files with 10 additions and 10 deletions

View File

@ -706,7 +706,7 @@ static void _cb_len_calc(ufunction_t func, struct scsi_cmd* cmd,
} }
else 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; data = (struct mstorage*)func->user_data;
if(cmd->cmd_len != cbw->cb_len) 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; 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) 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->cb_data_size = cbw->xfer_len;
data->csw_response.status = 1; 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")); RT_DEBUG_LOG(RT_DEBUG_USB, ("mstorage_interface_handler\n"));
switch(setup->request) switch(setup->bRequest)
{ {
case USBREQ_GET_MAX_LUN: case USBREQ_GET_MAX_LUN:
RT_DEBUG_LOG(RT_DEBUG_USB, ("USBREQ_GET_MAX_LUN\n")); 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); rt_usbd_ep0_set_stall(func->device);
} }
else else
{ {
rt_usbd_ep0_write(func->device, &lun, 1); rt_usbd_ep0_write(func->device, &lun, setup->wLength);
} }
break; break;
case USBREQ_MASS_STORAGE_RESET: case USBREQ_MASS_STORAGE_RESET:
RT_DEBUG_LOG(RT_DEBUG_USB, ("USBREQ_MASS_STORAGE_RESET\n")); 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); rt_usbd_ep0_set_stall(func->device);
} }
else else
{ {
rt_usbd_ep0_write(func->device, RT_NULL, 0); dcd_ep0_send_status(func->device->dcd);
} }
break; break;
default: default: