diff options
| author | Keith Packard <keithp@keithp.com> | 2009-11-04 21:42:51 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2009-11-04 21:42:51 -0800 | 
| commit | 036400a2db303f3db3be7cc0426f88359c6bd2b1 (patch) | |
| tree | ea31afcdca2dd039638f6d416b62a4022aabaf0c | |
| parent | 3ece984f4d72b4f720a5efdfaad7cff77a93d676 (diff) | |
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 <keithp@keithp.com>
| -rw-r--r-- | src/ao_packet_master.c | 6 | 
1 files 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);  	}  | 
