summaryrefslogtreecommitdiff
path: root/apps/nshlib/nsh_usbdev.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-25 22:10:40 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-25 22:10:40 +0000
commit7678a8287c4a198ba6811f45b9bba934b2a5716b (patch)
treefa1aaf27248cfc57d4bc9c9f1f066b98e93d0191 /apps/nshlib/nsh_usbdev.c
parent385b0fd6504ea1cb35b52cb425b5c37a62afa91d (diff)
downloadnuttx-7678a8287c4a198ba6811f45b9bba934b2a5716b.tar.gz
nuttx-7678a8287c4a198ba6811f45b9bba934b2a5716b.tar.bz2
nuttx-7678a8287c4a198ba6811f45b9bba934b2a5716b.zip
Fix packet size calculation in CDC/ACM and PL2303 USB serial drivers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4771 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/nshlib/nsh_usbdev.c')
-rw-r--r--apps/nshlib/nsh_usbdev.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/nshlib/nsh_usbdev.c b/apps/nshlib/nsh_usbdev.c
index a784c6b77..2b31a1a14 100644
--- a/apps/nshlib/nsh_usbdev.c
+++ b/apps/nshlib/nsh_usbdev.c
@@ -95,6 +95,10 @@ int nsh_usbconsole(void)
int fd;
int ret;
+ /* Initialize any USB tracing options that were requested */
+
+ usbtrace_enable(CONFIG_NSH_UBSDEV_TRACEINIT);
+
/* Don't start the NSH console until the console device is ready. Chances
* are, we get here with no functional console. The USB console will not
* be available until the device is connected to the host and until the
@@ -103,12 +107,14 @@ int nsh_usbconsole(void)
/* Initialize the USB serial driver */
+#if defined(CONFIG_PL2303) || defined(CONFIG_CDCACM)
#ifdef CONFIG_CDCACM
- ret = cdcacm_initialize(0, NULL);
+ ret = cdcacm_initialize(CONFIG_NSH_UBSDEV_MINOR, NULL);
#else
- ret = usbdev_serialinitialize(0);
+ ret = usbdev_serialinitialize(CONFIG_NSH_UBSDEV_MINOR);
#endif
DEBUGASSERT(ret == OK);
+#endif
/* Make sure the stdin, stdout, and stderr are closed */
@@ -122,14 +128,16 @@ int nsh_usbconsole(void)
{
/* Try to open the console */
- fd = open("/dev/console", O_RDWR);
+ fd = open(CONFIG_NSH_USBCONDEV, O_RDWR);
if (fd < 0)
{
+ int errval = errno;
+
/* ENOTCONN means that the USB device is not yet connected. Anything
* else is bad.
*/
- DEBUGASSERT(errno == ENOTCONN);
+ DEBUGASSERT(errval == ENOTCONN);
/* Sleep a bit and try again */