Bluetooth: Add support for using SYS_LOG
This add CONFIG_BLUETOOTH_DEBUG_LOG which depends on SYS_LOG since the later can actually use either CONFIG_PRINTK or CONFIG_STDOUT_CONSOLE. Change-Id: Ib2974d1331f6c91d119a218ec95e8bf01069377b Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
ab833c74c5
commit
f6dd1e4144
|
@ -20,13 +20,12 @@
|
|||
#ifndef __BT_LOG_H
|
||||
#define __BT_LOG_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_DEBUG_MONITOR)
|
||||
#include <stdio.h>
|
||||
|
||||
/* These defines follow the values used by syslog(2) */
|
||||
#define BT_LOG_ERR 3
|
||||
|
@ -49,27 +48,18 @@ void bt_log(int prio, const char *fmt, ...);
|
|||
/* Enabling debug increases stack size requirement considerably */
|
||||
#define BT_STACK_DEBUG_EXTRA 512
|
||||
|
||||
#elif defined(CONFIG_BLUETOOTH_DEBUG_STDOUT)
|
||||
#elif defined(CONFIG_BLUETOOTH_DEBUG_LOG)
|
||||
|
||||
#include <nanokernel.h>
|
||||
#define SYS_LOG_DOMAIN "bt"
|
||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
|
||||
#include <misc/sys_log.h>
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_DEBUG_COLOR)
|
||||
#define BT_COLOR_OFF "\x1B[0m"
|
||||
#define BT_COLOR_RED "\x1B[0;31m"
|
||||
#define BT_COLOR_YELLOW "\x1B[0;33m"
|
||||
#else
|
||||
#define BT_COLOR_OFF ""
|
||||
#define BT_COLOR_RED ""
|
||||
#define BT_COLOR_YELLOW ""
|
||||
#endif
|
||||
|
||||
#define BT_DBG(fmt, ...) printf("bt: %s (%p): " fmt "\n", __func__, \
|
||||
sys_thread_self_get(), ##__VA_ARGS__)
|
||||
#define BT_ERR(fmt, ...) printf("bt: %s: %s" fmt "%s\n", __func__, \
|
||||
BT_COLOR_RED, ##__VA_ARGS__, BT_COLOR_OFF)
|
||||
#define BT_WARN(fmt, ...) printf("bt: %s: %s" fmt "%s\n", __func__, \
|
||||
BT_COLOR_YELLOW, ##__VA_ARGS__, BT_COLOR_OFF)
|
||||
#define BT_INFO(fmt, ...) printf("bt: " fmt "\n", ##__VA_ARGS__)
|
||||
#define BT_DBG(fmt, ...) SYS_LOG_DBG("(%p)" fmt, sys_thread_self_get(), \
|
||||
##__VA_ARGS__)
|
||||
#define BT_ERR(fmt, ...) SYS_LOG_ERR(fmt, ##__VA_ARGS__)
|
||||
#define BT_WARN(fmt, ...) SYS_LOG_WRN(fmt, ##__VA_ARGS__)
|
||||
#define BT_INFO(fmt, ...) SYS_LOG_INF(fmt, ##__VA_ARGS__)
|
||||
#define BT_ASSERT(cond) if (!(cond)) { \
|
||||
BT_ERR("assert: '" #cond "' failed"); \
|
||||
}
|
||||
|
|
|
@ -268,10 +268,10 @@ config BLUETOOTH_DEBUG_NONE
|
|||
help
|
||||
Select this to disable all Bluetooth debug logs.
|
||||
|
||||
config BLUETOOTH_DEBUG_STDOUT
|
||||
config BLUETOOTH_DEBUG_LOG
|
||||
bool "Normal printf-style to console"
|
||||
select BLUETOOTH_DEBUG
|
||||
select STDOUT_CONSOLE
|
||||
select SYS_LOG
|
||||
help
|
||||
This option enables Bluetooth debug going to standard
|
||||
serial console.
|
||||
|
@ -297,7 +297,8 @@ endchoice
|
|||
|
||||
config BLUETOOTH_DEBUG_COLOR
|
||||
bool "Use colored logs"
|
||||
depends on BLUETOOTH_DEBUG_STDOUT
|
||||
depends on BLUETOOTH_DEBUG_LOG
|
||||
select SYS_LOG_SHOW_COLOR
|
||||
default y
|
||||
help
|
||||
Use color in the logs. This requires an ANSI capable terminal.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
|
|
|
@ -2,4 +2,4 @@ CONFIG_BLUETOOTH=y
|
|||
CONFIG_BLUETOOTH_STACK_NBLE=y
|
||||
CONFIG_NBLE=y
|
||||
CONFIG_ARC_INIT=n
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_CENTRAL=y
|
||||
CONFIG_BLUETOOTH_SMP=y
|
||||
CONFIG_BLUETOOTH_GATT_CLIENT=y
|
||||
|
|
|
@ -4,4 +4,4 @@ CONFIG_NETWORKING_WITH_BT=y
|
|||
CONFIG_IP_BUF_RX_SIZE=5
|
||||
CONFIG_IP_BUF_TX_SIZE=3
|
||||
CONFIG_ARC_INIT=n
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_SMP=y
|
||||
CONFIG_BLUETOOTH_SIGNING=y
|
||||
CONFIG_BLUETOOTH_PERIPHERAL=y
|
||||
|
|
|
@ -2,4 +2,4 @@ CONFIG_BLUETOOTH=y
|
|||
CONFIG_BLUETOOTH_STACK_NBLE=y
|
||||
CONFIG_NBLE=y
|
||||
CONFIG_ARC_INIT=n
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
|
|
|
@ -2,4 +2,4 @@ CONFIG_BLUETOOTH=y
|
|||
CONFIG_BLUETOOTH_STACK_NBLE=y
|
||||
CONFIG_NBLE=y
|
||||
CONFIG_ARC_INIT=n
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_SMP=y
|
||||
CONFIG_BLUETOOTH_PERIPHERAL=y
|
||||
CONFIG_BLUETOOTH_GATT_DYNAMIC_DB=y
|
||||
|
|
|
@ -2,4 +2,4 @@ CONFIG_BLUETOOTH=y
|
|||
CONFIG_BLUETOOTH_STACK_NBLE=y
|
||||
CONFIG_NBLE=y
|
||||
CONFIG_ARC_INIT=n
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_SMP=y
|
||||
CONFIG_BLUETOOTH_SIGNING=y
|
||||
CONFIG_BLUETOOTH_PERIPHERAL=y
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_DEBUG_L2CAP=y
|
||||
CONFIG_BLUETOOTH_SMP=y
|
||||
CONFIG_BLUETOOTH_SIGNING=y
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
|
|
|
@ -10,7 +10,7 @@ CONFIG_BLUETOOTH_USE_DEBUG_KEYS=y
|
|||
CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL=y
|
||||
CONFIG_BLUETOOTH_GATT_DYNAMIC_DB=y
|
||||
CONFIG_BLUETOOTH_GATT_CLIENT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_DEBUG_HCI_CORE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_CONN=y
|
||||
CONFIG_BLUETOOTH_DEBUG_KEYS=y
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_H5=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_DEBUG_DRIVER=y
|
||||
|
|
|
@ -3,7 +3,7 @@ CONFIG_BLUETOOTH=y
|
|||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_BREDR=y
|
||||
CONFIG_CONSOLE_HANDLER=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_CENTRAL=y
|
||||
CONFIG_BLUETOOTH_PERIPHERAL=y
|
||||
CONFIG_BLUETOOTH_PRIVACY=y
|
||||
|
|
|
@ -6,4 +6,4 @@ CONFIG_NBLE=y
|
|||
CONFIG_ARC_INIT=n
|
||||
CONFIG_CONSOLE_HANDLER=y
|
||||
CONFIG_CONSOLE_HANDLER_SHELL=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
|
|
|
@ -2,7 +2,7 @@ CONFIG_MINIMAL_LIBC_EXTENDED=y
|
|||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_CONSOLE_HANDLER=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_CENTRAL=y
|
||||
CONFIG_BLUETOOTH_PERIPHERAL=y
|
||||
CONFIG_BLUETOOTH_PRIVACY=y
|
||||
|
|
|
@ -4,5 +4,5 @@ CONFIG_TEST_RANDOM_GENERATOR=y
|
|||
CONFIG_BLUETOOTH=y
|
||||
CONFIG_BLUETOOTH_LE=y
|
||||
CONFIG_BLUETOOTH_NO_DRIVER=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=n
|
||||
|
|
|
@ -8,7 +8,7 @@ CONFIG_BLUETOOTH_SMP=y
|
|||
CONFIG_BLUETOOTH_SIGNING=y
|
||||
CONFIG_BLUETOOTH_GATT_DYNAMIC_DB=y
|
||||
CONFIG_BLUETOOTH_GATT_CLIENT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_STDOUT=y
|
||||
CONFIG_BLUETOOTH_DEBUG_LOG=y
|
||||
CONFIG_BLUETOOTH_DEBUG_HCI_CORE=y
|
||||
CONFIG_BLUETOOTH_DEBUG_BUF=y
|
||||
CONFIG_BLUETOOTH_DEBUG_CONN=y
|
||||
|
|
Loading…
Reference in a new issue