Skip to content

Commit 603effb

Browse files
cdc: Fix autoflush for FIFO < MPS
1 parent f03c28e commit 603effb

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)