fixed CFG_TUD_VENDOR > 1 vendord_open tud_vendor_n_write_flush
tud_vendor_n_write_flush argument should be 0,1,2,..., but p_vendor - _vendord_itf is 0, sizeof(vendord_interface_t), 2*sizeof(vendord_interface_t), ...
This commit is contained in:
9
src/class/vendor/vendor_device.c
vendored
9
src/class/vendor/vendor_device.c
vendored
@@ -201,9 +201,10 @@ uint16_t vendord_open(uint8_t rhport, const tusb_desc_interface_t* desc_itf, uin
|
|||||||
|
|
||||||
// Find available interface
|
// Find available interface
|
||||||
vendord_interface_t* p_vendor = NULL;
|
vendord_interface_t* p_vendor = NULL;
|
||||||
for(uint8_t i=0; i<CFG_TUD_VENDOR; i++) {
|
uint8_t itf;
|
||||||
if (!tud_vendor_n_mounted(i)) {
|
for(itf=0; i<CFG_TUD_VENDOR; itf++) {
|
||||||
p_vendor = &_vendord_itf[i];
|
if (!tud_vendor_n_mounted(itf)) {
|
||||||
|
p_vendor = &_vendord_itf[itf];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,7 +223,7 @@ uint16_t vendord_open(uint8_t rhport, const tusb_desc_interface_t* desc_itf, uin
|
|||||||
if (tu_edpt_dir(desc_ep->bEndpointAddress) == TUSB_DIR_IN) {
|
if (tu_edpt_dir(desc_ep->bEndpointAddress) == TUSB_DIR_IN) {
|
||||||
if (p_vendor->tx.stream.ep_addr == 0) {
|
if (p_vendor->tx.stream.ep_addr == 0) {
|
||||||
tu_edpt_stream_open(&p_vendor->tx.stream, desc_ep);
|
tu_edpt_stream_open(&p_vendor->tx.stream, desc_ep);
|
||||||
tud_vendor_n_write_flush((uint8_t)(p_vendor - _vendord_itf));
|
tud_vendor_n_write_flush(itf);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (p_vendor->rx.stream.ep_addr == 0) {
|
if (p_vendor->rx.stream.ep_addr == 0) {
|
||||||
|
Reference in New Issue
Block a user