Skip to content

Commit d9817eb

Browse files
authored
Merge pull request hathach#1487 from tore-espressif/fix/cdc_autoflush
cdc: Fix autoflush for FIFO < MPS
2 parents f03c28e + 603effb commit d9817eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/class/cdc/cdc_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ uint32_t tud_cdc_n_write(uint8_t itf, void const* buffer, uint32_t bufsize)
171171
uint16_t ret = tu_fifo_write_n(&p_cdc->tx_ff, buffer, (uint16_t) bufsize);
172172

173173
// flush if queue more than packet size
174-
if ( tu_fifo_count(&p_cdc->tx_ff) >= BULK_PACKET_SIZE )
174+
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)) )
175175
{
176176
tud_cdc_n_write_flush(itf);
177177
}

0 commit comments

Comments
 (0)