Bluetooth: Prefer printf over printk

The printf API has a much richer support for various format
specifiers. Switch the Bluetooth logging macros to use printf instead
of printk and make sure STDOUT_CONSOLE gets selected when
BLUETOOTH_DEBUG is selected (so printf actually works).

Change-Id: I9a9818d51a677c6c79a35fef6daca7979f61c78d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-05-20 10:31:00 +03:00 committed by Anas Nashif
commit 8930a13b60
2 changed files with 6 additions and 5 deletions

View file

@ -32,20 +32,20 @@
#ifndef __BT_BLUETOOTH_H
#define __BT_BLUETOOTH_H
#include <misc/printk.h>
#include <stdio.h>
#include <bluetooth/buf.h>
/* Bluetooth subsystem logging helpers */
#if defined(CONFIG_BLUETOOTH_DEBUG)
#define BT_DBG(fmt, ...) printk("bt: %s: " fmt, __func__, ##__VA_ARGS__)
#define BT_DBG(fmt, ...) printf("bt: %s: " fmt, __func__, ##__VA_ARGS__)
#else
#define BT_DBG(fmt, ...)
#endif /* CONFIG_BLUETOOTH_DEBUG */
#define BT_ERR(fmt, ...) printk("bt: %s: " fmt, __func__, ##__VA_ARGS__)
#define BT_WARN(fmt, ...) printk("bt: %s: " fmt, __func__, ##__VA_ARGS__)
#define BT_INFO(fmt, ...) printk("bt: " fmt, ##__VA_ARGS__)
#define BT_ERR(fmt, ...) printf("bt: %s: " fmt, __func__, ##__VA_ARGS__)
#define BT_WARN(fmt, ...) printf("bt: %s: " fmt, __func__, ##__VA_ARGS__)
#define BT_INFO(fmt, ...) printf("bt: " fmt, ##__VA_ARGS__)
/* HCI control APIs */

View file

@ -45,6 +45,7 @@ config BLUETOOTH_DEBUG
bool
prompt "Bluetooth LE debug support"
depends on BLUETOOTH
select STDOUT_CONSOLE
default n
help
This option enables Bluetooth debug going to standard