USB monitor daemon updates

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5579 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-01-29 13:30:10 +00:00
parent 45dc56b0af
commit 61c3dd3ee9
3 changed files with 81 additions and 8 deletions

View File

@ -1258,7 +1258,36 @@ Where <subdir> is one of the following:
times before NSH starts. The logic does this to prevent sending USB data
before there is anything on the host side listening for USB serial input.
9. USB OTG FS Host Support. The following changes will enable support for
9. Here is an alternative USB console configuration. The following
configuration will also create a NSH USB console but this version
will use /dev/console. Instead, it will use the normal /dev/ttyACM0
USB serial device for the console:
CONFIG_STM32_OTGFS=y : STM32 OTG FS support
CONFIG_USART2_SERIAL_CONSOLE=y : Keep the USART2 console
CONFIG_DEV_CONSOLE=y : /dev/console exists (but NSH won't use it)
CONFIG_USBDEV=y : USB device support must be enabled
CONFIG_CDCACM=y : The CDC/ACM driver must be built
CONFIG_CDCACM_CONSOLE=n : Don't use the CDC/ACM USB console.
CONFIG_NSH_USBCONSOLE=y : Instead use some other USB device for the console
The particular USB device that is used is:
CONFIG_NSH_USBCONDEV="/dev/ttyACM0"
The advantage of this configuration is only that it is easier to
bet working. This alternative does has some side effects:
- When any other device other than /dev/console is used for a user
interface, linefeeds (\n) will not be expanded to carriage return /
linefeeds (\r\n). You will need to set your terminal program to account
for this.
- /dev/console still exists and still refers to the serial port. So
you can still use certain kinds of debug output (see include/debug.h, all
of the interfaces based on lowsyslog will work in this configuration).
10. USB OTG FS Host Support. The following changes will enable support for
a USB host on the STM32F4Discovery, including support for a mass storage
class driver:
@ -1497,10 +1526,29 @@ Where <subdir> is one of the following:
CONFIG_SYSLOG_CHAR=y : Use a character device for system logging
CONFIG_SYSLOG_DEVPATH="/dev/ttyS0" : UART2 will be /dev/ttyS0
Debug, however, is not enable so in the default configuration nothing
should appear on UART2 unless you enable some debug output.
However, there is nothing to generate SYLOG output in the default
configuration so nothing should appear on UART2 unless you enable
some debug output or enable the USB monitor.
4. By default, this project assumes that you are *NOT* using the DFU
4. Enabling USB monitor SYSLOG output. If tracing is enabled, the USB
device will save encoded trace output in in-memory buffer; if the
USB monitor is enabled, that trace buffer will be periodically
emptied and dumped to the system loggin device (UART2 in this
configuraion):
CONFIG_USBDEV_TRACE=y : Enable USB trace feature
CONFIG_USBDEV_TRACE_NRECORDS=128 : Buffer 128 records in memory
CONFIG_SYSTEM_USBMONITOR=y : Start the USB monitor daemon
CONFIG_SYSTEM_USBMONITOR_STACKSIZE=2048 : USB monitor daemon stack size
CONFIG_SYSTEM_USBMONITOR_PRIORITY=50 : USB monitor daemon priority
CONFIG_NSH_USBDEV_TRACEINIT=y : Enable TRACE output
CONFIG_NSH_USBDEV_TRACECLASS=y
CONFIG_NSH_USBDEV_TRACETRANSFERS=y
CONFIG_NSH_USBDEV_TRACECONTROLLER=y
CONFIG_NSH_USBDEV_TRACEINTERRUPTS=y
5. By default, this project assumes that you are *NOT* using the DFU
bootloader.
Using the Prolifics PL2303 Emulation

View File

@ -50,6 +50,10 @@
# include <nuttx/mmcsd.h>
#endif
#ifdef CONFIG_SYSTEM_USBMONITOR
# include <apps/usbmonitor.h>
#endif
#ifdef CONFIG_STM32_OTGFS
# include "stm32_usbhost.h"
#endif
@ -63,20 +67,23 @@
/* Configuration ************************************************************/
#define HAVE_USBDEV 1
#define HAVE_USBHOST 1
#define HAVE_USBDEV 1
#define HAVE_USBHOST 1
#define HAVE_USBMONITOR 1
/* Can't support USB host or device features if USB OTG FS is not enabled */
#ifndef CONFIG_STM32_OTGFS
# undef HAVE_USBDEV
# undef HAVE_USBHOST
# undef HAVE_USBMONITOR
#endif
/* Can't support USB device is USB device is not enabled */
#ifndef CONFIG_USBDEV
# undef HAVE_USBDEV
# undef HAVE_USBMONITOR
#endif
/* Can't support USB host is USB host is not enabled */
@ -85,6 +92,12 @@
# undef HAVE_USBHOST
#endif
/* Check if we should enable the USB monitor before starting NSH */
#if !defined(CONFIG_USBDEV_TRACE) || !defined(CONFIG_SYSTEM_USBMONITOR)
# undef HAVE_USBMONITOR
#endif
/* Debug ********************************************************************/
#ifdef CONFIG_CPP_HAVE_VARARGS
@ -115,9 +128,11 @@
int nsh_archinitialize(void)
{
#ifdef HAVE_USBHOST
#if defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR)
int ret;
#endif
#ifdef HAVE_USBHOST
/* Initialize USB host operation. stm32_usbhost_initialize() starts a thread
* will monitor for USB connection and disconnection events.
*/
@ -130,5 +145,15 @@ int nsh_archinitialize(void)
}
#endif
#ifdef HAVE_USBMONITOR
/* Start the USB Monitor */
ret = usbmonitor_start(0, NULL);
if (ret != OK)
{
message("nsh_archinitialize: Start USB monitor: %d\n", ret);
}
#endif
return OK;
}

View File

@ -422,7 +422,7 @@ CONFIG_CDCACM_TXBUFSIZE=256
CONFIG_CDCACM_VENDORID=0x0525
CONFIG_CDCACM_PRODUCTID=0xa4a7
CONFIG_CDCACM_VENDORSTR="NuttX"
CONFIG_CDCACM_PRODUCTSTR="USBdev Serial"
CONFIG_CDCACM_PRODUCTSTR="CDC/ACM Serial"
# CONFIG_USBMSC is not set
# CONFIG_USBHOST is not set
# CONFIG_WIRELESS is not set