Skip to content

Commit 7512ad6

Browse files
projectgusdpgeorge
authored andcommitted
shared/tinyusb: Fix hang from new tx_overwritabe_if_not_connected flag.
This flag is in the main branch of TinyUSB, included in Espressif since their v0.18.0~3 component release (but it's not actually in TinyUSB v0.18.0 release). Setting the flag is needed for the USB device not to block waiting for space in the FIFO if the host is disconnected. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 1abbdba commit 7512ad6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

shared/tinyusb/mp_usbd.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,18 @@
4343
// Initialise TinyUSB device.
4444
static inline void mp_usbd_init_tud(void) {
4545
tusb_init();
46-
tud_cdc_configure_fifo_t cfg = { .rx_persistent = 0, .tx_persistent = 1 };
46+
tud_cdc_configure_fifo_t cfg = { .rx_persistent = 0,
47+
.tx_persistent = 1,
48+
49+
// This config flag is unreleased in TinyUSB >v0.18.0
50+
// but included in Espressif's TinyUSB component since v0.18.0~3
51+
//
52+
// Versioning issue reported as
53+
// https://github.com/espressif/esp-usb/issues/236
54+
#if TUSB_VERSION_NUMBER > 1800 || defined(ESP_PLATFORM)
55+
.tx_overwritabe_if_not_connected = 1,
56+
#endif
57+
};
4758
tud_cdc_configure_fifo(&cfg);
4859
}
4960

0 commit comments

Comments
 (0)