diff options
| author | Zixun LI <[email protected]> | 2025-07-07 10:53:39 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-07 10:53:39 +0200 |
| commit | a2ee6da299b70908726abae055ff27576f369019 (patch) | |
| tree | 0451cced185d01229b35db17de7f3c1a508ab524 /src/class | |
| parent | b012e95dfe40c6cd73cde7a6917848c4131dc548 (diff) | |
| parent | 7b995267d6c5fb59719e9c652ab53186fa42c8b4 (diff) | |
Merge pull request #3162 from YixingShen/master
fixed vendord_open's tud_vendor_n_write_flush when CFG_TUD_VENDOR > 1
Diffstat (limited to 'src/class')
| -rw-r--r-- | src/class/vendor/vendor_device.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/class/vendor/vendor_device.c b/src/class/vendor/vendor_device.c index 7f1fd8c41..6f109c321 100644 --- a/src/class/vendor/vendor_device.c +++ b/src/class/vendor/vendor_device.c @@ -201,9 +201,10 @@ uint16_t vendord_open(uint8_t rhport, const tusb_desc_interface_t* desc_itf, uin // Find available interface vendord_interface_t* p_vendor = NULL; - for(uint8_t i=0; i<CFG_TUD_VENDOR; i++) { - if (!tud_vendor_n_mounted(i)) { - p_vendor = &_vendord_itf[i]; + uint8_t itf; + for(itf=0; itf<CFG_TUD_VENDOR; itf++) { + if (!tud_vendor_n_mounted(itf)) { + p_vendor = &_vendord_itf[itf]; 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 (p_vendor->tx.stream.ep_addr == 0) { 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 { if (p_vendor->rx.stream.ep_addr == 0) { |
