diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-29 13:30:10 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-29 13:30:10 +0000 |
commit | 2946cb47a8d70406a85c37f2d210e539c240a22b (patch) | |
tree | dae0ab1a333a6c5a5beec4ae170141804fb57c22 | |
parent | 79ccfa4ae6db4b085703b12c8f6846716fc69df7 (diff) | |
download | px4-firmware-2946cb47a8d70406a85c37f2d210e539c240a22b.tar.gz px4-firmware-2946cb47a8d70406a85c37f2d210e539c240a22b.tar.bz2 px4-firmware-2946cb47a8d70406a85c37f2d210e539c240a22b.zip |
USB monitor daemon updates
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5579 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | apps/system/usbmonitor/Makefile | 11 | ||||
-rw-r--r-- | apps/system/usbmonitor/usbmonitor.c | 10 | ||||
-rw-r--r-- | nuttx/Kconfig | 56 | ||||
-rw-r--r-- | nuttx/configs/stm32f4discovery/README.txt | 58 | ||||
-rw-r--r-- | nuttx/configs/stm32f4discovery/src/up_nsh.c | 31 | ||||
-rw-r--r-- | nuttx/configs/stm32f4discovery/usbnsh/defconfig | 2 | ||||
-rw-r--r-- | nuttx/drivers/usbdev/Kconfig | 10 | ||||
-rw-r--r-- | nuttx/fs/Kconfig | 15 | ||||
-rw-r--r-- | nuttx/graphics/nxfonts/nxfonts_getfont.c | 2 |
9 files changed, 139 insertions, 56 deletions
diff --git a/apps/system/usbmonitor/Makefile b/apps/system/usbmonitor/Makefile index b4c323eb7..56b6ccee1 100644 --- a/apps/system/usbmonitor/Makefile +++ b/apps/system/usbmonitor/Makefile @@ -41,8 +41,7 @@ ifeq ($(WINTOOL),y) INCDIROPT = -w endif -# Hello Application -# TODO: appname can be automatically extracted from the directory name +# USB Monitor Application PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 768 @@ -88,11 +87,13 @@ $(COBJS): %$(OBJEXT): %.c # Register application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile +$(BUILTIN_REGISTRY)$(DELIM)usbmonitor_start.bdat: $(DEPCONFIG) Makefile $(call REGISTER,"usbmon_start",$(PRIORITY),$(STACKSIZE),usbmonitor_start) - $(call REGISTER,"usbmon_stop",$(PRIORITY),$(STACKSIZE),usbmonintor_stop) -context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +$(BUILTIN_REGISTRY)$(DELIM)usbmonitor_stop.bdat: $(DEPCONFIG) Makefile + $(call REGISTER,"usbmon_stop",$(PRIORITY),$(STACKSIZE),usbmonitor_stop) + +context: $(BUILTIN_REGISTRY)$(DELIM)usbmonitor_start.bdat $(BUILTIN_REGISTRY)$(DELIM)usbmonitor_stop.bdat else context: endif diff --git a/apps/system/usbmonitor/usbmonitor.c b/apps/system/usbmonitor/usbmonitor.c index b615b99f9..b386c3c2e 100644 --- a/apps/system/usbmonitor/usbmonitor.c +++ b/apps/system/usbmonitor/usbmonitor.c @@ -42,9 +42,12 @@ #include <sys/types.h> #include <stdbool.h> -#include <debug.h> +#include <unistd.h> +#include <sched.h> +#include <syslog.h> +#include <errno.h> -#include <nuttx/usb/usbdev_trace.h" +#include <nuttx/usb/usbdev_trace.h> #ifdef CONFIG_SYSTEM_USBMONITOR @@ -89,7 +92,8 @@ static int usbmonitor_daemon(int argc, char **argv) while (!g_usbmonitor.stop) { - (void)usbmonitor_enumerate(nsh_tracecallback, NULL); + sleep(2); + (void)usbtrace_enumerate(usbmonitor_tracecallback, NULL); } /* Stopped */ diff --git a/nuttx/Kconfig b/nuttx/Kconfig index 937bab2be..af743b9db 100644 --- a/nuttx/Kconfig +++ b/nuttx/Kconfig @@ -297,27 +297,21 @@ config DEBUG ---help--- Enables built-in debug features. Selecting this option will (1) Enable debug assertions in the code, (2) enable extended parameter testing in - many functions, and (3) enable support for debug output. Note that enabling - this option by itself does not produce debug output. Debug output must - also be selected on a subsystem-by-subsystem basis. + many functions, and (3) enable support for debug output to the SYSLOG. + Note that enabling this option by itself does not produce debug output. + Debug output must also be selected on a subsystem-by-subsystem basis. if DEBUG config DEBUG_VERBOSE bool "Enable Debug Verbose Output" default n ---help--- - Enables verbose debug output (assuming debug output is enabled). As a - general rule, when DEBUG is enabled only errors will be reported in the debug - output. But if you also enable DEBUG_VERBOSE, then very chatty (and - often annoying) output will be generated. This means there are two levels - of debug output: errors-only and everything. - -config SYSLOG_ENABLE - bool "Enable Debug Controls" - default n - ---help--- - Support an interface called syslog_enable to dynamically enable or - disable debug output. + Enables verbose debug output (assuming debug featurses are enabled). + As a general rule, when DEBUG is enabled only errors will be + reported in the debug SYSLOG output. But if you also enable + DEBUG_VERBOSE, then very chatty (and often annoying) output will be + generated. This means there are two levels of debug output: + errors-only and everything. comment "Subsystem Debug Options" @@ -325,58 +319,58 @@ config DEBUG_MM bool "Enable Memory Manager Debug Output" default n ---help--- - Enable memory management debug output (disabled by default) + Enable memory management debug SYSLOG output (disabled by default) config DEBUG_SCHED bool "Enable Scheduler Debug Output" default n ---help--- - Enable OS debug output (disabled by default) + Enable OS debug SYSLOG output (disabled by default) config DEBUG_PAGING bool "Enable Demand Paging Debug Output" default n depends on PAGING ---help--- - Enable demand paging debug output (disabled by default) + Enable demand paging debug SYSLOG output (disabled by default) config DEBUG_NET bool "Enable Network Debug Output" default n depends on NET ---help--- - Enable network debug output (disabled by default) + Enable network debug SYSLOG output (disabled by default) config DEBUG_USB bool "Enable USB Debug Output" default n depends on USBDEV || USBHOST ---help--- - Enable usb debug output (disabled by default) + Enable usb debug SYSLOG output (disabled by default) config DEBUG_FS bool "Enable File System Debug Output" default n ---help--- - Enable file system debug output (disabled by default) + Enable file system debug SYSLOG output (disabled by default) config DEBUG_LIB bool "Enable C Library Debug Output" default n ---help--- - Enable C library debug output (disabled by default) + Enable C library debug SYSLOG output (disabled by default) config DEBUG_BINFMT bool "Enable Binary Loader Debug Output" default n ---help--- - Enable binary loader debug output (disabled by default) + Enable binary loader debug SYSLOG output (disabled by default) config DEBUG_GRAPHICS bool "Enable Graphics Debug Output" default n ---help--- - Enable NX graphics debug output (disabled by default) + Enable NX graphics debug SYSLOG output (disabled by default) comment "Driver Debug Options" @@ -385,21 +379,21 @@ config DEBUG_LCD default n depends on LCD ---help--- - Enable low level debug output from the LCD driver (disabled by default) + Enable low level debug SYSLOG output from the LCD driver (disabled by default) config DEBUG_INPUT bool "Enable Input Device Debug Output" default n depends on INPUT ---help--- - Enable low level debug output from the input device drivers such as + Enable low level debug SYSLOG output from the input device drivers such as mice and touchscreens (disabled by default) config DEBUG_ANALOG bool "Enable Analog Device Debug Output" default n ---help--- - Enable low level debug output from the analog device drivers such as + Enable low level debug SYSLOG output from the analog device drivers such as A/D and D/A converters (disabled by default) config DEBUG_I2C @@ -407,27 +401,27 @@ config DEBUG_I2C default n depends on I2C ---help--- - Enable I2C driver debug output (disabled by default) + Enable I2C driver debug SYSLOG output (disabled by default) config DEBUG_SPI bool "Enable SPI Debug Output" default n depends on SPI ---help--- - Enable I2C driver debug output (disabled by default) + Enable I2C driver debug SYSLOG output (disabled by default) config DEBUG_DMA bool "Enable DMA Debug Output" default n ---help--- - Enable DMA-releated debug output (disabled by default) + Enable DMA-releated debug SYSLOG output (disabled by default) config DEBUG_WATCHDOG bool "Enable Watchdog Timer Debug Output" default n depends on WATCHDOG ---help--- - Enable watchdog timer debug output (disabled by default) + Enable watchdog timer debug SYSLOG output (disabled by default) endif diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt index 378509be8..41207fafa 100644 --- a/nuttx/configs/stm32f4discovery/README.txt +++ b/nuttx/configs/stm32f4discovery/README.txt @@ -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. - - 4. By default, this project assumes that you are *NOT* using the DFU + 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. 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 diff --git a/nuttx/configs/stm32f4discovery/src/up_nsh.c b/nuttx/configs/stm32f4discovery/src/up_nsh.c index fd3fe5cd9..565aac724 100644 --- a/nuttx/configs/stm32f4discovery/src/up_nsh.c +++ b/nuttx/configs/stm32f4discovery/src/up_nsh.c @@ -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; } diff --git a/nuttx/configs/stm32f4discovery/usbnsh/defconfig b/nuttx/configs/stm32f4discovery/usbnsh/defconfig index 534445f01..ba704001a 100644 --- a/nuttx/configs/stm32f4discovery/usbnsh/defconfig +++ b/nuttx/configs/stm32f4discovery/usbnsh/defconfig @@ -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 diff --git a/nuttx/drivers/usbdev/Kconfig b/nuttx/drivers/usbdev/Kconfig index 5ab6bb8fa..e17b38022 100644 --- a/nuttx/drivers/usbdev/Kconfig +++ b/nuttx/drivers/usbdev/Kconfig @@ -148,7 +148,7 @@ config COMPOSITE_VERSIONNO endif menuconfig PL2303 - bool "Emulates the Prolific PL2303 serial/USB converter" + bool "Prolific PL2303 serial/USB converter emulation" default n ---help--- This logic emulates the Prolific PL2303 serial/USB converter @@ -216,7 +216,7 @@ config PL2303_VENDORSTR config PL2303_PRODUCTSTR string "Product string" - default "USBdev Serial" + default "PL2303 Emulation" endif menuconfig CDCACM @@ -380,7 +380,7 @@ config CDCACM_VENDORSTR config CDCACM_PRODUCTSTR string "Product string" - default "USBdev Serial" + default "CDC/ACM Serial" endif menuconfig USBMSC @@ -495,8 +495,8 @@ config USBMSC_PRODUCTID default 0x00 config USBMSC_PRODUCTSTR - string "Mass stroage product string" - default "Mass stroage" + string "Mass storage product string" + default "Mass Storage" config USBMSC_VERSIONNO hex "USB MSC Version Number" diff --git a/nuttx/fs/Kconfig b/nuttx/fs/Kconfig index e6647f516..6aac7a3f7 100644 --- a/nuttx/fs/Kconfig +++ b/nuttx/fs/Kconfig @@ -18,11 +18,22 @@ source fs/binfs/Kconfig comment "System Logging" +config SYSLOG_ENABLE + bool "Enable SYSLOG Controls" + default n + ---help--- + Support an interface called syslog_enable to dynamically enable or + disable SYSLOG output. Default: SYSLOG output is always enabled. + config SYSLOG - bool "System logging" + bool "Advanced SYSLOG features" default n ---help--- - Enables generic system logging features. + Enables generic system logging features. NOTE: This setting is not + required to enable system logging. If this feature is not enable + system logging will still be available and will log to the system + console (like printf()). This setting is required to enable + customization of the basic system loggin capability. if SYSLOG diff --git a/nuttx/graphics/nxfonts/nxfonts_getfont.c b/nuttx/graphics/nxfonts/nxfonts_getfont.c index c2af977f2..0eb48e9df 100644 --- a/nuttx/graphics/nxfonts/nxfonts_getfont.c +++ b/nuttx/graphics/nxfonts/nxfonts_getfont.c @@ -242,7 +242,7 @@ static FAR const struct nx_fontpackage_s *g_fontpackages[] = * Name: nxf_getglyphset * * Description: - * Return information about the font set containtined he selected + * Return information about the font set contained in the selected * character encoding. * * Input Parameters: |