Bluetooth: Take advantage of IS_ENABLED macro for BT_DBG
The new IS_ENABLED macro allows exposing conditionally enabled code always to the compiler, even though it may not ultimately end up being built. This is in particular useful for letting the compiler catch any logging format string errors. Introduce a new BT_DBG_ENABLED macro that c-files need to define before including <bluetooth/log.h> in order to choose whether BT_DBG() logs are enabled or not. When no Bluetooth logs are enabled the patch also modifies the log macros to have the format strings checked with the help of the __printf_like annotation and empty static inline functions. Change-Id: Ie6bc8e10727b5b306f3ed0f94089a07a22583d9b Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
d627509185
commit
645f867444
36 changed files with 90 additions and 156 deletions
|
@ -28,18 +28,14 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/hci_driver.h>
|
||||
|
||||
#include "../util.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_NRF51_PM)
|
||||
#include "../nrf51_pm.h"
|
||||
#endif
|
||||
|
|
|
@ -30,18 +30,14 @@
|
|||
#include <misc/printk.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/hci_driver.h>
|
||||
|
||||
#include "../util.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
static BT_STACK_NOINIT(tx_stack, 256);
|
||||
static BT_STACK_NOINIT(rx_stack, 256);
|
||||
|
||||
|
|
|
@ -19,21 +19,17 @@
|
|||
#include <atomic.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_NBLE_DEBUG_CONN)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
#include <bluetooth/gatt.h>
|
||||
#include <bluetooth/log.h>
|
||||
|
||||
#include "gap_internal.h"
|
||||
#include "gatt_internal.h"
|
||||
#include "conn_internal.h"
|
||||
#include "smp.h"
|
||||
|
||||
#if !defined(CONFIG_NBLE_DEBUG_CONN)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
/* Peripheral timeout to initialize Connection Parameter Update procedure */
|
||||
#define CONN_UPDATE_TIMEOUT K_SECONDS(5)
|
||||
|
||||
|
|
|
@ -20,11 +20,12 @@
|
|||
#include <zephyr.h>
|
||||
#include <device.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_NBLE_DEBUG_GAP)
|
||||
#include <bluetooth/log.h>
|
||||
#include <net/buf.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
#include <bluetooth/gatt.h>
|
||||
#include <bluetooth/log.h>
|
||||
|
||||
#include "gap_internal.h"
|
||||
#include "conn_internal.h"
|
||||
|
@ -44,11 +45,6 @@
|
|||
/* Set the firmware compatible with Nordic BLE RPC */
|
||||
static const uint32_t compatible_firmware = NBLE_VERSION(4, 0, 31);
|
||||
|
||||
#if !defined(CONFIG_NBLE_DEBUG_GAP)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
static bt_ready_cb_t bt_ready_cb;
|
||||
static bt_le_scan_cb_t *scan_dev_found_cb;
|
||||
|
||||
|
@ -65,6 +61,11 @@ static const char *bt_addr_le_str(const bt_addr_le_t *addr)
|
|||
|
||||
return str;
|
||||
}
|
||||
#else
|
||||
static inline const char *bt_addr_le_str(const bt_addr_le_t *addr)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_BLUETOOTH_DEBUG */
|
||||
|
||||
static void clear_bonds(const bt_addr_le_t *addr)
|
||||
|
|
|
@ -18,20 +18,16 @@
|
|||
#include <atomic.h>
|
||||
#include <misc/byteorder.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_GATT)
|
||||
#include <bluetooth/log.h>
|
||||
#include <net/buf.h>
|
||||
#include <bluetooth/gatt.h>
|
||||
#include <bluetooth/att.h>
|
||||
#include <bluetooth/log.h>
|
||||
|
||||
#include "conn.h"
|
||||
#include "conn_internal.h"
|
||||
#include "gatt_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_GATT)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define NBLE_BUF_SIZE 384
|
||||
|
||||
/* TODO: Get this value during negotiation */
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
#include <string.h>
|
||||
#include <atomic.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_NBLE_DEBUG_RPC)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/gatt.h>
|
||||
/* for bt_security_t */
|
||||
#include <bluetooth/conn.h>
|
||||
#include <bluetooth/log.h>
|
||||
|
||||
#ifdef CONFIG_PRINTK
|
||||
#include <misc/printk.h>
|
||||
|
@ -36,11 +37,6 @@
|
|||
|
||||
#include "rpc_functions_to_quark.h"
|
||||
|
||||
#if !defined(CONFIG_NBLE_DEBUG_RPC)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
/* Build the list of prototypes and check that list are made only of matching
|
||||
* signatures
|
||||
*/
|
||||
|
@ -217,6 +213,9 @@ static char *debug_func_s_p[] = { LIST_FN_SIG_S_P };
|
|||
static char *debug_func_s_b_p[] = { LIST_FN_SIG_S_B_P };
|
||||
static char *debug_func_s_b_b_p[] = { LIST_FN_SIG_S_B_B_P};
|
||||
|
||||
#define DBG_FUNC(name) BT_DBG("%s", name)
|
||||
#else
|
||||
#define DBG_FUNC(name)
|
||||
#endif
|
||||
|
||||
#undef FN_SIG_NONE
|
||||
|
@ -587,49 +586,49 @@ void rpc_deserialize(struct net_buf *buf)
|
|||
switch (sig_type) {
|
||||
case SIG_TYPE_NONE:
|
||||
if (fn_index < ARRAY_SIZE(m_fct_none)) {
|
||||
BT_DBG("%s", debug_func_none[fn_index]);
|
||||
DBG_FUNC(debug_func_none[fn_index]);
|
||||
deserialize_none(fn_index, buf);
|
||||
}
|
||||
break;
|
||||
case SIG_TYPE_S:
|
||||
if (fn_index < ARRAY_SIZE(m_fct_s)) {
|
||||
BT_DBG("%s", debug_func_s[fn_index]);
|
||||
DBG_FUNC(debug_func_s[fn_index]);
|
||||
deserialize_s(fn_index, buf);
|
||||
}
|
||||
break;
|
||||
case SIG_TYPE_P:
|
||||
if (fn_index < ARRAY_SIZE(m_fct_p)) {
|
||||
BT_DBG("%s", debug_func_p[fn_index]);
|
||||
DBG_FUNC(debug_func_p[fn_index]);
|
||||
deserialize_p(fn_index, buf);
|
||||
}
|
||||
break;
|
||||
case SIG_TYPE_S_B:
|
||||
if (fn_index < ARRAY_SIZE(m_fct_s_b)) {
|
||||
BT_DBG("%s", debug_func_s_b[fn_index]);
|
||||
DBG_FUNC(debug_func_s_b[fn_index]);
|
||||
deserialize_s_b(fn_index, buf);
|
||||
}
|
||||
break;
|
||||
case SIG_TYPE_B_B_P:
|
||||
if (fn_index < ARRAY_SIZE(m_fct_b_b_p)) {
|
||||
BT_DBG("%s", debug_func_b_b_p[fn_index]);
|
||||
DBG_FUNC(debug_func_b_b_p[fn_index]);
|
||||
deserialize_b_b_p(fn_index, buf);
|
||||
}
|
||||
break;
|
||||
case SIG_TYPE_S_P:
|
||||
if (fn_index < ARRAY_SIZE(m_fct_s_p)) {
|
||||
BT_DBG("%s", debug_func_s_p[fn_index]);
|
||||
DBG_FUNC(debug_func_s_p[fn_index]);
|
||||
deserialize_s_p(fn_index, buf);
|
||||
}
|
||||
break;
|
||||
case SIG_TYPE_S_B_P:
|
||||
if (fn_index < ARRAY_SIZE(m_fct_s_b_p)) {
|
||||
BT_DBG("%s", debug_func_s_b_p[fn_index]);
|
||||
DBG_FUNC(debug_func_s_b_p[fn_index]);
|
||||
deserialize_s_b_p(fn_index, buf);
|
||||
}
|
||||
break;
|
||||
case SIG_TYPE_S_B_B_P:
|
||||
if (fn_index < ARRAY_SIZE(m_fct_s_b_b_p)) {
|
||||
BT_DBG("%s", debug_func_s_b_b_p[fn_index]);
|
||||
DBG_FUNC(debug_func_s_b_b_p[fn_index]);
|
||||
deserialize_s_b_b_p(fn_index, buf);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
#include <zephyr.h>
|
||||
#include <device.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(NBLE_DEBUG_GAP)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
#include <bluetooth/log.h>
|
||||
|
||||
#include <misc/util.h>
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <net/buf.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#include <bluetooth/log.h>
|
||||
|
||||
#include "../util.h"
|
||||
|
@ -38,11 +39,6 @@
|
|||
#include "../nrf51_pm.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @note this structure must be self-aligned and self-packed
|
||||
*/
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <gpio.h>
|
||||
#include <uart.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#include <bluetooth/log.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(BT_DBG_ENABLED)
|
||||
#define BT_DBG_ENABLED 1
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_DEBUG_MONITOR)
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -39,8 +43,12 @@ extern "C" {
|
|||
|
||||
void bt_log(int prio, const char *fmt, ...);
|
||||
|
||||
#define BT_DBG(fmt, ...) bt_log(BT_LOG_DBG, "%s (%p): " fmt, \
|
||||
__func__, k_current_get(), ##__VA_ARGS__)
|
||||
#define BT_DBG(fmt, ...) \
|
||||
if (BT_DBG_ENABLED) { \
|
||||
bt_log(BT_LOG_DBG, "%s (%p): " fmt, \
|
||||
__func__, k_current_get(), ##__VA_ARGS__); \
|
||||
}
|
||||
|
||||
#define BT_ERR(fmt, ...) bt_log(BT_LOG_ERR, "%s: " fmt, \
|
||||
__func__, ##__VA_ARGS__)
|
||||
#define BT_WARN(fmt, ...) bt_log(BT_LOG_WARN, "%s: " fmt, \
|
||||
|
@ -56,8 +64,12 @@ void bt_log(int prio, const char *fmt, ...);
|
|||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
|
||||
#include <logging/sys_log.h>
|
||||
|
||||
#define BT_DBG(fmt, ...) SYS_LOG_DBG("(%p) " fmt, k_current_get(), \
|
||||
##__VA_ARGS__)
|
||||
#define BT_DBG(fmt, ...) \
|
||||
if (BT_DBG_ENABLED) { \
|
||||
SYS_LOG_DBG("(%p) " fmt, k_current_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__)
|
||||
|
@ -67,10 +79,15 @@ void bt_log(int prio, const char *fmt, ...);
|
|||
|
||||
#else
|
||||
|
||||
#define BT_DBG(fmt, ...)
|
||||
#define BT_ERR(fmt, ...)
|
||||
#define BT_WARN(fmt, ...)
|
||||
#define BT_INFO(fmt, ...)
|
||||
static inline __printf_like(1, 2) void _bt_log_dummy(const char *fmt, ...) {};
|
||||
|
||||
#define BT_DBG(fmt, ...) \
|
||||
if (0) { \
|
||||
_bt_log_dummy(fmt, ##__VA_ARGS__); \
|
||||
}
|
||||
#define BT_ERR BT_DBG
|
||||
#define BT_WARN BT_DBG
|
||||
#define BT_INFO BT_DBG
|
||||
|
||||
#define BT_STACK_DEBUG_EXTRA 0
|
||||
|
||||
|
@ -88,11 +105,8 @@ void bt_log(int prio, const char *fmt, ...);
|
|||
char __noinit __stack name[(size) + K_THREAD_SIZEOF + \
|
||||
BT_STACK_DEBUG_EXTRA]
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_DEBUG)
|
||||
/* This helper is only available when BLUETOOTH_DEBUG is enabled */
|
||||
const char *bt_hex(const void *buf, size_t len);
|
||||
#else
|
||||
#define bt_hex(buf, len)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <bluetooth/buf.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "mem.h"
|
||||
|
@ -40,6 +41,7 @@
|
|||
#include "ll.h"
|
||||
#include "hci_internal.h"
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#include <bluetooth/log.h>
|
||||
#include "debug.h"
|
||||
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
#include <misc/stack.h>
|
||||
#include <misc/byteorder.h>
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <drivers/bluetooth/hci_driver.h>
|
||||
|
||||
|
@ -55,11 +56,6 @@
|
|||
|
||||
#include "hal/debug.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define HCI_CMD 0x01
|
||||
#define HCI_ACL 0x02
|
||||
#define HCI_SCO 0x03
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_DRIVER)
|
||||
#include <bluetooth/log.h>
|
||||
#include "debug.h"
|
||||
|
||||
|
|
|
@ -338,7 +338,6 @@ config BLUETOOTH_MONITOR_ON_DEV_NAME
|
|||
if BLUETOOTH_DEBUG
|
||||
config BLUETOOTH_DEBUG_HCI_CORE
|
||||
bool "Bluetooth HCI core debug"
|
||||
depends on BLUETOOTH_HCI_HOST
|
||||
help
|
||||
This option enables debug support for Bluetooth HCI
|
||||
core.
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
#include <misc/printk.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_A2DP)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/l2cap.h>
|
||||
|
@ -35,11 +37,6 @@
|
|||
#include "avdtp_internal.h"
|
||||
#include "a2dp_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_A2DP)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define A2DP_NO_SPACE (-1)
|
||||
|
||||
struct bt_a2dp {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_ATT)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
@ -38,11 +39,6 @@
|
|||
#include "att_internal.h"
|
||||
#include "gatt_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_ATT)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define ATT_CHAN(_ch) CONTAINER_OF(_ch, struct bt_att, chan.chan)
|
||||
#define ATT_REQ(_node) CONTAINER_OF(_node, struct bt_att_req, node)
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_AVDTP)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
@ -32,11 +33,6 @@
|
|||
#include "l2cap_internal.h"
|
||||
#include "avdtp_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_AVDTP)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
/* TODO add config file*/
|
||||
#define CONFIG_BLUETOOTH_AVDTP_CONN CONFIG_BLUETOOTH_MAX_CONN
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_CONN)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
@ -38,11 +39,6 @@
|
|||
#include "smp.h"
|
||||
#include "att_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_CONN)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
NET_BUF_POOL_DEFINE(acl_tx_pool, CONFIG_BLUETOOTH_L2CAP_TX_BUF_COUNT,
|
||||
BT_L2CAP_BUF_SIZE(CONFIG_BLUETOOTH_L2CAP_TX_MTU),
|
||||
CONFIG_BLUETOOTH_L2CAP_TX_USER_DATA_SIZE, NULL);
|
||||
|
@ -75,8 +71,7 @@ static const uint8_t ssp_method[4 /* remote */][4 /* local */] = {
|
|||
};
|
||||
#endif /* CONFIG_BLUETOOTH_BREDR */
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_DEBUG_CONN)
|
||||
static const char *state2str(bt_conn_state_t state)
|
||||
static inline const char *state2str(bt_conn_state_t state)
|
||||
{
|
||||
switch (state) {
|
||||
case BT_CONN_DISCONNECTED:
|
||||
|
@ -93,7 +88,6 @@ static const char *state2str(bt_conn_state_t state)
|
|||
return "(unknown)";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void notify_connected(struct bt_conn *conn)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_GATT)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
@ -39,11 +40,6 @@
|
|||
#include "smp.h"
|
||||
#include "gatt_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_GATT)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
static struct bt_gatt_attr *db;
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_GATT_CLIENT)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <misc/stack.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_CORE)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
|
@ -44,11 +45,6 @@
|
|||
#include "smp.h"
|
||||
#endif /* CONFIG_BLUETOOTH_CONN */
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_CORE)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
/* Peripheral timeout to initialize Connection Parameter Update procedure */
|
||||
#define CONN_UPDATE_TIMEOUT K_SECONDS(5)
|
||||
#define RPA_TIMEOUT K_SECONDS(CONFIG_BLUETOOTH_RPA_TIMEOUT)
|
||||
|
|
|
@ -152,10 +152,8 @@ int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf,
|
|||
/* The helper is only safe to be called from internal threads as it's
|
||||
* not multi-threading safe
|
||||
*/
|
||||
#if defined(CONFIG_BLUETOOTH_DEBUG)
|
||||
const char *bt_addr_str(const bt_addr_t *addr);
|
||||
const char *bt_addr_le_str(const bt_addr_le_t *addr);
|
||||
#endif
|
||||
|
||||
int bt_le_scan_update(bool fast_scan);
|
||||
|
||||
|
|
|
@ -27,11 +27,14 @@
|
|||
#include <tinycrypt/utils.h>
|
||||
#include <tinycrypt/ecc.h>
|
||||
#include <tinycrypt/ecc_dh.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_CORE)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/hci_driver.h>
|
||||
|
||||
#include "hci_ecc.h"
|
||||
#ifdef CONFIG_BLUETOOTH_HCI_RAW
|
||||
#include <bluetooth/hci_raw.h>
|
||||
|
@ -40,11 +43,6 @@
|
|||
#include "hci_core.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_HCI_CORE)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
static BT_STACK_NOINIT(ecc_thread_stack, 1280);
|
||||
|
||||
/* based on Core Specification 4.2 Vol 3. Part H 2.3.5.6.1 */
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
#include <errno.h>
|
||||
#include <atomic.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_CORE)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/hci_driver.h>
|
||||
#include <bluetooth/hci_raw.h>
|
||||
#include <bluetooth/log.h>
|
||||
|
||||
#include "hci_ecc.h"
|
||||
#include "monitor.h"
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <misc/util.h>
|
||||
#include <misc/printk.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HFP_HF)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/conn.h>
|
||||
#include <bluetooth/rfcomm.h>
|
||||
|
@ -32,11 +33,6 @@
|
|||
#include "at.h"
|
||||
#include "hfp_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_HFP_HF)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define MAX_IND_STR_LEN 17
|
||||
|
||||
struct bt_hfp_hf_cb *bt_hf;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <atomic.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_KEYS)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
|
@ -30,11 +31,6 @@
|
|||
#include "smp.h"
|
||||
#include "keys.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_KEYS)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
static struct bt_keys key_pool[CONFIG_BLUETOOTH_MAX_PAIRED];
|
||||
|
||||
struct bt_keys *bt_keys_get_addr(const bt_addr_le_t *addr)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <atomic.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_KEYS)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
|
@ -29,11 +30,6 @@
|
|||
#include "hci_core.h"
|
||||
#include "keys.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_KEYS)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
static struct bt_keys_link_key key_pool[CONFIG_BLUETOOTH_MAX_PAIRED];
|
||||
|
||||
struct bt_keys_link_key *bt_keys_find_link_key(const bt_addr_t *addr)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_L2CAP)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
@ -33,11 +34,6 @@
|
|||
#include "conn_internal.h"
|
||||
#include "l2cap_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_L2CAP)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define LE_CHAN_RTX(_w) CONTAINER_OF(_w, struct bt_l2cap_le_chan, chan.rtx_work)
|
||||
|
||||
#define L2CAP_LE_MIN_MTU 23
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_L2CAP)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
@ -39,11 +40,6 @@
|
|||
#endif
|
||||
#include "sdp_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_L2CAP)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define BR_CHAN(_ch) CONTAINER_OF(_ch, struct bt_l2cap_br_chan, chan)
|
||||
#define BR_CHAN_RTX(_w) CONTAINER_OF(_w, struct bt_l2cap_br_chan, chan.rtx_work)
|
||||
|
||||
|
|
|
@ -233,8 +233,9 @@ void bt_l2cap_chan_add(struct bt_conn *conn, struct bt_l2cap_chan *chan,
|
|||
/* Delete channel */
|
||||
void bt_l2cap_chan_del(struct bt_l2cap_chan *chan);
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_DEBUG_L2CAP)
|
||||
const char *bt_l2cap_chan_state_str(bt_l2cap_chan_state_t state);
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_DEBUG_L2CAP)
|
||||
void bt_l2cap_chan_set_state_debug(struct bt_l2cap_chan *chan,
|
||||
bt_l2cap_chan_state_t state,
|
||||
const char *func, int line);
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include <zephyr.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#include <bluetooth/log.h>
|
||||
|
||||
const char *bt_hex(const void *buf, size_t len)
|
||||
{
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <uart.h>
|
||||
|
||||
#include <bluetooth/buf.h>
|
||||
#include <bluetooth/log.h>
|
||||
|
||||
#include "monitor.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <misc/util.h>
|
||||
#include <misc/stack.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_RFCOMM)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
@ -37,11 +38,6 @@
|
|||
#include "l2cap_internal.h"
|
||||
#include "rfcomm_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_RFCOMM)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define RFCOMM_CHANNEL_START 0x01
|
||||
#define RFCOMM_CHANNEL_END 0x1e
|
||||
|
||||
|
|
|
@ -21,17 +21,13 @@
|
|||
#include <errno.h>
|
||||
#include <misc/byteorder.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_SDP)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/sdp.h>
|
||||
|
||||
#include "l2cap_internal.h"
|
||||
#include "sdp_internal.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_SDP)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define SDP_PSM 0x0001
|
||||
|
||||
#define SDP_CHAN(_ch) CONTAINER_OF(_ch, struct bt_sdp, chan.chan)
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
#include <misc/byteorder.h>
|
||||
#include <misc/stack.h>
|
||||
|
||||
#include <net/buf.h>
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_SMP)
|
||||
#include <bluetooth/log.h>
|
||||
#include <net/buf.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
|
@ -47,11 +48,6 @@
|
|||
#include "l2cap_internal.h"
|
||||
#include "smp.h"
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH_DEBUG_SMP)
|
||||
#undef BT_DBG
|
||||
#define BT_DBG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define SMP_TIMEOUT K_SECONDS(30)
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_SIGNING)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <atomic.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_CORE)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/conn.h>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <init.h>
|
||||
#include <fs.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BLUETOOTH_DEBUG_HCI_CORE)
|
||||
#include <bluetooth/log.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/storage.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue