CDC ACM fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3981 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
0a21d7a717
commit
2947cdb45e
@ -975,6 +975,22 @@ examples/usbterm
|
|||||||
the local target serial console are received and forwarded to the
|
the local target serial console are received and forwarded to the
|
||||||
remote host via USB serial.
|
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:
|
Configuration options:
|
||||||
|
|
||||||
CONFIG_EXAMPLES_UBSTERM_BUILTIN - Build the usbterm example as an NSH
|
CONFIG_EXAMPLES_UBSTERM_BUILTIN - Build the usbterm example as an NSH
|
||||||
|
@ -134,9 +134,13 @@ FAR void *usbterm_listener(FAR void *parameter)
|
|||||||
|
|
||||||
if (fgets(g_usbterm.inbuffer, CONFIG_EXAMPLES_USBTERM_BUFLEN, g_usbterm.instream))
|
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.outbuffer, stdout);
|
fputs(g_usbterm.inbuffer, stdout);
|
||||||
|
|
||||||
|
/* Display the prompt string on stdout */
|
||||||
|
|
||||||
|
fputs("usbterm> ", stdout);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,14 +239,14 @@ int MAIN_NAME(int argc, char *argv[])
|
|||||||
|
|
||||||
dumptrace();
|
dumptrace();
|
||||||
}
|
}
|
||||||
while (g_usbterm.outstream < 0);
|
while (g_usbterm.outstream == NULL);
|
||||||
|
|
||||||
/* Open the USB serial device for reading. Since we are already connected, this
|
/* Open the USB serial device for reading. Since we are already connected, this
|
||||||
* should not fail.
|
* should not fail.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_usbterm.instream = fopen("/dev/ttyUSB0", "r");
|
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);
|
message(MAIN_STRING "ERROR: Failed to open /dev/ttyUSB0 for reading: %d\n", errno);
|
||||||
goto errout_with_outstream;
|
goto errout_with_outstream;
|
||||||
@ -286,6 +290,10 @@ int MAIN_NAME(int argc, char *argv[])
|
|||||||
/* Send the line of input via USB */
|
/* Send the line of input via USB */
|
||||||
|
|
||||||
fputs(g_usbterm.outbuffer, g_usbterm.outstream);
|
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);
|
fflush(g_usbterm.outstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user