summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-04-02 23:56:47 +0700
committerhathach <[email protected]>2026-04-03 10:45:16 +0700
commit9368e5d40f3d8e5ac323d288f969782a962d593e (patch)
treeee398f81d49d3e3c0637650a8aa1f3c8993d4a5e /examples
parent134e14849b1864ce3454950a50d2c79d93a96cd8 (diff)
fix issue with exmaple
Diffstat (limited to 'examples')
-rw-r--r--examples/host/cdc_msc_hid/src/cdc_app.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/examples/host/cdc_msc_hid/src/cdc_app.c b/examples/host/cdc_msc_hid/src/cdc_app.c
index c897bdd06..20033981e 100644
--- a/examples/host/cdc_msc_hid/src/cdc_app.c
+++ b/examples/host/cdc_msc_hid/src/cdc_app.c
@@ -43,14 +43,10 @@ static size_t console_read(uint8_t *buf, size_t bufsize) {
}
static size_t console_write(const uint8_t *buf, size_t bufsize) {
- size_t count = 0;
- while (count < bufsize) {
- if (board_putchar((int)buf[count]) < 0) {
- break;
- }
- count++;
- }
- return count;
+ // Use board_uart_write directly for non-blocking behavior.
+ // board_putchar -> sys_write has a blocking retry loop that causes UART RX overrun.
+ int wr = board_uart_write(buf, (int) bufsize);
+ return (wr > 0) ? (size_t) wr : 0;
}
// forward from console to usbh
@@ -78,7 +74,7 @@ void cdc_app_task(void) {
do {
// uart write is slow, while waiting forward uart -> usbh else uart rx can be overflow
if (count) {
- wr += console_write(buf + wr, count);
+ wr += console_write(buf + wr, count - wr);
}
console_to_usbh(idx);
} while (wr < count);