Add syslog.h; rename lib_rawprintf() to syslog()

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5578 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-01-28 21:55:16 +00:00
parent 433dae7422
commit 79ccfa4ae6
180 changed files with 677 additions and 520 deletions
@@ -75,11 +75,11 @@
# define CONFIG_CBUTTONARRAYTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -69,11 +69,11 @@
# define CONFIG_CCHECKBOXTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -76,11 +76,11 @@
# define CONFIG_CGLYPHBUTTONTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
+2 -2
View File
@@ -71,11 +71,11 @@
# define CONFIG_CIMAGETEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
+2 -2
View File
@@ -72,11 +72,11 @@
# define CONFIG_CKEYPADTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -75,11 +75,11 @@
# define CONFIG_CLATCHBUTTONARRAYTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -69,11 +69,11 @@
# define CONFIG_CLISTBOXTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -69,11 +69,11 @@
# define CONFIG_CPROGRESSBARTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -70,11 +70,11 @@
# define CONFIG_CRADIOBUTTONTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -69,11 +69,11 @@
# define CONFIG_CSCROLLBARHORIZONTALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -69,11 +69,11 @@
# define CONFIG_CSCROLLBARVERTICALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -69,11 +69,11 @@
# define CONFIG_CSLIDERHORIZONTALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
@@ -69,11 +69,11 @@
# define CONFIG_CSLIDERVERTICALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
#endif
// If debug is enabled, use the debug function, lib_rawprintf() instead
// If debug is enabled, use the debug function, syslog() instead
// of printf() so that the output is synchronized.
#ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
#else
# define message printf
#endif
+2 -2
View File
@@ -74,7 +74,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_rawprintf(__VA_ARGS__)
# define message(...) syslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -82,7 +82,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_rawprintf
# define message syslog
# define msgflush()
# else
# define message printf
+14 -14
View File
@@ -299,11 +299,11 @@ static void show_buttons(uint8_t oldset, uint8_t newset)
state = "released";
}
/* Use lib_lowprintf() because we make be executing from an
/* Use lowsyslog() because we make be executing from an
* interrupt handler.
*/
lib_lowprintf(" %s %s\n", g_buttoninfo[BUTTON_INDEX(i)].name, state);
lowsyslog(" %s %s\n", g_buttoninfo[BUTTON_INDEX(i)].name, state);
}
}
}
@@ -313,8 +313,8 @@ static void button_handler(int id, int irq)
{
uint8_t newset = up_buttons();
lib_lowprintf("IRQ:%d Button %d:%s SET:%02x:\n",
irq, id, g_buttoninfo[BUTTON_INDEX(id)].name, newset);
lowsyslog("IRQ:%d Button %d:%s SET:%02x:\n",
irq, id, g_buttoninfo[BUTTON_INDEX(id)].name, newset);
show_buttons(g_oldset, newset);
g_oldset = newset;
}
@@ -409,7 +409,7 @@ int buttons_main(int argc, char *argv[])
{
maxbuttons = strtol(argv[1], NULL, 10);
}
lib_lowprintf("maxbuttons: %d\n", maxbuttons);
lowsyslog("maxbuttons: %d\n", maxbuttons);
#endif
/* Initialize the button GPIOs */
@@ -423,11 +423,11 @@ int buttons_main(int argc, char *argv[])
{
xcpt_t oldhandler = up_irqbutton(i, g_buttoninfo[BUTTON_INDEX(i)].handler);
/* Use lib_lowprintf() for compatibility with interrrupt handler output. */
/* Use lowsyslog() for compatibility with interrrupt handler output. */
lib_lowprintf("Attached handler at %p to button %d [%s], oldhandler:%p\n",
g_buttoninfo[BUTTON_INDEX(i)].handler, i,
g_buttoninfo[BUTTON_INDEX(i)].name, oldhandler);
lowsyslog("Attached handler at %p to button %d [%s], oldhandler:%p\n",
g_buttoninfo[BUTTON_INDEX(i)].handler, i,
g_buttoninfo[BUTTON_INDEX(i)].name, oldhandler);
/* Some hardware multiplexes different GPIO button sources to the same
* physical interrupt. If we register multiple such multiplexed button
@@ -438,9 +438,9 @@ int buttons_main(int argc, char *argv[])
if (oldhandler != NULL)
{
lib_lowprintf("WARNING: oldhandler:%p is not NULL! "
"Button events may be lost or aliased!\n",
oldhandler);
lowsyslog("WARNING: oldhandler:%p is not NULL! "
"Button events may be lost or aliased!\n",
oldhandler);
}
}
#endif
@@ -468,11 +468,11 @@ int buttons_main(int argc, char *argv[])
flags = irqsave();
/* Use lib_lowprintf() for compatibility with interrrupt handler
/* Use lowsyslog() for compatibility with interrrupt handler
* output.
*/
lib_lowprintf("POLL SET:%02x:\n", newset);
lowsyslog("POLL SET:%02x:\n", newset);
show_buttons(g_oldset, newset);
g_oldset = newset;
irqrestore(flags);
+2 -2
View File
@@ -89,7 +89,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_rawprintf(__VA_ARGS__)
# define message(...) syslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -97,7 +97,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_rawprintf
# define message syslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -112,7 +112,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -120,7 +120,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -173,7 +173,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -181,7 +181,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+3 -3
View File
@@ -46,12 +46,12 @@
* Definitions
****************************************************************************/
/* Used lib_rawprintf() so that there is no confusion from buffered IO */
/* Used syslog() so that there is no confusion from buffered IO */
#ifdef CONFIG_CPP_HAVE_VARARGS
# define message(...) lib_rawprintf(__VA_ARGS__)
# define message(...) syslog(__VA_ARGS__)
#else
# define message lib_rawprintf
# define message syslog
#endif
/****************************************************************************
+3 -3
View File
@@ -69,12 +69,12 @@
#else
/* Used lib_rawprintf() so that there is not confusion from buffered IO */
/* Used syslog() so that there is not confusion from buffered IO */
# ifdef CONFIG_CPP_HAVE_VARARGS
# define message(...) lib_rawprintf(__VA_ARGS__)
# define message(...) syslog(__VA_ARGS__)
# else
# define message lib_rawprintf
# define message syslog
# endif
/* At present, uIP does only abortive disconnects */
+2 -2
View File
@@ -168,7 +168,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -176,7 +176,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -239,7 +239,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -247,7 +247,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+1 -1
View File
@@ -120,7 +120,7 @@
#endif
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_FS)
# define message lib_rawprintf
# define message syslog
# define msgflush()
#else
# define message printf
+2 -2
View File
@@ -96,7 +96,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -104,7 +104,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -111,7 +111,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -119,7 +119,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -120,7 +120,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -128,7 +128,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -194,7 +194,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -202,7 +202,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+3 -3
View File
@@ -71,7 +71,7 @@
# undef HAVE_NETPOLL
#endif
/* If debug is enabled, then use lib_rawprintf so that OS debug output and
/* If debug is enabled, then use syslog so that OS debug output and
* the test output are synchronized.
*
* These macros will differ depending upon if the toolchain supports
@@ -80,7 +80,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_rawprintf(__VA_ARGS__)
# define message(...) syslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -88,7 +88,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_rawprintf
# define message syslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -92,7 +92,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_rawprintf(__VA_ARGS__)
# define message(...) syslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -100,7 +100,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_rawprintf
# define message syslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -77,7 +77,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_rawprintf(__VA_ARGS__)
# define message(...) syslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -85,7 +85,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_rawprintf
# define message syslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -125,7 +125,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -133,7 +133,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -82,7 +82,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_rawprintf(__VA_ARGS__)
# define message(...) syslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -90,7 +90,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_rawprintf
# define message syslog
# define msgflush()
# else
# define message printf
+2 -2
View File
@@ -63,12 +63,12 @@
#else
/* If debug is enabled, use the synchronous lib_lowprintf so that the
/* If debug is enabled, use the synchronous lowsyslog so that the
* program output does not get disassociated in the debug output.
*/
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# else
# define message(...) printf(__VA_ARGS__)
# endif
+2 -2
View File
@@ -86,13 +86,13 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# else
# define message(...) printf(__VA_ARGS__)
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# else
# define message (void)
# endif
+4 -4
View File
@@ -109,16 +109,16 @@
TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define trmessage lib_lowprintf
# define message(...) lowsyslog(__VA_ARGS__)
# define trmessage lowsyslog
# else
# define message(...) printf(__VA_ARGS__)
# define trmessage printf
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define trmessage lib_lowprintf
# define message lowsyslog
# define trmessage lowsyslog
# else
# define message printf
# define trmessage printf
+2 -2
View File
@@ -85,7 +85,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_lowprintf(__VA_ARGS__)
# define message(...) lowsyslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -93,7 +93,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define message lowsyslog
# define msgflush()
# else
# define message printf
+4 -4
View File
@@ -101,16 +101,16 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_rawprintf(__VA_ARGS__)
# define trmessage lib_rawprintf
# define message(...) syslog(__VA_ARGS__)
# define trmessage syslog
# else
# define message(...) printf(__VA_ARGS__)
# define trmessage printf
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_lowprintf
# define trmessage lib_lowprintf
# define message lowsyslog
# define trmessage lowsyslog
# else
# define message printf
# define trmessage printf
+2 -2
View File
@@ -89,7 +89,7 @@
#ifdef CONFIG_CPP_HAVE_VARARGS
# ifdef CONFIG_DEBUG
# define message(...) lib_rawprintf(__VA_ARGS__)
# define message(...) syslog(__VA_ARGS__)
# define msgflush()
# else
# define message(...) printf(__VA_ARGS__)
@@ -97,7 +97,7 @@
# endif
#else
# ifdef CONFIG_DEBUG
# define message lib_rawprintf
# define message syslog
# define msgflush()
# else
# define message printf
+96
View File
@@ -0,0 +1,96 @@
/****************************************************************************
* apps/include/usbmonitor.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __APPS_INCLUDE_USBMONITOR_H
#define __APPS_INCLUDE_USBMONITOR_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_SYSTEM_USBMONITOR
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: usbmon_start and usbmon_stop
*
* Start and top the USB monitor daemon. These are normally controlled
* from the USB command line, but the ability to control these
* programmatically is also helpful (for example, so that the daemon is
* running before NSH starts).
*
* Input Parameters:
* Standard task parameters. These can be called or spawned. Since the
* return almost immediately, it is fine to just call the functions. The
* parameters are not used so you can pass 0 and NULL, respectivley; this
* is done this way so that these functions can be NSH builtin
* applications.
*
* Returned values:
* Standard task return values (zero meaning success).
*
**************************************************************************/
int usbmonitor_start(int argc, char **argv);
int usbmonitor_stop(int argc, char **argv);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_SYSTEM_USBMONITOR */
#endif /* __APPS_INCLUDE_USBMONITOR_H */
+1 -1
View File
@@ -63,7 +63,7 @@
****************************************************************************/
#if defined(CONFIG_DEBUG) || defined(CONFIG_NSH_USBCONSOLE)
# define trmessage lib_lowprintf
# define trmessage lowsyslog
#else
# define trmessage printf
#endif
+2 -2
View File
@@ -44,7 +44,6 @@ endif
# Hello Application
# TODO: appname can be automatically extracted from the directory name
APPNAME = usbmon
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 768
@@ -90,7 +89,8 @@ $(COBJS): %$(OBJEXT): %.c
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
$(call REGISTER,"usbmon_start",$(PRIORITY),$(STACKSIZE),usbmonitor_start)
$(call REGISTER,"usbmon_stop",$(PRIORITY),$(STACKSIZE),usbmonintor_stop)
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
else
+34 -34
View File
@@ -40,20 +40,29 @@
#include <nuttx/config.h>
#include <nuttx/progmem.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/usb/usbdev_trace.h"
#ifdef CONFIG_SYSTEM_USBMONITOR
/****************************************************************************
* Private Typs
* Pre-processor Definitions
****************************************************************************/
#define USBMON_PREFIX "USB Monitor: "
/****************************************************************************
* Private Types
****************************************************************************/
struct usbmon_state_s
{
#ifdef CONFIG_NSH_BUILTIN_APPS
volatile bool started;
volatile bool stop;
pid_t pid;
#endif
};
/****************************************************************************
@@ -66,34 +75,29 @@ static struct usbmon_state_s g_usbmonitor;
* Private Functions
****************************************************************************/
static int usbmonitor_tracecallback(struct usbtrace_s *trace, void *arg)
{
usbtrace_trprintf((trprintf_t)syslog, trace->event, trace->value);
return 0;
}
static int usbmonitor_daemon(int argc, char **argv)
{
#ifdef CONFIG_NSH_BUILTIN_APPS
print("USB Monitor running: %d\n", g_usbmonitor.pid);
#endif
syslog(USBMON_PREFIX "Running: %d\n", g_usbmonitor.pid);
#ifdef CONFIG_NSH_BUILTIN_APPS
/* If we are running as an NSH command, then loop until we detect that
* there is a request to stop.
*/
/* Loop until we detect that there is a request to stop. */
while (!g_usbmonitor.stop)
#else
/* If we are running as a standalone program, then loop forever */
for (;;)
#endif
{
#warning "Missing logic"
(void)usbmonitor_enumerate(nsh_tracecallback, NULL);
}
/* Stopped */
#ifdef CONFIG_NSH_BUILTIN_APPS
g_usbmonitor.stop = false;
g_usbmonitor.started = false;
print("USB Monitor stopped: %d\n", g_usbmonitor.pid);
#endif
syslog(USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid);
return 0;
}
@@ -101,9 +105,8 @@ static int usbmonitor_daemon(int argc, char **argv)
* Public Functions
****************************************************************************/
int usbmonitor_main(int argc, char **argv)
int usbmonitor_start(int argc, char **argv)
{
#ifdef CONFIG_NSH_BUILTIN_APPS
/* Has the monitor already started? */
sched_lock();
@@ -122,13 +125,14 @@ int usbmonitor_main(int argc, char **argv)
if (ret < 0)
{
int errcode = errno;
fprintf(stderr, "ERROR: Failed to start the USB monitor: %d\n",
errcode);
syslog(USBMON_PREFIX
"ERROR: Failed to start the USB monitor: %d\n",
errcode);
}
else
{
g_usbmonitor.pid = ret;
print("USB Monitor started: %d\n", g_usbmonitor.pid);
syslog(USBMON_PREFIX "Started: %d\n", g_usbmonitor.pid);
}
sched_unlock();
@@ -136,27 +140,23 @@ int usbmonitor_main(int argc, char **argv)
}
sched_unlock();
print("USB Monitor running: %d\n", g_usbmonitor.pid);
syslog(USBMON_PREFIX "Running: %d\n", g_usbmonitor.pid);
return 0;
#else
return usbmonitor_daemon(argc, argv);
#endif
}
#ifdef CONFIG_NSH_BUILTIN_APPS
int usbmonitor_stop(int argc, char **argv)
{
/* Has the monitor already started? */
if (g_usbmonitor.started)
{
print("USB Monitor stopping: %d\n", g_usbmonitor.pid);
syslog(USBMON_PREFIX "Stopping: %d\n", g_usbmonitor.pid);
g_usbmonitor.stop = true;
return 0;
}
print("USB Monitor stopped: %d\n", g_usbmonitor.pid);
syslog(USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid);
return 0;
}
#endif
#endif /* CONFIG_SYSTEM_USBMONITOR */
+2 -2
View File
@@ -45,14 +45,14 @@ kconfig-frontends
To suppress the 'nconf' and the graphical front-ends which are not used by
NuttX, you can add:
./configure --enable-mconfig --disable-nconf --disable-gconf --disable-qconf
./configure --enable-mconf --disable-nconf --disable-gconf --disable-qconf
make
make install
To suppress the graphical interfaces, use static libraries, and disable
creation of other utilities:
./configure --disable-shared --enable-static --enable-mconfig --disable-nconf --disable-gconf --disable-qconf --disable-nconf --disable-utils
./configure --disable-shared --enable-static --enable-mconf --disable-nconf --disable-gconf --disable-qconf --disable-nconf --disable-utils
make
make install
+5 -5
View File
@@ -4324,17 +4324,17 @@ build
<li>
<code>CONFIG_DEBUG</code>: enables built-in debug options.
This includes more extensive parameter checking, debug assertions, and other debug logic.
This option is also necessary (but not sufficient) to enable debug console output;
Debug console output must also be enabled on a subsystem-by-subsystem basis as described below.
This option is also necessary (but not sufficient) to enable debug syslog output;
Debug syslog output must also be enabled on a subsystem-by-subsystem basis as described below.
</li>
<li>
<code>CONFIG_DEBUG_VERBOSE</code>: If debug console output is enabled, the option enables more verbose debug output.
<code>CONFIG_DEBUG_VERBOSE</code>: If debug syslog output is enabled, the option enables more verbose debug output.
Ignored if <code>CONFIG_DEBUG</code> is not defined.
If only <code>CONFIG_DEBUG</code> then the only output will be errors, warnings, and critical information.
If <code>CONFIG_DEBUG_VERBOSE</code> is defined in addition, then general debug comments will also be included in the console output.
If <code>CONFIG_DEBUG_VERBOSE</code> is defined in addition, then general debug comments will also be included in the syslog output.
</li>
<li>
<code>CONFIG_DEBUG_ENABLE</code>: Support an interface to enable or disable debug output.
<code>CONFIG_SYSLOG_ENABLE</code>: Support an interface to enable or disable syslog output.
</li>
<li>
<code>CONFIG_DEBUG_SYMBOLS</code>: build without optimization and with debug symbols (needed for use with a debugger).
+3 -2
View File
@@ -312,11 +312,12 @@ config DEBUG_VERBOSE
often annoying) output will be generated. This means there are two levels
of debug output: errors-only and everything.
config DEBUG_ENABLE
config SYSLOG_ENABLE
bool "Enable Debug Controls"
default n
---help---
Support an interface to dynamically enable or disable debug output.
Support an interface called syslog_enable to dynamically enable or
disable debug output.
comment "Subsystem Debug Options"
+2 -15
View File
@@ -1,4 +1,4 @@
NuttX TODO List (Last updated January 27, 2013)
NuttX TODO List (Last updated January 28, 2013)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@@ -14,7 +14,7 @@ nuttx/
(6) Binary loaders (binfmt/)
(16) Network (net/, drivers/net)
(4) USB (drivers/usbdev, drivers/usbhost)
(12) Libraries (libc/, )
(11) Libraries (libc/, )
(9) File system/Generic drivers (fs/, drivers/)
(5) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/)
@@ -812,19 +812,6 @@ o Libraries (libc/)
Status: Open
Priority: ??
Title: SYSLOG INTEGRATION
Description: There are the beginnings of some system logging capabilities (see
drivers/syslog, fs/fs_syslog.c, and libc/stdio/lib_librawprintf.c and
lib_liblowprintf.c. For NuttX, SYSLOG is a concept and includes,
extends, and replaces the legacy NuttX debug ouput. Some additional
integration is required to formalized this. For example:
o lib_rawprintf() shjould be renamed syslog().
o debug.h should be renamed syslog.h
o And what about lib_lowprintf()? llsyslog?
Status: Open
Priority: Low -- more of a roadmap
Title: FLOATING POINT FORMATS
Description: Only the %f floating point format is supported. Others are accepted
but treated like %f.
+2 -2
View File
@@ -62,7 +62,7 @@
#ifdef CONFIG_ARCH_STACKDUMP
# undef lldbg
# define lldbg lib_lowprintf
# define lldbg lowsyslog
#endif
/* The following is just intended to keep some ugliness out of the mainline
@@ -70,7 +70,7 @@
*
* CONFIG_TASK_NAME_SIZE > 0 && <-- The task has a name
* (defined(CONFIG_DEBUG) || <-- And the debug is enabled (lldbg used)
* defined(CONFIG_ARCH_STACKDUMP) <-- Or lib_lowprintf() is used
* defined(CONFIG_ARCH_STACKDUMP) <-- Or lowsyslog() is used
*/
#undef CONFIG_PRINT_TASKNAME
+1 -1
View File
@@ -62,7 +62,7 @@
#ifdef CONFIG_ARCH_STACKDUMP
# undef lldbg
# define lldbg lib_lowprintf
# define lldbg lowsyslog
#endif
/****************************************************************************
+1 -1
View File
@@ -62,7 +62,7 @@
#ifdef CONFIG_ARCH_STACKDUMP
# undef lldbg
# define lldbg lib_lowprintf
# define lldbg lowsyslog
#endif
/****************************************************************************
+1 -1
View File
@@ -56,7 +56,7 @@
#ifdef CONFIG_ARCH_STACKDUMP
# undef lldbg
# define lldbg lib_lowprintf
# define lldbg lowsyslog
#endif
/****************************************************************************

Some files were not shown because too many files have changed in this diff Show More