CDC ACM fixes
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3981 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
bbeb6e59de
commit
f8a699a62d
|
@ -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
|
||||
|
|
|
@ -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.outbuffer, stdout);
|
||||
fputs(g_usbterm.inbuffer, stdout);
|
||||
|
||||
/* Display the prompt string on 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -4816,10 +4816,13 @@ build
|
|||
Default 4.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_CDCSER_VENDORID</code> and <code>CONFIG_CDCSER_VENDORSTR</code>: The vendor ID code/string. Default 0x03eb and "NuttX"
|
||||
<code>CONFIG_CDCSER_VENDORID</code> and <code>CONFIG_CDCSER_VENDORSTR</code>: The vendor ID code/string. Default 0x0525 and "NuttX,"
|
||||
0x0525 is the Netchip vendor and should not be used in any products.
|
||||
This default VID was selected for compatibility with the Linux CDC ACM default VID.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_CDCSER_PRODUCTID</code> and <code>CONFIG_CDCSER_PRODUCTSTR</code>: The product ID code/string. Default 0x204b and "CDC/ACM Serial"
|
||||
<code>CONFIG_CDCSER_PRODUCTID</code> and <code>CONFIG_CDCSER_PRODUCTSTR</code>: The product ID code/string. Default 0xa4a7 and "CDC/ACM Serial"
|
||||
0xa4a7 was selected for compatibility with the Linux CDC ACM default PID.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_CDCSER_RXBUFSIZE</code> and <code>CONFIG_CDCSER_TXBUFSIZE</code>: Size of the serial receive/transmit buffers. Default 256.
|
||||
|
|
|
@ -982,9 +982,14 @@ defconfig -- This is a configuration file similar to the Linux
|
|||
CONFIG_CDCSER_NWRREQS includes write requests used for both the
|
||||
interrupt and bulk IN endpoints. Default 4.
|
||||
CONFIG_CDCSER_VENDORID and CONFIG_CDCSER_VENDORSTR
|
||||
The vendor ID code/string. Default 0x03eb and "NuttX"
|
||||
The vendor ID code/string. Default 0x0525 and "NuttX"
|
||||
0x0525 is the Netchip vendor and should not be used in any
|
||||
products. This default VID was selected for compatibility with
|
||||
the Linux CDC ACM default VID.
|
||||
CONFIG_CDCSER_PRODUCTID and CONFIG_CDCSER_PRODUCTSTR
|
||||
The product ID code/string. Default 0x204b and "CDC/ACM Serial"
|
||||
The product ID code/string. Default 0xa4a7 and "CDC/ACM Serial"
|
||||
0xa4a7 was selected for compatibility with the Linux CDC ACM
|
||||
default PID.
|
||||
CONFIG_CDCSER_RXBUFSIZE and CONFIG_CDCSER_TXBUFSIZE
|
||||
Size of the serial receive/transmit buffers. Default 256.
|
||||
|
||||
|
|
|
@ -706,9 +706,14 @@ CONFIG_USBSER_TXBUFSIZE=512
|
|||
# The number of write/read requests that can be in flight.
|
||||
# Default 256.
|
||||
# CONFIG_CDCSER_VENDORID and CONFIG_CDCSER_VENDORSTR
|
||||
# The vendor ID code/string. Default 0x03eb and "NuttX"
|
||||
# The vendor ID code/string. Default 0x0525 and "NuttX"
|
||||
# 0x0525 is the Netchip vendor and should not be used in any
|
||||
# products. This default VID was selected for compatibility with
|
||||
# the Linux CDC ACM default VID.
|
||||
# CONFIG_CDCSER_PRODUCTID and CONFIG_CDCSER_PRODUCTSTR
|
||||
# The product ID code/string. Default 0x204b and "CDC/ACM Serial"
|
||||
# The product ID code/string. Default 0xara7 and "CDC/ACM Serial"
|
||||
# 0xa4a7 was selected for compatibility with the Linux CDC ACM
|
||||
# default PID.
|
||||
# CONFIG_CDCSER_RXBUFSIZE and CONFIG_CDCSER_TXBUFSIZE
|
||||
# Size of the serial receive/transmit buffers. Default 256.
|
||||
#
|
||||
|
|
|
@ -338,13 +338,16 @@ static const struct usb_devdesc_s g_devdesc =
|
|||
CDC_SUBCLASS_NONE, /* subclass */
|
||||
CDC_PROTO_NONE, /* protocol */
|
||||
CONFIG_CDCSER_EP0MAXPACKET, /* maxpacketsize */
|
||||
{ LSBYTE(CONFIG_CDCSER_VENDORID), /* vendor */
|
||||
{
|
||||
LSBYTE(CONFIG_CDCSER_VENDORID), /* vendor */
|
||||
MSBYTE(CONFIG_CDCSER_VENDORID)
|
||||
},
|
||||
{ LSBYTE(CONFIG_CDCSER_PRODUCTID), /* product */
|
||||
{
|
||||
LSBYTE(CONFIG_CDCSER_PRODUCTID), /* product */
|
||||
MSBYTE(CONFIG_CDCSER_PRODUCTID)
|
||||
},
|
||||
{ LSBYTE(CDCSER_VERSIONNO), /* device */
|
||||
{
|
||||
LSBYTE(CDCSER_VERSIONNO), /* device */
|
||||
MSBYTE(CDCSER_VERSIONNO)
|
||||
},
|
||||
CDCSER_MANUFACTURERSTRID, /* imfgr */
|
||||
|
@ -550,7 +553,10 @@ static const struct usb_qualdesc_s g_qualdesc =
|
|||
{
|
||||
USB_SIZEOF_QUALDESC, /* len */
|
||||
USB_DESC_TYPE_DEVICEQUALIFIER, /* type */
|
||||
{LSBYTE(0x0200), MSBYTE(0x0200) }, /* USB */
|
||||
{ /* usb */
|
||||
LSBYTE(0x0200),
|
||||
MSBYTE(0x0200)
|
||||
},
|
||||
USB_CLASS_VENDOR_SPEC, /* class */
|
||||
0, /* subclass */
|
||||
0, /* protocol */
|
||||
|
@ -733,6 +739,9 @@ static inline int usbclass_recvpacket(FAR struct usbser_dev_s *priv,
|
|||
uint16_t nexthead;
|
||||
uint16_t nbytes = 0;
|
||||
|
||||
uvdbg("head=%d tail=%d nrdq=%d reqlen=%d\n",
|
||||
priv->serdev.recv.head, priv->serdev.recv.tail, priv->nrdq, reqlen);
|
||||
|
||||
/* Get the next head index. During the time that RX interrupts are disabled, the
|
||||
* the serial driver will be extracting data from the circular buffer and modifying
|
||||
* recv.tail. During this time, we should avoid modifying recv.head; Instead we will
|
||||
|
|
|
@ -84,9 +84,14 @@
|
|||
* CONFIG_CDCSER_NWRREQS includes write requests used for both the
|
||||
* interrupt and bulk IN endpoints. Default 4.
|
||||
* CONFIG_CDCSER_VENDORID and CONFIG_CDCSER_VENDORSTR
|
||||
* The vendor ID code/string. Default 0x03eb and "NuttX"
|
||||
* The vendor ID code/string. Default 0x0525 and "NuttX"
|
||||
* 0x0525 is the Netchip vendor and should not be used in any
|
||||
* products. This default VID was selected for compatibility with
|
||||
* the Linux CDC ACM default VID.
|
||||
* CONFIG_CDCSER_PRODUCTID and CONFIG_CDCSER_PRODUCTSTR
|
||||
* The product ID code/string. Default 0x204b and "CDC/ACM Serial"
|
||||
* The product ID code/string. Default 0xa4a7 and "CDC/ACM Serial"
|
||||
* 0xa4a7 was selected for compatibility with the Linux CDC ACM
|
||||
* default PID.
|
||||
* CONFIG_CDCSER_RXBUFSIZE and CONFIG_CDCSER_TXBUFSIZE
|
||||
* Size of the serial receive/transmit buffers. Default 256.
|
||||
*/
|
||||
|
@ -171,14 +176,16 @@
|
|||
# define CONFIG_CDCSER_TXBUFSIZE 256
|
||||
#endif
|
||||
|
||||
/* Vendor and product IDs and strings */
|
||||
/* Vendor and product IDs and strings. The default is the Linux Netchip
|
||||
* CDC ACM VID and PID.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_CDCSER_VENDORID
|
||||
# define CONFIG_CDCSER_VENDORID 0x03eb
|
||||
# define CONFIG_CDCSER_VENDORID 0x0525
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_CDCSER_PRODUCTID
|
||||
# define CONFIG_CDCSER_PRODUCTID 0x204b
|
||||
# define CONFIG_CDCSER_PRODUCTID 0xa4a7
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_CDCSER_VENDORSTR
|
||||
|
@ -186,7 +193,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef CONFIG_CDCSER_PRODUCTSTR
|
||||
# define CONFIG_CDCSER_PRODUCTSTR "USBdev Serial"
|
||||
# define CONFIG_CDCSER_PRODUCTSTR "CDC ACM Serial"
|
||||
#endif
|
||||
|
||||
#undef CONFIG_CDCSER_SERIALSTR
|
||||
|
|
Loading…
Reference in New Issue