system/adb: Replace printf with syslog since adb is a service

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-01-23 16:31:43 +08:00 committed by Xiang Xiao
parent b5128c401f
commit 8506078624
2 changed files with 8 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/adb/adb_main.c
* apps/system/adb/adb_banner.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -24,6 +24,9 @@
#include "adb.h"
#include <stdio.h>
#include <syslog.h>
#if defined(CONFIG_ADBD_BOARD_INIT) || defined (CONFIG_BOARDCTL_RESET)
# include <sys/boardctl.h>
#endif
@ -38,11 +41,13 @@
void adb_log_impl(FAR const char *func, int line, FAR const char *fmt, ...)
{
struct va_format vaf;
va_list ap;
fprintf(stderr, "%s (%d): ", func, line);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
vaf.fmt = fmt;
vaf.va = &ap;
syslog(LOG_ERR, "%s (%d): %pV", func, line, &vaf);
va_end(ap);
}
@ -57,13 +62,9 @@ void adb_reboot_impl(const char *target)
int main(int argc, FAR char **argv)
{
UNUSED(argc);
UNUSED(argv);
adb_context_t *ctx;
#ifdef CONFIG_ADBD_BOARD_INIT
{
boardctl(BOARDIOC_INIT, 0);
#if defined(CONFIG_ADBD_USB_SERVER) && \
@ -106,8 +107,6 @@ int main(int argc, FAR char **argv)
return 1;
}
#endif /* ADBD_USB_SERVER && USBDEV_COMPOSITE && BOARDCTL_USBDEVCTRL */
}
#endif /* CONFIG_ADBD_BOARD_INIT */
#ifdef CONFIG_ADBD_NET_INIT