You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2022/08/11 15:50:58 UTC

[mynewt-core] branch master updated: hw/usb/cdc_console: Modify flush if cdc tx bufsize defined

This is an automated email from the ASF dual-hosted git repository.

wes3 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new c5fb2b594 hw/usb/cdc_console: Modify flush if cdc tx bufsize defined
c5fb2b594 is described below

commit c5fb2b594d0194de530cf85dd1040184c87bcfe0
Author: Will San Filippo <wi...@juul.com>
AuthorDate: Wed Aug 10 12:27:38 2022 -0700

    hw/usb/cdc_console: Modify flush if cdc tx bufsize defined
    
    If the user defines USBD_CDC_TX_BUFSIZE and that buffer size is
    larger than USBD_CDC_DATA_EP_SIZE, data will not be flushed
    immediately. This change will cause it to be flushed immediately.
---
 hw/usb/tinyusb/cdc_console/src/cdc_console.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/usb/tinyusb/cdc_console/src/cdc_console.c b/hw/usb/tinyusb/cdc_console/src/cdc_console.c
index df199c265..be6490d32 100755
--- a/hw/usb/tinyusb/cdc_console/src/cdc_console.c
+++ b/hw/usb/tinyusb/cdc_console/src/cdc_console.c
@@ -71,7 +71,11 @@ console_rx_restart(void)
 static void
 tx_flush_ev_cb(struct os_event *ev)
 {
+#if MYNEWT_VAL(USBD_CDC_TX_BUFSIZE)
+    if (connected && tud_cdc_write_available() < CFG_TUD_CDC_TX_BUFSIZE) {
+#else
     if (connected && tud_cdc_write_available() < USBD_CDC_DATA_EP_SIZE) {
+#endif
         if (tud_cdc_write_flush() == 0) {
             /*
              * Previous data not sent yet.