From a2db217e15939c400a60a9eb09ab2ce1c2049a04 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 3 Oct 2017 14:56:01 +0300 Subject: [PATCH] Bluetooth: Clean up address-to-string usage & implementation Signed-off-by: Johan Hedberg --- subsys/bluetooth/common/log.c | 4 ++-- subsys/bluetooth/host/hci_core.c | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/common/log.c b/subsys/bluetooth/common/log.c index 640351100d..af5587bd1b 100644 --- a/subsys/bluetooth/common/log.c +++ b/subsys/bluetooth/common/log.c @@ -49,7 +49,7 @@ const char *bt_hex(const void *buf, size_t len) #if defined(CONFIG_BT_DEBUG) const char *bt_addr_str(const bt_addr_t *addr) { - static char bufs[2][18]; + static char bufs[2][BT_ADDR_STR_LEN]; static u8_t cur; char *str; @@ -62,7 +62,7 @@ const char *bt_addr_str(const bt_addr_t *addr) const char *bt_addr_le_str(const bt_addr_le_t *addr) { - static char bufs[2][27]; + static char bufs[2][BT_ADDR_LE_STR_LEN]; static u8_t cur; char *str; diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index f5cb76a145..658264594c 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -3767,11 +3767,7 @@ static const char *ver_str(u8_t ver) static void show_dev_info(void) { - char addr[BT_ADDR_LE_STR_LEN]; - - bt_addr_le_to_str(&bt_dev.id_addr, addr, sizeof(addr)); - - BT_INFO("Identity: %s", addr); + BT_INFO("Identity: %s", bt_addr_le_str(&bt_dev.id_addr)); BT_INFO("HCI: version %s (0x%02x) revision 0x%04x, manufacturer 0x%04x", ver_str(bt_dev.hci_version), bt_dev.hci_version, bt_dev.hci_revision, bt_dev.manufacturer);