From 27791641aa801abf408de5f45a1b3f47aec61c8c Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 10 Feb 2021 14:49:19 +0900 Subject: [PATCH] GNU/Linux: Fix the example. Signed-off-by: NIIBE Yutaka --- example-cdc-gnu-linux/usb-cdc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/example-cdc-gnu-linux/usb-cdc.c b/example-cdc-gnu-linux/usb-cdc.c index ebebf68..e1109b7 100644 --- a/example-cdc-gnu-linux/usb-cdc.c +++ b/example-cdc-gnu-linux/usb-cdc.c @@ -904,15 +904,15 @@ tty_recv (struct tty *t, char *buf, uint32_t *timeout) chopstx_mutex_lock (&t->mtx); r = check_rx (t); chopstx_mutex_unlock (&t->mtx); - if (r || (timeout != NULL && *timeout == 0)) + if (r) + break; + else if (timeout != NULL && *timeout == 0) { + int i; + /* Cancel the input. */ for (i = 0; i < t->inputline_len; i++) - { - tty_echo_char (t, 0x08); - tty_echo_char (t, 0x20); - tty_echo_char (t, 0x08); - } + tty_send (t, "\x08\x20\x08", 3); t->inputline_len = 0; break; }