summaryrefslogtreecommitdiff
path: root/src/class/cdc
diff options
context:
space:
mode:
authorTomas Rezucha <[email protected]>2022-06-02 13:22:53 +0200
committerTomas Rezucha <[email protected]>2022-12-06 07:49:26 +0100
commit603effbb77ab587bae9800993a53599a9dbff97e (patch)
treeeda2bf3c03b53ed7852ccd37eef2f3e8a9fb66ce /src/class/cdc
parentf03c28ec31ff68b88d6b88fdccbfa50c738490aa (diff)
cdc: Fix autoflush for FIFO < MPS
Diffstat (limited to 'src/class/cdc')
-rw-r--r--src/class/cdc/cdc_device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c
index fab6f0035..77c73030a 100644
--- a/src/class/cdc/cdc_device.c
+++ b/src/class/cdc/cdc_device.c
@@ -171,7 +171,7 @@ uint32_t tud_cdc_n_write(uint8_t itf, void const* buffer, uint32_t bufsize)
uint16_t ret = tu_fifo_write_n(&p_cdc->tx_ff, buffer, (uint16_t) bufsize);
// flush if queue more than packet size
- if ( tu_fifo_count(&p_cdc->tx_ff) >= BULK_PACKET_SIZE )
+ if ( (tu_fifo_count(&p_cdc->tx_ff) >= BULK_PACKET_SIZE) || ((CFG_TUD_CDC_TX_BUFSIZE < BULK_PACKET_SIZE) && tu_fifo_full(&p_cdc->tx_ff)) )
{
tud_cdc_n_write_flush(itf);
}