diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-09-27 17:05:24 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-09-27 17:05:24 +0000 |
commit | e12519aa64b4c4b4e6271f66368da57913540db1 (patch) | |
tree | f633b94ac4242bb63caef367632d8dacb495f89c /apps/examples/usbterm | |
parent | 93b4f58e8d5ea52729e37982e0fe743581ba22cd (diff) | |
download | nuttx-e12519aa64b4c4b4e6271f66368da57913540db1.tar.gz nuttx-e12519aa64b4c4b4e6271f66368da57913540db1.tar.bz2 nuttx-e12519aa64b4c4b4e6271f66368da57913540db1.zip |
CDC ACM fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3981 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/usbterm')
-rw-r--r-- | apps/examples/usbterm/usbterm_main.c | 16 |
1 files changed, 12 insertions, 4 deletions
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); } |