Skip to content

Commit a54faa7

Browse files
authored
Merge pull request #20987 from benpicco/backport/2024.10/stdio-cdc-acm-miss
sys/usb_cdc_acm_stdio: only submit and flush for non-empty buffer [backport 2024.10]
2 parents b9432b2 + ed00724 commit a54faa7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sys/usb/usbus/cdc/acm/cdc_acm_stdio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ static uint8_t _cdc_tx_buf_mem[CONFIG_USBUS_CDC_ACM_STDIO_BUF_SIZE];
3737
static ssize_t _write(const void* buffer, size_t len)
3838
{
3939
const char *start = buffer;
40-
do {
40+
while (len) {
4141
size_t n = usbus_cdc_acm_submit(&cdcacm, buffer, len);
4242
usbus_cdc_acm_flush(&cdcacm);
4343
/* Use tsrb and flush */
4444
buffer = (char *)buffer + n;
4545
len -= n;
46-
} while (len);
46+
}
4747
return (char *)buffer - start;
4848
}
4949

0 commit comments

Comments
 (0)