summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-27 17:05:24 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-09-27 17:05:24 +0000
commite12519aa64b4c4b4e6271f66368da57913540db1 (patch)
treef633b94ac4242bb63caef367632d8dacb495f89c /apps
parent93b4f58e8d5ea52729e37982e0fe743581ba22cd (diff)
downloadnuttx-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')
-rw-r--r--apps/examples/README.txt16
-rw-r--r--apps/examples/usbterm/usbterm_main.c16
2 files changed, 28 insertions, 4 deletions
diff --git a/apps/examples/README.txt b/apps/examples/README.txt
index 0327d6b61..ca58fbb27 100644
--- a/apps/examples/README.txt
+++ b/apps/examples/README.txt
@@ -975,6 +975,22 @@ examples/usbterm
the local target serial console are received and forwarded to the
remote host via USB serial.
+ Usage:
+ - Build the example and load into the target FLASH
+ - Connect on terminal to the target RS-232 connect and configure
+ for 115200 8N1. For example, suppose this Tera Term on a Windows
+ box.
+ - Power up the target board
+ - Connect the USB to a Linux box. Use the Linux dmesg command to
+ assure that the connect was successful. The USB CDC ACM device
+ should appear as /dev/ttyACM0
+ - On the Linux box, open minicom with tty=/dev/ttyACM0.
+ Configure minicom so that (1) local characters are echoed and (2)
+ so that no CR is required.
+ - Now what you type on the target Tera Term window should echo on
+ the Linux minicom window and, conversely, what you type on the
+ minicom winow should be echo in the target Tera Term window.
+
Configuration options:
CONFIG_EXAMPLES_UBSTERM_BUILTIN - Build the usbterm example as an NSH
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);
}