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).

This commit is contained in:
Gregory Nutt 2013-09-06 17:21:57 -06:00
parent cf8d662122
commit af051009ba
3 changed files with 22 additions and 9 deletions

View File

@ -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).

View File

@ -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

View File

@ -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);