summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-28 21:55:16 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-28 21:55:16 +0000
commitae5e2d8004affd8a0519de97a3c1ad700fa2b720 (patch)
treed6bc886b1d8c6772e245e715bb2676d95b8a9b78 /apps
parent489c78d7b6b14ca5b8eb7e2011c77599166a7894 (diff)
downloadnuttx-ae5e2d8004affd8a0519de97a3c1ad700fa2b720.tar.gz
nuttx-ae5e2d8004affd8a0519de97a3c1ad700fa2b720.tar.bz2
nuttx-ae5e2d8004affd8a0519de97a3c1ad700fa2b720.zip
Add syslog.h; rename lib_rawprintf() to syslog()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5578 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps')
-rw-r--r--apps/examples/adc/adc.h4
-rw-r--r--apps/examples/buttons/buttons_main.c28
-rw-r--r--apps/examples/can/can.h4
-rw-r--r--apps/examples/cdcacm/cdcacm.h4
-rw-r--r--apps/examples/composite/composite.h4
-rw-r--r--apps/examples/igmp/igmp.h6
-rw-r--r--apps/examples/nettest/nettest.h6
-rw-r--r--apps/examples/nx/nx_internal.h4
-rw-r--r--apps/examples/nxconsole/nxcon_internal.h4
-rw-r--r--apps/examples/nxffs/nxffs_main.c2
-rw-r--r--apps/examples/nxhello/nxhello.h4
-rw-r--r--apps/examples/nximage/nximage.h4
-rw-r--r--apps/examples/nxlines/nxlines.h4
-rw-r--r--apps/examples/nxtext/nxtext_internal.h4
-rw-r--r--apps/examples/poll/poll_internal.h6
-rw-r--r--apps/examples/pwm/pwm.h4
-rw-r--r--apps/examples/qencoder/qe.h4
-rw-r--r--apps/examples/thttpd/thttpd_main.c4
-rw-r--r--apps/examples/touchscreen/tc.h4
-rw-r--r--apps/examples/udp/udp-internal.h4
-rw-r--r--apps/examples/uip/uip_main.c4
-rw-r--r--apps/examples/usbserial/usbserial_main.c8
-rw-r--r--apps/examples/usbstorage/usbmsc.h4
-rw-r--r--apps/examples/usbterm/usbterm.h8
-rw-r--r--apps/examples/watchdog/watchdog.h4
-rw-r--r--apps/include/usbmonitor.h96
-rw-r--r--apps/nshlib/nsh_usbdev.c2
-rw-r--r--apps/system/usbmonitor/Makefile4
-rw-r--r--apps/system/usbmonitor/usbmonitor.c68
29 files changed, 201 insertions, 105 deletions
diff --git a/apps/examples/adc/adc.h b/apps/examples/adc/adc.h
index 9f79db92a..2d8af87e1 100644
--- a/apps/examples/adc/adc.h
+++ b/apps/examples/adc/adc.h
@@ -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
diff --git a/apps/examples/buttons/buttons_main.c b/apps/examples/buttons/buttons_main.c
index 5f25c1ef1..655080def 100644
--- a/apps/examples/buttons/buttons_main.c
+++ b/apps/examples/buttons/buttons_main.c
@@ -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);
diff --git a/apps/examples/can/can.h b/apps/examples/can/can.h
index 53a6b63ea..d9f9236f7 100644
--- a/apps/examples/can/can.h
+++ b/apps/examples/can/can.h
@@ -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
diff --git a/apps/examples/cdcacm/cdcacm.h b/apps/examples/cdcacm/cdcacm.h
index 18570bff0..1b3b2511c 100644
--- a/apps/examples/cdcacm/cdcacm.h
+++ b/apps/examples/cdcacm/cdcacm.h
@@ -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
diff --git a/apps/examples/composite/composite.h b/apps/examples/composite/composite.h
index 73a4453be..3f7f7ebad 100644
--- a/apps/examples/composite/composite.h
+++ b/apps/examples/composite/composite.h
@@ -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
diff --git a/apps/examples/igmp/igmp.h b/apps/examples/igmp/igmp.h
index 093f58c1f..5e1fa8d95 100644
--- a/apps/examples/igmp/igmp.h
+++ b/apps/examples/igmp/igmp.h
@@ -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
/****************************************************************************
diff --git a/apps/examples/nettest/nettest.h b/apps/examples/nettest/nettest.h
index 37ac470d1..5021e05d6 100644
--- a/apps/examples/nettest/nettest.h
+++ b/apps/examples/nettest/nettest.h
@@ -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 */
diff --git a/apps/examples/nx/nx_internal.h b/apps/examples/nx/nx_internal.h
index d9a6a2ade..53f1763b4 100644
--- a/apps/examples/nx/nx_internal.h
+++ b/apps/examples/nx/nx_internal.h
@@ -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
diff --git a/apps/examples/nxconsole/nxcon_internal.h b/apps/examples/nxconsole/nxcon_internal.h
index c5ad760ad..c921bed38 100644
--- a/apps/examples/nxconsole/nxcon_internal.h
+++ b/apps/examples/nxconsole/nxcon_internal.h
@@ -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
diff --git a/apps/examples/nxffs/nxffs_main.c b/apps/examples/nxffs/nxffs_main.c
index 5401fc932..8bb5cd1fe 100644
--- a/apps/examples/nxffs/nxffs_main.c
+++ b/apps/examples/nxffs/nxffs_main.c
@@ -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
diff --git a/apps/examples/nxhello/nxhello.h b/apps/examples/nxhello/nxhello.h
index 2dce7bf6c..f395b7018 100644
--- a/apps/examples/nxhello/nxhello.h
+++ b/apps/examples/nxhello/nxhello.h
@@ -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
diff --git a/apps/examples/nximage/nximage.h b/apps/examples/nximage/nximage.h
index eac0f5dc2..ef475ca29 100644
--- a/apps/examples/nximage/nximage.h
+++ b/apps/examples/nximage/nximage.h
@@ -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
diff --git a/apps/examples/nxlines/nxlines.h b/apps/examples/nxlines/nxlines.h
index a26db9f29..c9101124e 100644
--- a/apps/examples/nxlines/nxlines.h
+++ b/apps/examples/nxlines/nxlines.h
@@ -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
diff --git a/apps/examples/nxtext/nxtext_internal.h b/apps/examples/nxtext/nxtext_internal.h
index f0001e0bb..1e64193a3 100644
--- a/apps/examples/nxtext/nxtext_internal.h
+++ b/apps/examples/nxtext/nxtext_internal.h
@@ -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
diff --git a/apps/examples/poll/poll_internal.h b/apps/examples/poll/poll_internal.h
index b2400932e..759d23f1c 100644
--- a/apps/examples/poll/poll_internal.h
+++ b/apps/examples/poll/poll_internal.h
@@ -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
diff --git a/apps/examples/pwm/pwm.h b/apps/examples/pwm/pwm.h
index 5c049a8f8..a6132ca8b 100644
--- a/apps/examples/pwm/pwm.h
+++ b/apps/examples/pwm/pwm.h
@@ -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
diff --git a/apps/examples/qencoder/qe.h b/apps/examples/qencoder/qe.h
index 4c03689ab..3c20511ca 100644
--- a/apps/examples/qencoder/qe.h
+++ b/apps/examples/qencoder/qe.h
@@ -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
diff --git a/apps/examples/thttpd/thttpd_main.c b/apps/examples/thttpd/thttpd_main.c
index 97f922a76..9d08824e6 100644
--- a/apps/examples/thttpd/thttpd_main.c
+++ b/apps/examples/thttpd/thttpd_main.c
@@ -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
diff --git a/apps/examples/touchscreen/tc.h b/apps/examples/touchscreen/tc.h
index 654b1d874..dddff11c3 100644
--- a/apps/examples/touchscreen/tc.h
+++ b/apps/examples/touchscreen/tc.h
@@ -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
diff --git a/apps/examples/udp/udp-internal.h b/apps/examples/udp/udp-internal.h
index 2a966c746..c8010e6c8 100644
--- a/apps/examples/udp/udp-internal.h
+++ b/apps/examples/udp/udp-internal.h
@@ -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
diff --git a/apps/examples/uip/uip_main.c b/apps/examples/uip/uip_main.c
index 6c2f96f39..8e485441c 100644
--- a/apps/examples/uip/uip_main.c
+++ b/apps/examples/uip/uip_main.c
@@ -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
diff --git a/apps/examples/usbserial/usbserial_main.c b/apps/examples/usbserial/usbserial_main.c
index 016c8b292..dc7e1959a 100644
--- a/apps/examples/usbserial/usbserial_main.c
+++ b/apps/examples/usbserial/usbserial_main.c
@@ -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
diff --git a/apps/examples/usbstorage/usbmsc.h b/apps/examples/usbstorage/usbmsc.h
index 9d48c4521..95453198a 100644
--- a/apps/examples/usbstorage/usbmsc.h
+++ b/apps/examples/usbstorage/usbmsc.h
@@ -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
diff --git a/apps/examples/usbterm/usbterm.h b/apps/examples/usbterm/usbterm.h
index 2534c2f3c..560e55346 100644
--- a/apps/examples/usbterm/usbterm.h
+++ b/apps/examples/usbterm/usbterm.h
@@ -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
diff --git a/apps/examples/watchdog/watchdog.h b/apps/examples/watchdog/watchdog.h
index dc2dea944..dd4daebb9 100644
--- a/apps/examples/watchdog/watchdog.h
+++ b/apps/examples/watchdog/watchdog.h
@@ -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
diff --git a/apps/include/usbmonitor.h b/apps/include/usbmonitor.h
new file mode 100644
index 000000000..01fa060b0
--- /dev/null
+++ b/apps/include/usbmonitor.h
@@ -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 */
diff --git a/apps/nshlib/nsh_usbdev.c b/apps/nshlib/nsh_usbdev.c
index 3d123532a..d137e3dae 100644
--- a/apps/nshlib/nsh_usbdev.c
+++ b/apps/nshlib/nsh_usbdev.c
@@ -63,7 +63,7 @@
****************************************************************************/
#if defined(CONFIG_DEBUG) || defined(CONFIG_NSH_USBCONSOLE)
-# define trmessage lib_lowprintf
+# define trmessage lowsyslog
#else
# define trmessage printf
#endif
diff --git a/apps/system/usbmonitor/Makefile b/apps/system/usbmonitor/Makefile
index 04fcaf0ac..b4c323eb7 100644
--- a/apps/system/usbmonitor/Makefile
+++ b/apps/system/usbmonitor/Makefile
@@ -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
diff --git a/apps/system/usbmonitor/usbmonitor.c b/apps/system/usbmonitor/usbmonitor.c
index b101b128c..b615b99f9 100644
--- a/apps/system/usbmonitor/usbmonitor.c
+++ b/apps/system/usbmonitor/usbmonitor.c
@@ -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
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define USBMON_PREFIX "USB Monitor: "
/****************************************************************************
- * Private Typs
+ * 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 */