mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
improve msc
This commit is contained in:
parent
2eeeda1bcf
commit
7a15d2e0d2
@ -161,22 +161,22 @@ uint16_t mscd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint1
|
||||
MSC_SUBCLASS_SCSI == itf_desc->bInterfaceSubClass &&
|
||||
MSC_PROTOCOL_BOT == itf_desc->bInterfaceProtocol, 0);
|
||||
|
||||
// Max length mus be at least 1 interface + 2 endpoints
|
||||
TU_VERIFY(max_len >= sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t), 0);
|
||||
// msc driver length is fixed
|
||||
enum { _MSC_DRIVER_LEN = sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t) };
|
||||
|
||||
// Max length mus be at least 1 interface + 2 endpoints
|
||||
TU_VERIFY(max_len >= _MSC_DRIVER_LEN, 0);
|
||||
|
||||
uint16_t len = 0;
|
||||
mscd_interface_t * p_msc = &_mscd_itf;
|
||||
p_msc->itf_num = itf_desc->bInterfaceNumber;
|
||||
|
||||
// Open endpoint pair
|
||||
TU_ASSERT( usbd_open_edpt_pair(rhport, tu_desc_next(itf_desc), 2, TUSB_XFER_BULK, &p_msc->ep_out, &p_msc->ep_in), 0 );
|
||||
|
||||
p_msc->itf_num = itf_desc->bInterfaceNumber;
|
||||
len = sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
|
||||
|
||||
// Prepare for Command Block Wrapper
|
||||
TU_ASSERT( usbd_edpt_xfer(rhport, p_msc->ep_out, (uint8_t*) &p_msc->cbw, sizeof(msc_cbw_t)), 0 );
|
||||
|
||||
return len;
|
||||
return _MSC_DRIVER_LEN;
|
||||
}
|
||||
|
||||
// Handle class control request
|
||||
|
Loading…
x
Reference in New Issue
Block a user