summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-09-06 17:21:57 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-09-06 17:21:57 -0600
commit1a0b7737074845c124b36abc5260e10f6bf416ae (patch)
tree803c0b177470be16b9c0fa03748d5f43f0710b46
parent1797cce6b85bd6ad1e0ecd411c0ed99078fe75c3 (diff)
downloadpx4-nuttx-1a0b7737074845c124b36abc5260e10f6bf416ae.tar.gz
px4-nuttx-1a0b7737074845c124b36abc5260e10f6bf416ae.tar.bz2
px4-nuttx-1a0b7737074845c124b36abc5260e10f6bf416ae.zip
Suppress attempts to manage USB trace if the USB MSC example is built as an NSH built-in application. In that case, USB MSC does not do a good job managing trace data and gets in the way of other things that can do a better job (like NSH or the USB monitor).
-rw-r--r--apps/ChangeLog.txt4
-rw-r--r--apps/examples/usbmsc/Kconfig19
-rw-r--r--apps/examples/usbmsc/usbmsc_main.c8
3 files changed, 22 insertions, 9 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 7a4441591..41fa573e4 100644
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -628,4 +628,8 @@
* apps/examples/pwm: Clean-up some configuration confusion (2013-9-5).
* apps/netutils/dhcpd/dhcpd.c: Fix calculation of the next lease
address. SourceForge bug #21 from Paolo Messina (2013-9-6).
+ * apps/examples/usbmsc: Don't try to control USB trace if we are
+ an NSH built-in task. In that case our attempts are inadequate
+ and only interfere with with other logic that is attempting to
+ to do the same thing (in NSH or in the USB monitor) (2013-9-6).
diff --git a/apps/examples/usbmsc/Kconfig b/apps/examples/usbmsc/Kconfig
index 1681b181f..9940fe482 100644
--- a/apps/examples/usbmsc/Kconfig
+++ b/apps/examples/usbmsc/Kconfig
@@ -70,10 +70,20 @@ config EXAMPLES_USBMSC_DEBUGMM
---help---
Enables some debug tests to check for memory usage and memory leaks.
+config EXAMPLES_USBMSC_TRACE
+ bool "Trace USB activity"
+ default n
+ depends on (USBDEV_TRACE || DEBUG_USB) && !NSH_BUILTIN_APPS
+ ---help---
+ If this example is built as a standalone task and if USB device tracing is
+ enabled, then this example can be configured to unobtrusively monitor
+ USB activity by selecting this option.
+
+if EXAMPLES_USBMSC_TRACE
+
config EXAMPLES_USBMSC_TRACEINIT
bool "USB Trace Initialization"
default n
- depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
@@ -83,7 +93,6 @@ config EXAMPLES_USBMSC_TRACEINIT
config EXAMPLES_USBMSC_TRACECLASS
bool "USB Trace Class"
default n
- depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
@@ -93,7 +102,6 @@ config EXAMPLES_USBMSC_TRACECLASS
config EXAMPLES_USBMSC_TRACETRANSFERS
bool "USB Trace Transfers"
default n
- depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
@@ -103,7 +111,6 @@ config EXAMPLES_USBMSC_TRACETRANSFERS
config EXAMPLES_USBMSC_TRACECONTROLLER
bool "USB Trace Device Controller Events"
default n
- depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
@@ -113,12 +120,12 @@ config EXAMPLES_USBMSC_TRACECONTROLLER
config EXAMPLES_USBMSC_TRACEINTERRUPTS
bool "USB Trace Device Controller Interrupt Events"
default n
- depends on USBDEV_TRACE || DEBUG_USB
---help---
If USBDEV_TRACE is enabled (or DEBUG and DEBUG_USB),
then the example code will also manage the USB trace output. The
amount of trace output can be controlled this configuration value:
This setting will show USB device controller interrupt-related events.
-endif
+endif # EXAMPLES_USBMSC_TRACE
+endif # EXAMPLES_USBMSC
diff --git a/apps/examples/usbmsc/usbmsc_main.c b/apps/examples/usbmsc/usbmsc_main.c
index 4ff59f9da..95875c423 100644
--- a/apps/examples/usbmsc/usbmsc_main.c
+++ b/apps/examples/usbmsc/usbmsc_main.c
@@ -196,7 +196,7 @@ static void final_memory_usage(FAR const char *msg)
* Name: usbmsc_enumerate
****************************************************************************/
-#ifdef CONFIG_USBDEV_TRACE
+#ifdef CONFIG_EXAMPLES_USBMSC_TRACE
static int usbmsc_enumerate(struct usbtrace_s *trace, void *arg)
{
switch (trace->event)
@@ -423,8 +423,10 @@ int msconn_main(int argc, char *argv[])
/* Initialize USB trace output IDs */
+#ifdef CONFIG_EXAMPLES_USBMSC_TRACE
usbtrace_enable(TRACE_BITSET);
check_test_memory_usage("After usbtrace_enable()");
+#endif
/* Register block drivers (architecture-specific) */
@@ -513,9 +515,9 @@ int msconn_main(int argc, char *argv[])
msgflush();
sleep(5);
-# ifdef CONFIG_USBDEV_TRACE
+# ifdef CONFIG_EXAMPLES_USBMSC_TRACE
message("\nmsconn_main: USB TRACE DATA:\n");
- ret = usbtrace_enumerate(usbmsc_enumerate, NULL);
+ ret = usbtrace_enumerate(usbmsc_enumerate, NULL);
if (ret < 0)
{
message("msconn_main: usbtrace_enumerate failed: %d\n", -ret);