mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-29 03:36:07 +08:00
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:
@@ -75,11 +75,11 @@
|
|||||||
# define CONFIG_CBUTTONARRAYTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
|
# define CONFIG_CBUTTONARRAYTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,11 +69,11 @@
|
|||||||
# define CONFIG_CCHECKBOXTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CCHECKBOXTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -76,11 +76,11 @@
|
|||||||
# define CONFIG_CGLYPHBUTTONTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
|
# define CONFIG_CGLYPHBUTTONTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -71,11 +71,11 @@
|
|||||||
# define CONFIG_CIMAGETEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CIMAGETEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -72,11 +72,11 @@
|
|||||||
# define CONFIG_CKEYPADTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CKEYPADTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -75,11 +75,11 @@
|
|||||||
# define CONFIG_CLATCHBUTTONARRAYTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
|
# define CONFIG_CLATCHBUTTONARRAYTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,11 +69,11 @@
|
|||||||
# define CONFIG_CLISTBOXTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CLISTBOXTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,11 +69,11 @@
|
|||||||
# define CONFIG_CPROGRESSBARTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CPROGRESSBARTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -70,11 +70,11 @@
|
|||||||
# define CONFIG_CRADIOBUTTONTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CRADIOBUTTONTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,11 +69,11 @@
|
|||||||
# define CONFIG_CSCROLLBARHORIZONTALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CSCROLLBARHORIZONTALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,11 +69,11 @@
|
|||||||
# define CONFIG_CSCROLLBARVERTICALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CSCROLLBARVERTICALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,11 +69,11 @@
|
|||||||
# define CONFIG_CSLIDERHORIZONTALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CSLIDERHORIZONTALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,11 +69,11 @@
|
|||||||
# define CONFIG_CSLIDERVERTICALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
# define CONFIG_CSLIDERVERTICALTEST_BGCOLOR CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
|
||||||
#endif
|
#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.
|
// of printf() so that the output is synchronized.
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -299,11 +299,11 @@ static void show_buttons(uint8_t oldset, uint8_t newset)
|
|||||||
state = "released";
|
state = "released";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use lib_lowprintf() because we make be executing from an
|
/* Use lowsyslog() because we make be executing from an
|
||||||
* interrupt handler.
|
* 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();
|
uint8_t newset = up_buttons();
|
||||||
|
|
||||||
lib_lowprintf("IRQ:%d Button %d:%s SET:%02x:\n",
|
lowsyslog("IRQ:%d Button %d:%s SET:%02x:\n",
|
||||||
irq, id, g_buttoninfo[BUTTON_INDEX(id)].name, newset);
|
irq, id, g_buttoninfo[BUTTON_INDEX(id)].name, newset);
|
||||||
show_buttons(g_oldset, newset);
|
show_buttons(g_oldset, newset);
|
||||||
g_oldset = newset;
|
g_oldset = newset;
|
||||||
}
|
}
|
||||||
@@ -409,7 +409,7 @@ int buttons_main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
maxbuttons = strtol(argv[1], NULL, 10);
|
maxbuttons = strtol(argv[1], NULL, 10);
|
||||||
}
|
}
|
||||||
lib_lowprintf("maxbuttons: %d\n", maxbuttons);
|
lowsyslog("maxbuttons: %d\n", maxbuttons);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize the button GPIOs */
|
/* 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);
|
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",
|
lowsyslog("Attached handler at %p to button %d [%s], oldhandler:%p\n",
|
||||||
g_buttoninfo[BUTTON_INDEX(i)].handler, i,
|
g_buttoninfo[BUTTON_INDEX(i)].handler, i,
|
||||||
g_buttoninfo[BUTTON_INDEX(i)].name, oldhandler);
|
g_buttoninfo[BUTTON_INDEX(i)].name, oldhandler);
|
||||||
|
|
||||||
/* Some hardware multiplexes different GPIO button sources to the same
|
/* Some hardware multiplexes different GPIO button sources to the same
|
||||||
* physical interrupt. If we register multiple such multiplexed button
|
* physical interrupt. If we register multiple such multiplexed button
|
||||||
@@ -438,9 +438,9 @@ int buttons_main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (oldhandler != NULL)
|
if (oldhandler != NULL)
|
||||||
{
|
{
|
||||||
lib_lowprintf("WARNING: oldhandler:%p is not NULL! "
|
lowsyslog("WARNING: oldhandler:%p is not NULL! "
|
||||||
"Button events may be lost or aliased!\n",
|
"Button events may be lost or aliased!\n",
|
||||||
oldhandler);
|
oldhandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -468,11 +468,11 @@ int buttons_main(int argc, char *argv[])
|
|||||||
|
|
||||||
flags = irqsave();
|
flags = irqsave();
|
||||||
|
|
||||||
/* Use lib_lowprintf() for compatibility with interrrupt handler
|
/* Use lowsyslog() for compatibility with interrrupt handler
|
||||||
* output.
|
* output.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
lib_lowprintf("POLL SET:%02x:\n", newset);
|
lowsyslog("POLL SET:%02x:\n", newset);
|
||||||
show_buttons(g_oldset, newset);
|
show_buttons(g_oldset, newset);
|
||||||
g_oldset = newset;
|
g_oldset = newset;
|
||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -112,7 +112,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -173,7 +173,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -46,12 +46,12 @@
|
|||||||
* Definitions
|
* 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
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -69,12 +69,12 @@
|
|||||||
|
|
||||||
#else
|
#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
|
# ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* At present, uIP does only abortive disconnects */
|
/* At present, uIP does only abortive disconnects */
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -239,7 +239,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -247,7 +247,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_FS)
|
#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_FS)
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
#else
|
#else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -194,7 +194,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -202,7 +202,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
# undef HAVE_NETPOLL
|
# undef HAVE_NETPOLL
|
||||||
#endif
|
#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.
|
* the test output are synchronized.
|
||||||
*
|
*
|
||||||
* These macros will differ depending upon if the toolchain supports
|
* These macros will differ depending upon if the toolchain supports
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -63,12 +63,12 @@
|
|||||||
|
|
||||||
#else
|
#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.
|
* program output does not get disassociated in the debug output.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -86,13 +86,13 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# else
|
# else
|
||||||
# define message (void)
|
# define message (void)
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@@ -109,16 +109,16 @@
|
|||||||
TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
|
TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS)
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define trmessage lib_lowprintf
|
# define trmessage lowsyslog
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
# define trmessage printf
|
# define trmessage printf
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define trmessage lib_lowprintf
|
# define trmessage lowsyslog
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
# define trmessage printf
|
# define trmessage printf
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
# define message(...) lowsyslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -101,16 +101,16 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
# define trmessage lib_rawprintf
|
# define trmessage syslog
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
# define trmessage printf
|
# define trmessage printf
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_lowprintf
|
# define message lowsyslog
|
||||||
# define trmessage lib_lowprintf
|
# define trmessage lowsyslog
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
# define trmessage printf
|
# define trmessage printf
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message(...) lib_rawprintf(__VA_ARGS__)
|
# define message(...) syslog(__VA_ARGS__)
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message(...) printf(__VA_ARGS__)
|
# define message(...) printf(__VA_ARGS__)
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef CONFIG_DEBUG
|
# ifdef CONFIG_DEBUG
|
||||||
# define message lib_rawprintf
|
# define message syslog
|
||||||
# define msgflush()
|
# define msgflush()
|
||||||
# else
|
# else
|
||||||
# define message printf
|
# define message printf
|
||||||
|
|||||||
@@ -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 */
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_DEBUG) || defined(CONFIG_NSH_USBCONSOLE)
|
#if defined(CONFIG_DEBUG) || defined(CONFIG_NSH_USBCONSOLE)
|
||||||
# define trmessage lib_lowprintf
|
# define trmessage lowsyslog
|
||||||
#else
|
#else
|
||||||
# define trmessage printf
|
# define trmessage printf
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ endif
|
|||||||
# Hello Application
|
# Hello Application
|
||||||
# TODO: appname can be automatically extracted from the directory name
|
# TODO: appname can be automatically extracted from the directory name
|
||||||
|
|
||||||
APPNAME = usbmon
|
|
||||||
PRIORITY = SCHED_PRIORITY_DEFAULT
|
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||||
STACKSIZE = 768
|
STACKSIZE = 768
|
||||||
|
|
||||||
@@ -90,7 +89,8 @@ $(COBJS): %$(OBJEXT): %.c
|
|||||||
|
|
||||||
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
|
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
|
||||||
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
|
$(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
|
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -40,20 +40,29 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/progmem.h>
|
#include <nuttx/progmem.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <sys/types.h>
|
||||||
#include <stdlib.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
|
struct usbmon_state_s
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
|
||||||
volatile bool started;
|
volatile bool started;
|
||||||
volatile bool stop;
|
volatile bool stop;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -66,34 +75,29 @@ static struct usbmon_state_s g_usbmonitor;
|
|||||||
* Private Functions
|
* 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)
|
static int usbmonitor_daemon(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
syslog(USBMON_PREFIX "Running: %d\n", g_usbmonitor.pid);
|
||||||
print("USB Monitor running: %d\n", g_usbmonitor.pid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
/* Loop until we detect that there is a request to stop. */
|
||||||
/* If we are running as an NSH command, then loop until we detect that
|
|
||||||
* there is a request to stop.
|
|
||||||
*/
|
|
||||||
|
|
||||||
while (!g_usbmonitor.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 */
|
/* Stopped */
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
|
||||||
g_usbmonitor.stop = false;
|
g_usbmonitor.stop = false;
|
||||||
g_usbmonitor.started = false;
|
g_usbmonitor.started = false;
|
||||||
print("USB Monitor stopped: %d\n", g_usbmonitor.pid);
|
syslog(USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,9 +105,8 @@ static int usbmonitor_daemon(int argc, char **argv)
|
|||||||
* Public Functions
|
* 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? */
|
/* Has the monitor already started? */
|
||||||
|
|
||||||
sched_lock();
|
sched_lock();
|
||||||
@@ -122,13 +125,14 @@ int usbmonitor_main(int argc, char **argv)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
int errcode = errno;
|
int errcode = errno;
|
||||||
fprintf(stderr, "ERROR: Failed to start the USB monitor: %d\n",
|
syslog(USBMON_PREFIX
|
||||||
errcode);
|
"ERROR: Failed to start the USB monitor: %d\n",
|
||||||
|
errcode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_usbmonitor.pid = ret;
|
g_usbmonitor.pid = ret;
|
||||||
print("USB Monitor started: %d\n", g_usbmonitor.pid);
|
syslog(USBMON_PREFIX "Started: %d\n", g_usbmonitor.pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
@@ -136,27 +140,23 @@ int usbmonitor_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
print("USB Monitor running: %d\n", g_usbmonitor.pid);
|
syslog(USBMON_PREFIX "Running: %d\n", g_usbmonitor.pid);
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
|
||||||
return usbmonitor_daemon(argc, argv);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
|
||||||
int usbmonitor_stop(int argc, char **argv)
|
int usbmonitor_stop(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* Has the monitor already started? */
|
/* Has the monitor already started? */
|
||||||
|
|
||||||
if (g_usbmonitor.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;
|
g_usbmonitor.stop = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
print("USB Monitor stopped: %d\n", g_usbmonitor.pid);
|
syslog(USBMON_PREFIX "Stopped: %d\n", g_usbmonitor.pid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif /* CONFIG_SYSTEM_USBMONITOR */
|
||||||
|
|||||||
@@ -45,14 +45,14 @@ kconfig-frontends
|
|||||||
To suppress the 'nconf' and the graphical front-ends which are not used by
|
To suppress the 'nconf' and the graphical front-ends which are not used by
|
||||||
NuttX, you can add:
|
NuttX, you can add:
|
||||||
|
|
||||||
./configure --enable-mconfig --disable-nconf --disable-gconf --disable-qconf
|
./configure --enable-mconf --disable-nconf --disable-gconf --disable-qconf
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
To suppress the graphical interfaces, use static libraries, and disable
|
To suppress the graphical interfaces, use static libraries, and disable
|
||||||
creation of other utilities:
|
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
|
||||||
make install
|
make install
|
||||||
|
|
||||||
|
|||||||
@@ -4324,17 +4324,17 @@ build
|
|||||||
<li>
|
<li>
|
||||||
<code>CONFIG_DEBUG</code>: enables built-in debug options.
|
<code>CONFIG_DEBUG</code>: enables built-in debug options.
|
||||||
This includes more extensive parameter checking, debug assertions, and other debug logic.
|
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;
|
This option is also necessary (but not sufficient) to enable debug syslog output;
|
||||||
Debug console output must also be enabled on a subsystem-by-subsystem basis as described below.
|
Debug syslog output must also be enabled on a subsystem-by-subsystem basis as described below.
|
||||||
</li>
|
</li>
|
||||||
<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.
|
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 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>
|
||||||
<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>
|
||||||
<li>
|
<li>
|
||||||
<code>CONFIG_DEBUG_SYMBOLS</code>: build without optimization and with debug symbols (needed for use with a debugger).
|
<code>CONFIG_DEBUG_SYMBOLS</code>: build without optimization and with debug symbols (needed for use with a debugger).
|
||||||
|
|||||||
+3
-2
@@ -312,11 +312,12 @@ config DEBUG_VERBOSE
|
|||||||
often annoying) output will be generated. This means there are two levels
|
often annoying) output will be generated. This means there are two levels
|
||||||
of debug output: errors-only and everything.
|
of debug output: errors-only and everything.
|
||||||
|
|
||||||
config DEBUG_ENABLE
|
config SYSLOG_ENABLE
|
||||||
bool "Enable Debug Controls"
|
bool "Enable Debug Controls"
|
||||||
default n
|
default n
|
||||||
---help---
|
---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"
|
comment "Subsystem Debug Options"
|
||||||
|
|
||||||
|
|||||||
+2
-15
@@ -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
|
This file summarizes known NuttX bugs, limitations, inconsistencies with
|
||||||
@@ -14,7 +14,7 @@ nuttx/
|
|||||||
(6) Binary loaders (binfmt/)
|
(6) Binary loaders (binfmt/)
|
||||||
(16) Network (net/, drivers/net)
|
(16) Network (net/, drivers/net)
|
||||||
(4) USB (drivers/usbdev, drivers/usbhost)
|
(4) USB (drivers/usbdev, drivers/usbhost)
|
||||||
(12) Libraries (libc/, )
|
(11) Libraries (libc/, )
|
||||||
(9) File system/Generic drivers (fs/, drivers/)
|
(9) File system/Generic drivers (fs/, drivers/)
|
||||||
(5) Graphics subystem (graphics/)
|
(5) Graphics subystem (graphics/)
|
||||||
(1) Pascal add-on (pcode/)
|
(1) Pascal add-on (pcode/)
|
||||||
@@ -812,19 +812,6 @@ o Libraries (libc/)
|
|||||||
Status: Open
|
Status: Open
|
||||||
Priority: ??
|
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
|
Title: FLOATING POINT FORMATS
|
||||||
Description: Only the %f floating point format is supported. Others are accepted
|
Description: Only the %f floating point format is supported. Others are accepted
|
||||||
but treated like %f.
|
but treated like %f.
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_STACKDUMP
|
#ifdef CONFIG_ARCH_STACKDUMP
|
||||||
# undef lldbg
|
# undef lldbg
|
||||||
# define lldbg lib_lowprintf
|
# define lldbg lowsyslog
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The following is just intended to keep some ugliness out of the mainline
|
/* 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
|
* CONFIG_TASK_NAME_SIZE > 0 && <-- The task has a name
|
||||||
* (defined(CONFIG_DEBUG) || <-- And the debug is enabled (lldbg used)
|
* (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
|
#undef CONFIG_PRINT_TASKNAME
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_STACKDUMP
|
#ifdef CONFIG_ARCH_STACKDUMP
|
||||||
# undef lldbg
|
# undef lldbg
|
||||||
# define lldbg lib_lowprintf
|
# define lldbg lowsyslog
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_STACKDUMP
|
#ifdef CONFIG_ARCH_STACKDUMP
|
||||||
# undef lldbg
|
# undef lldbg
|
||||||
# define lldbg lib_lowprintf
|
# define lldbg lowsyslog
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_STACKDUMP
|
#ifdef CONFIG_ARCH_STACKDUMP
|
||||||
# undef lldbg
|
# undef lldbg
|
||||||
# define lldbg lib_lowprintf
|
# define lldbg lowsyslog
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user