mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Update everything under nuttx/drivers to use the corrected syslog interfaces
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
@@ -88,6 +89,26 @@ static usbtrace_idset_t g_maskedidset = CONFIG_USBDEV_TRACE_INITIALIDSET;
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: usbtrace_syslog
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_USBDEV_TRACE) && \
|
||||
(defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB))
|
||||
static int usbtrace_syslog(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
/* Let lowvsyslog do the real work */
|
||||
|
||||
va_start(ap, fmt);
|
||||
ret = lowvsyslog(LOG_INFO, fmt, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -110,7 +131,8 @@ static usbtrace_idset_t g_maskedidset = CONFIG_USBDEV_TRACE_INITIALIDSET;
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#if defined(CONFIG_USBDEV_TRACE) || (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB))
|
||||
#if defined(CONFIG_USBDEV_TRACE) || \
|
||||
(defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB))
|
||||
usbtrace_idset_t usbtrace_enable(usbtrace_idset_t idset)
|
||||
{
|
||||
irqstate_t flags;
|
||||
@@ -170,7 +192,7 @@ void usbtrace(uint16_t event, uint16_t value)
|
||||
#else
|
||||
/* Just print the data using lowsyslog */
|
||||
|
||||
usbtrace_trprintf((trprintf_t)lowsyslog, event, value);
|
||||
usbtrace_trprintf(usbtrace_syslog, event, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -204,30 +204,6 @@
|
||||
# define CONFIG_USBMSC_SCSI_STACKSIZE 2048
|
||||
#endif
|
||||
|
||||
/* Debug -- must be consistent with include/debug.h */
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# ifdef CONFIG_ARCH_LOWPUTC
|
||||
# define dbgprintf(format, ...) lowsyslog(format, ##__VA_ARGS__)
|
||||
# else
|
||||
# define dbgprintf(format, ...) syslog(format, ##__VA_ARGS__)
|
||||
# endif
|
||||
# else
|
||||
# define dbgprintf(x...)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# ifdef CONFIG_ARCH_LOWPUTC
|
||||
# define dbgprintf lowsyslog
|
||||
# else
|
||||
# define dbgprintf syslog
|
||||
# endif
|
||||
# else
|
||||
# define dbgprintf (void)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Packet and request buffer sizes */
|
||||
|
||||
#ifndef CONFIG_USBMSC_EP0MAXPACKET
|
||||
|
||||
@@ -199,12 +199,13 @@ static void usbmsc_dumpdata(const char *msg, const uint8_t *buf, int buflen)
|
||||
{
|
||||
int i;
|
||||
|
||||
dbgprintf("%s:", msg);
|
||||
lowsyslog(LOG_DEBUG, "%s:", msg);
|
||||
for (i = 0; i < buflen; i++)
|
||||
{
|
||||
dbgprintf(" %02x", buf[i]);
|
||||
lowsyslog(LOG_DEBUG, " %02x", buf[i]);
|
||||
}
|
||||
dbgprintf("\n");
|
||||
|
||||
lowsyslog(LOG_DEBUG, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user