From 036400a2db303f3db3be7cc0426f88359c6bd2b1 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 4 Nov 2009 21:42:51 -0800 Subject: [PATCH] Explicitly use USB I/O routines in packet code Using the implicit stdio functions (putchar/getchar/flush) would result in essentially random redirection of each, depending on whether the packet code had characters available when getchar was called. This would cause lockups in putchar. Signed-off-by: Keith Packard --- src/ao_packet_master.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ao_packet_master.c b/src/ao_packet_master.c index d03899d1..f3a024ca 100644 --- a/src/ao_packet_master.c +++ b/src/ao_packet_master.c @@ -27,7 +27,7 @@ ao_packet_getchar(void) break; if (ao_packet_master_sleeping) ao_wake_task(&ao_packet_task); - flush(); + ao_usb_flush(); ao_sleep(&ao_stdin_ready); } return c; @@ -40,7 +40,7 @@ ao_packet_echo(void) __reentrant while (ao_packet_enable) { c = ao_packet_getchar(); if (ao_packet_enable) - putchar(c); + ao_usb_putchar(c); } ao_exit(); } @@ -114,7 +114,7 @@ ao_packet_forward(void) __reentrant ao_set_monitor(0); ao_add_task(&ao_packet_task, ao_packet_master, "master"); ao_add_task(&ao_packet_echo_task, ao_packet_echo, "echo"); - while ((c = getchar()) != '~') { + while ((c = ao_usb_getchar()) != '~') { if (c == '\r') c = '\n'; ao_packet_putchar(c); } -- 2.30.2