diff options
Diffstat (limited to 'example-fs-bb48/usb-cdc.c')
-rw-r--r-- | example-fs-bb48/usb-cdc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/example-fs-bb48/usb-cdc.c b/example-fs-bb48/usb-cdc.c index b412cf1..afbaff3 100644 --- a/example-fs-bb48/usb-cdc.c +++ b/example-fs-bb48/usb-cdc.c @@ -544,6 +544,7 @@ tty_input_char (struct tty *t, int c) switch (c) { case 0x0d: /* Control-M */ + t->inputline[t->inputline_len++] = '\n'; tty_echo_char (t, 0x0d); tty_echo_char (t, 0x0a); t->flag_input_avail = 1; @@ -577,7 +578,7 @@ tty_input_char (struct tty *t, int c) } break; default: - if (t->inputline_len < sizeof (t->inputline)) + if (t->inputline_len < sizeof (t->inputline) - 1) { tty_echo_char (t, c); t->inputline[t->inputline_len++] = c; @@ -784,6 +785,12 @@ check_rx (void *arg) return 0; } +/* + * Returns -1 on connection close + * 0 on timeout. + * >0 length of the inputline (including final \n) + * + */ int tty_recv (struct tty *t, uint8_t *buf, uint32_t *timeout) { |