Skip to content

Commit

Permalink
sys/usb_cdc_acm_stdio: only submit and flush for non-empty buffer
Browse files Browse the repository at this point in the history
(cherry picked from commit 67edd6c)
  • Loading branch information
mguetschow authored and benpicco committed Nov 14, 2024
1 parent 3bfbc55 commit ed00724
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sys/usb/usbus/cdc/acm/cdc_acm_stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ static uint8_t _cdc_tx_buf_mem[CONFIG_USBUS_CDC_ACM_STDIO_BUF_SIZE];
static ssize_t _write(const void* buffer, size_t len)
{
const char *start = buffer;
do {
while (len) {
size_t n = usbus_cdc_acm_submit(&cdcacm, buffer, len);
usbus_cdc_acm_flush(&cdcacm);
/* Use tsrb and flush */
buffer = (char *)buffer + n;
len -= n;
} while (len);
}
return (char *)buffer - start;
}

Expand Down

0 comments on commit ed00724

Please sign in to comment.