From e12519aa64b4c4b4e6271f66368da57913540db1 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 27 Sep 2011 17:05:24 +0000 Subject: CDC ACM fixes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3981 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/usbterm/usbterm_main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'apps/examples/usbterm') diff --git a/apps/examples/usbterm/usbterm_main.c b/apps/examples/usbterm/usbterm_main.c index 3cac73c5c..00161d0d2 100644 --- a/apps/examples/usbterm/usbterm_main.c +++ b/apps/examples/usbterm/usbterm_main.c @@ -134,9 +134,13 @@ FAR void *usbterm_listener(FAR void *parameter) if (fgets(g_usbterm.inbuffer, CONFIG_EXAMPLES_USBTERM_BUFLEN, g_usbterm.instream)) { - /* Send the line of input via USB */ + /* Echo the line on the local stdout */ + + fputs(g_usbterm.inbuffer, stdout); + + /* Display the prompt string on stdout */ - fputs(g_usbterm.outbuffer, stdout); + fputs("usbterm> ", stdout); fflush(stdout); } @@ -235,14 +239,14 @@ int MAIN_NAME(int argc, char *argv[]) dumptrace(); } - while (g_usbterm.outstream < 0); + while (g_usbterm.outstream == NULL); /* Open the USB serial device for reading. Since we are already connected, this * should not fail. */ g_usbterm.instream = fopen("/dev/ttyUSB0", "r"); - if (g_usbterm.instream < 0) + if (g_usbterm.instream == NULL) { message(MAIN_STRING "ERROR: Failed to open /dev/ttyUSB0 for reading: %d\n", errno); goto errout_with_outstream; @@ -286,6 +290,10 @@ int MAIN_NAME(int argc, char *argv[]) /* Send the line of input via USB */ fputs(g_usbterm.outbuffer, g_usbterm.outstream); + + /* Display the prompt string on the remote USB serial connection */ + + fputs("usbterm> ", g_usbterm.outstream); fflush(g_usbterm.outstream); } -- cgit v1.2.3