summaryrefslogtreecommitdiff
path: root/apps/nshlib/nsh_usbdev.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-29 17:42:58 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-29 17:42:58 +0000
commitc5e99745234775f3b1feeb283679a278a9417408 (patch)
tree81bc038356e0e42da3ae837e47097ed0d8ebd2f4 /apps/nshlib/nsh_usbdev.c
parentc54de384c21ce75736f48d6986117d6a560c0dcf (diff)
downloadnuttx-c5e99745234775f3b1feeb283679a278a9417408.tar.gz
nuttx-c5e99745234775f3b1feeb283679a278a9417408.tar.bz2
nuttx-c5e99745234775f3b1feeb283679a278a9417408.zip
The USB monitor now works with the stm32f4discover/nsh configuration (but not with the usbnsh configuration)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5580 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/nshlib/nsh_usbdev.c')
-rw-r--r--apps/nshlib/nsh_usbdev.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/apps/nshlib/nsh_usbdev.c b/apps/nshlib/nsh_usbdev.c
index d137e3dae..2064cbd84 100644
--- a/apps/nshlib/nsh_usbdev.c
+++ b/apps/nshlib/nsh_usbdev.c
@@ -61,9 +61,15 @@
/****************************************************************************
* Definitions
****************************************************************************/
-
-#if defined(CONFIG_DEBUG) || defined(CONFIG_NSH_USBCONSOLE)
-# define trmessage lowsyslog
+/* Output USB trace data to the console device using printf() unless (1)
+ * debug is enabled, then we want to keep the trace output in sync with the
+ * debug output by using syslog()we are using a USB console. In that case,
+ * we don't want the trace output on the USB console; let's try sending it
+ * a SYSLOG device (hopefully one is set up!)
+ */
+
+#if defined(CONFIG_DEBUG) || defined(HAVE_USB_CONSOLE)
+# define trmessage syslog
#else
# define trmessage printf
#endif
@@ -92,7 +98,7 @@
* Name: nsh_tracecallback
****************************************************************************/
-#ifdef CONFIG_USBDEV_TRACE
+#ifdef CONFIG_NSH_USBDEV_TRACE
static int nsh_tracecallback(struct usbtrace_s *trace, void *arg)
{
usbtrace_trprintf((trprintf_t)trmessage, trace->event, trace->value);
@@ -119,7 +125,7 @@ int nsh_usbconsole(void)
/* Initialize any USB tracing options that were requested */
-#ifdef CONFIG_USBDEV_TRACE
+#ifdef CONFIG_NSH_USBDEV_TRACE
usbtrace_enable(TRACE_BITSET);
#endif
@@ -133,9 +139,9 @@ int nsh_usbconsole(void)
#if defined(CONFIG_PL2303) || defined(CONFIG_CDCACM)
#ifdef CONFIG_CDCACM
- ret = cdcacm_initialize(CONFIG_NSH_UBSDEV_MINOR, NULL);
+ ret = cdcacm_initialize(CONFIG_NSH_USBDEV_MINOR, NULL);
#else
- ret = usbdev_serialinitialize(CONFIG_NSH_UBSDEV_MINOR);
+ ret = usbdev_serialinitialize(CONFIG_NSH_USBDEV_MINOR);
#endif
DEBUGASSERT(ret == OK);
#endif
@@ -224,6 +230,7 @@ int nsh_usbconsole(void)
(void)fdopen(0, "r");
(void)fdopen(1, "a");
(void)fdopen(2, "a");
+
return OK;
}
@@ -233,7 +240,7 @@ int nsh_usbconsole(void)
* Name: nsh_usbtrace
****************************************************************************/
-#if defined(CONFIG_USBDEV_TRACE) && defined(HAVE_USB_CONSOLE)
+#if defined(CONFIG_NSH_USBDEV_TRACE) && defined(HAVE_USB_CONSOLE)
void nsh_usbtrace(void)
{
(void)usbtrace_enumerate(nsh_tracecallback, NULL);