mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
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]
This commit is contained in:
commit
a54faa777b
@ -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)
|
static ssize_t _write(const void* buffer, size_t len)
|
||||||
{
|
{
|
||||||
const char *start = buffer;
|
const char *start = buffer;
|
||||||
do {
|
while (len) {
|
||||||
size_t n = usbus_cdc_acm_submit(&cdcacm, buffer, len);
|
size_t n = usbus_cdc_acm_submit(&cdcacm, buffer, len);
|
||||||
usbus_cdc_acm_flush(&cdcacm);
|
usbus_cdc_acm_flush(&cdcacm);
|
||||||
/* Use tsrb and flush */
|
/* Use tsrb and flush */
|
||||||
buffer = (char *)buffer + n;
|
buffer = (char *)buffer + n;
|
||||||
len -= n;
|
len -= n;
|
||||||
} while (len);
|
}
|
||||||
return (char *)buffer - start;
|
return (char *)buffer - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user