Bluetooth: Add newline to log macros

Make newline part of log macros so that caller doesn't have to
append '\n' every time logs are used. This make sure that no
log will be missing new line which results in concatenated log
messages.

Change-Id: I3231ae747c790816dbc1608e0a3bd56467ba0a1b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-11-25 14:26:48 +01:00 committed by Anas Nashif
commit 51f8ca59cd
10 changed files with 401 additions and 401 deletions

View file

@ -56,14 +56,14 @@ static int bt_uart_read(struct device *uart, uint8_t *buf,
rx = uart_fifo_read(uart, buf, len);
if (rx == 0) {
BT_DBG("Got zero bytes from UART\n");
BT_DBG("Got zero bytes from UART");
if (total < min) {
continue;
}
break;
}
BT_DBG("read %d remaining %d\n", rx, len - rx);
BT_DBG("read %d remaining %d", rx, len - rx);
len -= rx;
total += rx;
buf += rx;
@ -93,10 +93,10 @@ static struct net_buf *bt_uart_evt_recv(int *remaining)
if (buf) {
memcpy(net_buf_add(buf, sizeof(hdr)), &hdr, sizeof(hdr));
} else {
BT_ERR("No available event buffers!\n");
BT_ERR("No available event buffers!");
}
BT_DBG("len %u\n", hdr.len);
BT_DBG("len %u", hdr.len);
return buf;
}
@ -113,12 +113,12 @@ static struct net_buf *bt_uart_acl_recv(int *remaining)
if (buf) {
memcpy(net_buf_add(buf, sizeof(hdr)), &hdr, sizeof(hdr));
} else {
BT_ERR("No available ACL buffers!\n");
BT_ERR("No available ACL buffers!");
}
*remaining = sys_le16_to_cpu(hdr.len);
BT_DBG("len %u\n", *remaining);
BT_DBG("len %u", *remaining);
return buf;
}
@ -136,9 +136,9 @@ void bt_uart_isr(void *unused)
if (!uart_irq_rx_ready(bt_uart_dev)) {
if (uart_irq_tx_ready(bt_uart_dev)) {
BT_DBG("transmit ready\n");
BT_DBG("transmit ready");
} else {
BT_DBG("spurious interrupt\n");
BT_DBG("spurious interrupt");
}
continue;
}
@ -151,7 +151,7 @@ void bt_uart_isr(void *unused)
read = bt_uart_read(bt_uart_dev, &type,
sizeof(type), 0);
if (read != sizeof(type)) {
BT_WARN("Unable to read H4 packet type\n");
BT_WARN("Unable to read H4 packet type");
continue;
}
@ -163,14 +163,14 @@ void bt_uart_isr(void *unused)
buf = bt_uart_acl_recv(&remaining);
break;
default:
BT_ERR("Unknown H4 type %u\n", type);
BT_ERR("Unknown H4 type %u", type);
return;
}
BT_DBG("need to get %u bytes\n", remaining);
BT_DBG("need to get %u bytes", remaining);
if (buf && remaining > net_buf_tailroom(buf)) {
BT_ERR("Not enough space in buffer\n");
BT_ERR("Not enough space in buffer");
net_buf_unref(buf);
buf = NULL;
}
@ -178,7 +178,7 @@ void bt_uart_isr(void *unused)
if (!buf) {
read = bt_uart_discard(bt_uart_dev, remaining);
BT_WARN("Discarded %d bytes\n", read);
BT_WARN("Discarded %d bytes", read);
remaining -= read;
continue;
}
@ -189,10 +189,10 @@ void bt_uart_isr(void *unused)
buf->len += read;
remaining -= read;
BT_DBG("received %d bytes\n", read);
BT_DBG("received %d bytes", read);
if (!remaining) {
BT_DBG("full packet received\n");
BT_DBG("full packet received");
/* Pass buffer to the stack */
bt_recv(buf);
@ -227,7 +227,7 @@ IRQ_CONNECT_STATIC(bluetooth, CONFIG_BLUETOOTH_UART_IRQ,
static void bt_uart_setup(struct device *uart)
{
BT_DBG("\n");
BT_DBG("");
uart_irq_rx_disable(uart);
uart_irq_tx_disable(uart);

View file

@ -23,13 +23,13 @@
#include <stdio.h>
#if defined(CONFIG_BLUETOOTH_DEBUG)
#define BT_DBG(fmt, ...) printf("bt: %s (%p): " fmt, __func__, \
#define BT_DBG(fmt, ...) printf("bt: %s (%p): " fmt "\n", __func__, \
sys_thread_self_get(), ##__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__)
#define BT_ERR(fmt, ...) printf("bt: %s: " fmt "\n", __func__, ##__VA_ARGS__)
#define BT_WARN(fmt, ...) printf("bt: %s: " fmt "\n", __func__, ##__VA_ARGS__)
#define BT_INFO(fmt, ...) printf("bt: " fmt "\n", ##__VA_ARGS__)
#define BT_ASSERT(cond) if (!(cond)) { \
BT_ERR("bt: assert: '" #cond "' failed\n"); \
BT_ERR("bt: assert: '" #cond "' failed"); \
}
#else
#define BT_DBG(fmt, ...)

View file

@ -148,7 +148,7 @@ static uint8_t att_mtu_req(struct bt_att *att, struct net_buf *buf)
mtu_client = sys_le16_to_cpu(req->mtu);
BT_DBG("Client MTU %u\n", mtu_client);
BT_DBG("Client MTU %u", mtu_client);
/* Check if MTU is valid */
if (mtu_client < BT_ATT_DEFAULT_LE_MTU) {
@ -162,7 +162,7 @@ static uint8_t att_mtu_req(struct bt_att *att, struct net_buf *buf)
mtu_server = CONFIG_BLUETOOTH_ATT_MTU;
BT_DBG("Server MTU %u\n", mtu_server);
BT_DBG("Server MTU %u", mtu_server);
rsp = net_buf_add(pdu, sizeof(*rsp));
rsp->mtu = sys_cpu_to_le16(mtu_server);
@ -177,7 +177,7 @@ static uint8_t att_mtu_req(struct bt_att *att, struct net_buf *buf)
att->chan.rx.mtu = min(mtu_client, mtu_server);
att->chan.tx.mtu = att->chan.rx.mtu;
BT_DBG("Negotiated MTU %u\n", att->chan.rx.mtu);
BT_DBG("Negotiated MTU %u", att->chan.rx.mtu);
return 0;
}
@ -220,7 +220,7 @@ static uint8_t att_mtu_rsp(struct bt_att *att, struct net_buf *buf)
mtu = sys_le16_to_cpu(rsp->mtu);
BT_DBG("Server MTU %u\n", mtu);
BT_DBG("Server MTU %u", mtu);
/* Check if MTU is valid */
if (mtu < BT_ATT_DEFAULT_LE_MTU) {
@ -236,7 +236,7 @@ static uint8_t att_mtu_rsp(struct bt_att *att, struct net_buf *buf)
*/
att->chan.tx.mtu = att->chan.rx.mtu;
BT_DBG("Negotiated MTU %u\n", att->chan.rx.mtu);
BT_DBG("Negotiated MTU %u", att->chan.rx.mtu);
return att_handle_rsp(att, rsp, buf->len, 0);
}
@ -277,7 +277,7 @@ static uint8_t find_info_cb(const struct bt_gatt_attr *attr, void *user_data)
struct find_info_data *data = user_data;
struct bt_att *att = data->att;
BT_DBG("handle 0x%04x\n", attr->handle);
BT_DBG("handle 0x%04x", attr->handle);
/* Initialize rsp at first entry */
if (!data->rsp) {
@ -362,7 +362,7 @@ static uint8_t att_find_info_req(struct bt_att *att, struct net_buf *buf)
start_handle = sys_le16_to_cpu(req->start_handle);
end_handle = sys_le16_to_cpu(req->end_handle);
BT_DBG("start_handle 0x%04x end_handle 0x%04x\n", start_handle,
BT_DBG("start_handle 0x%04x end_handle 0x%04x", start_handle,
end_handle);
if (!range_is_valid(start_handle, end_handle, &err_handle)) {
@ -398,7 +398,7 @@ static uint8_t find_type_cb(const struct bt_gatt_attr *attr, void *user_data)
return BT_GATT_ITER_CONTINUE;
}
BT_DBG("handle 0x%04x\n", attr->handle);
BT_DBG("handle 0x%04x", attr->handle);
/* stop if there is no space left */
if (att->chan.tx.mtu - data->buf->len < sizeof(*data->group))
@ -471,7 +471,7 @@ static uint8_t att_find_type_req(struct bt_att *att, struct net_buf *buf)
type = sys_le16_to_cpu(req->type);
value = net_buf_pull(buf, sizeof(*req));
BT_DBG("start_handle 0x%04x end_handle 0x%04x type %u\n", start_handle,
BT_DBG("start_handle 0x%04x end_handle 0x%04x type %u", start_handle,
end_handle, type);
if (!range_is_valid(start_handle, end_handle, &err_handle)) {
@ -556,7 +556,7 @@ static uint8_t check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr,
static uint8_t err_to_att(int err)
{
BT_DBG("%d\n", err);
BT_DBG("%d", err);
switch (err) {
case -EINVAL:
@ -591,7 +591,7 @@ static uint8_t read_type_cb(const struct bt_gatt_attr *attr, void *user_data)
return BT_GATT_ITER_CONTINUE;
}
BT_DBG("handle 0x%04x\n", attr->handle);
BT_DBG("handle 0x%04x", attr->handle);
/*
* If an attribute in the set of requested attributes would cause an
@ -705,7 +705,7 @@ static uint8_t att_read_type_req(struct bt_att *att, struct net_buf *buf)
return BT_ATT_ERR_UNLIKELY;
}
BT_DBG("start_handle 0x%04x end_handle 0x%04x type %s\n",
BT_DBG("start_handle 0x%04x end_handle 0x%04x type %s",
start_handle, end_handle, bt_uuid_str(&uuid));
if (!range_is_valid(start_handle, end_handle, &err_handle)) {
@ -732,7 +732,7 @@ static uint8_t read_cb(const struct bt_gatt_attr *attr, void *user_data)
struct bt_conn *conn = att->chan.conn;
int read;
BT_DBG("handle 0x%04x\n", attr->handle);
BT_DBG("handle 0x%04x", attr->handle);
data->rsp = net_buf_add(data->buf, sizeof(*data->rsp));
@ -813,7 +813,7 @@ static uint8_t att_read_req(struct bt_att *att, struct net_buf *buf)
handle = sys_le16_to_cpu(req->handle);
BT_DBG("handle 0x%04x\n", handle);
BT_DBG("handle 0x%04x", handle);
return att_read_rsp(att, BT_ATT_OP_READ_REQ, BT_ATT_OP_READ_RSP,
handle, 0);
@ -829,7 +829,7 @@ static uint8_t att_read_blob_req(struct bt_att *att, struct net_buf *buf)
handle = sys_le16_to_cpu(req->handle);
offset = sys_le16_to_cpu(req->offset);
BT_DBG("handle 0x%04x offset %u\n", handle, offset);
BT_DBG("handle 0x%04x offset %u", handle, offset);
return att_read_rsp(att, BT_ATT_OP_READ_BLOB_REQ,
BT_ATT_OP_READ_BLOB_RSP, handle, offset);
@ -853,7 +853,7 @@ static uint8_t att_read_mult_req(struct bt_att *att, struct net_buf *buf)
while (buf->len >= sizeof(uint16_t)) {
handle = net_buf_pull_le16(buf);
BT_DBG("handle 0x%04x \n", handle);
BT_DBG("handle 0x%04x ", handle);
/* An Error Response shall be sent by the server in response to
* the Read Multiple Request [....] if a read operation is not
@ -904,7 +904,7 @@ static uint8_t read_group_cb(const struct bt_gatt_attr *attr, void *user_data)
return BT_GATT_ITER_CONTINUE;
}
BT_DBG("handle 0x%04x\n", attr->handle);
BT_DBG("handle 0x%04x", attr->handle);
/* Stop if there is no space left */
if (data->rsp->len &&
@ -998,7 +998,7 @@ static uint8_t att_read_group_req(struct bt_att *att, struct net_buf *buf)
return BT_ATT_ERR_UNLIKELY;
}
BT_DBG("start_handle 0x%04x end_handle 0x%04x type %s\n",
BT_DBG("start_handle 0x%04x end_handle 0x%04x type %s",
start_handle, end_handle, bt_uuid_str(&uuid));
if (!range_is_valid(start_handle, end_handle, &err_handle)) {
@ -1039,7 +1039,7 @@ static uint8_t write_cb(const struct bt_gatt_attr *attr, void *user_data)
struct write_data *data = user_data;
int write;
BT_DBG("handle 0x%04x\n", attr->handle);
BT_DBG("handle 0x%04x", attr->handle);
/* Check for write support and flush support in case of prepare */
if (!attr->write ||
@ -1156,7 +1156,7 @@ static uint8_t att_write_req(struct bt_att *att, struct net_buf *buf)
handle = sys_le16_to_cpu(req->handle);
net_buf_pull(buf, sizeof(*req));
BT_DBG("handle 0x%04x\n", handle);
BT_DBG("handle 0x%04x", handle);
return att_write_rsp(conn, BT_ATT_OP_WRITE_REQ, BT_ATT_OP_WRITE_RSP,
handle, 0, buf->data, buf->len);
@ -1174,7 +1174,7 @@ static uint8_t att_prepare_write_req(struct bt_att *att, struct net_buf *buf)
offset = sys_le16_to_cpu(req->offset);
net_buf_pull(buf, sizeof(*req));
BT_DBG("handle 0x%04x offset %u\n", handle, offset);
BT_DBG("handle 0x%04x offset %u", handle, offset);
return att_write_rsp(conn, BT_ATT_OP_PREPARE_WRITE_REQ,
BT_ATT_OP_PREPARE_WRITE_RSP, handle, offset,
@ -1198,7 +1198,7 @@ static uint8_t flush_cb(const struct bt_gatt_attr *attr, void *user_data)
return BT_GATT_ITER_CONTINUE;
}
BT_DBG("handle 0x%04x flags 0x%02x\n", attr->handle, data->flags);
BT_DBG("handle 0x%04x flags 0x%02x", attr->handle, data->flags);
/* Flush attribute any data cached to be written */
err = attr->flush(data->conn, attr, data->flags);
@ -1247,7 +1247,7 @@ static uint8_t att_exec_write_req(struct bt_att *att, struct net_buf *buf)
req = (void *)buf->data;
BT_DBG("flags 0x%02x\n", req->flags);
BT_DBG("flags 0x%02x", req->flags);
return att_exec_write_rsp(conn, req->flags);
}
@ -1267,7 +1267,7 @@ static uint8_t att_write_cmd(struct bt_att *att, struct net_buf *buf)
handle = sys_le16_to_cpu(req->handle);
BT_DBG("handle 0x%04x\n", handle);
BT_DBG("handle 0x%04x", handle);
return att_write_rsp(conn, 0, 0, handle, 0, buf->data, buf->len);
}
@ -1283,13 +1283,13 @@ static uint8_t att_signed_write_cmd(struct bt_att *att, struct net_buf *buf)
handle = sys_le16_to_cpu(req->handle);
BT_DBG("handle 0x%04x\n", handle);
BT_DBG("handle 0x%04x", handle);
/* Verifying data requires full buffer including attribute header */
net_buf_push(buf, sizeof(struct bt_att_hdr));
err = bt_smp_sign_verify(conn, buf);
if (err) {
BT_ERR("Error verifying data\n");
BT_ERR("Error verifying data");
/* No response for this command */
return 0;
}
@ -1334,7 +1334,7 @@ static uint8_t att_error_rsp(struct bt_att *att, struct net_buf *buf)
rsp = (void *)buf->data;
BT_DBG("request 0x%02x handle 0x%04x error 0x%02x\n", rsp->request,
BT_DBG("request 0x%02x handle 0x%04x error 0x%02x", rsp->request,
sys_le16_to_cpu(rsp->handle), rsp->error);
if (!req->buf) {
@ -1364,7 +1364,7 @@ done:
static uint8_t att_handle_find_info_rsp(struct bt_att *att,
struct net_buf *buf)
{
BT_DBG("\n");
BT_DBG("");
return att_handle_rsp(att, buf->data, buf->len, 0);
}
@ -1372,7 +1372,7 @@ static uint8_t att_handle_find_info_rsp(struct bt_att *att,
static uint8_t att_handle_find_type_rsp(struct bt_att *att,
struct net_buf *buf)
{
BT_DBG("\n");
BT_DBG("");
return att_handle_rsp(att, buf->data, buf->len, 0);
}
@ -1380,7 +1380,7 @@ static uint8_t att_handle_find_type_rsp(struct bt_att *att,
static uint8_t att_handle_read_type_rsp(struct bt_att *att,
struct net_buf *buf)
{
BT_DBG("\n");
BT_DBG("");
return att_handle_rsp(att, buf->data, buf->len, 0);
}
@ -1388,7 +1388,7 @@ static uint8_t att_handle_read_type_rsp(struct bt_att *att,
static uint8_t att_handle_read_rsp(struct bt_att *att,
struct net_buf *buf)
{
BT_DBG("\n");
BT_DBG("");
return att_handle_rsp(att, buf->data, buf->len, 0);
}
@ -1396,7 +1396,7 @@ static uint8_t att_handle_read_rsp(struct bt_att *att,
static uint8_t att_handle_read_blob_rsp(struct bt_att *att,
struct net_buf *buf)
{
BT_DBG("\n");
BT_DBG("");
return att_handle_rsp(att, buf->data, buf->len, 0);
}
@ -1404,7 +1404,7 @@ static uint8_t att_handle_read_blob_rsp(struct bt_att *att,
static uint8_t att_handle_read_mult_rsp(struct bt_att *att,
struct net_buf *buf)
{
BT_DBG("\n");
BT_DBG("");
return att_handle_rsp(att, buf->data, buf->len, 0);
}
@ -1412,7 +1412,7 @@ static uint8_t att_handle_read_mult_rsp(struct bt_att *att,
static uint8_t att_handle_write_rsp(struct bt_att *att,
struct net_buf *buf)
{
BT_DBG("\n");
BT_DBG("");
return att_handle_rsp(att, buf->data, buf->len, 0);
}
@ -1420,7 +1420,7 @@ static uint8_t att_handle_write_rsp(struct bt_att *att,
static uint8_t att_handle_prepare_write_rsp(struct bt_att *att,
struct net_buf *buf)
{
BT_DBG("\n");
BT_DBG("");
return att_handle_rsp(att, buf->data, buf->len, 0);
}
@ -1428,7 +1428,7 @@ static uint8_t att_handle_prepare_write_rsp(struct bt_att *att,
static uint8_t att_handle_exec_write_rsp(struct bt_att *att,
struct net_buf *buf)
{
BT_DBG("\n");
BT_DBG("");
return att_handle_rsp(att, buf->data, buf->len, 0);
}
@ -1440,7 +1440,7 @@ static uint8_t att_notify(struct bt_att *att, struct net_buf *buf)
handle = net_buf_pull_le16(buf);
BT_DBG("handle 0x%04x\n", handle);
BT_DBG("handle 0x%04x", handle);
bt_gatt_notification(conn, handle, buf->data, buf->len);
@ -1454,7 +1454,7 @@ static uint8_t att_indicate(struct bt_att *att, struct net_buf *buf)
handle = net_buf_pull_le16(buf);
BT_DBG("handle 0x%04x\n", handle);
BT_DBG("handle 0x%04x", handle);
bt_gatt_notification(conn, handle, buf->data, buf->len);
@ -1535,11 +1535,11 @@ static void bt_att_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
BT_ASSERT(att);
if (buf->len < sizeof(*hdr)) {
BT_ERR("Too small ATT PDU received\n");
BT_ERR("Too small ATT PDU received");
return;
}
BT_DBG("Received ATT code 0x%02x len %u\n", hdr->code, buf->len);
BT_DBG("Received ATT code 0x%02x len %u", hdr->code, buf->len);
net_buf_pull(buf, sizeof(*hdr));
@ -1549,7 +1549,7 @@ static void bt_att_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
}
if (buf->len < handlers[i].expect_len) {
BT_ERR("Invalid len %u for code 0x%02x\n", buf->len,
BT_ERR("Invalid len %u for code 0x%02x", buf->len,
hdr->code);
err = BT_ATT_ERR_INVALID_PDU;
break;
@ -1595,7 +1595,7 @@ struct net_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, size_t len)
}
if (len + sizeof(op) > att->chan.tx.mtu) {
BT_WARN("ATT MTU exceeded, max %u, wanted %u\n",
BT_WARN("ATT MTU exceeded, max %u, wanted %u",
att->chan.tx.mtu, len);
return NULL;
}
@ -1613,7 +1613,7 @@ struct net_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, size_t len)
static void bt_att_connected(struct bt_l2cap_chan *chan)
{
BT_DBG("chan %p cid 0x%04x\n", chan, chan->tx.cid);
BT_DBG("chan %p cid 0x%04x", chan, chan->tx.cid);
chan->tx.mtu = BT_ATT_DEFAULT_LE_MTU;
chan->rx.mtu = BT_ATT_DEFAULT_LE_MTU;
@ -1625,7 +1625,7 @@ static void bt_att_disconnected(struct bt_l2cap_chan *chan)
{
struct bt_att *att = CONTAINER_OF(chan, struct bt_att, chan);
BT_DBG("chan %p cid 0x%04x\n", chan, chan->tx.cid);
BT_DBG("chan %p cid 0x%04x", chan, chan->tx.cid);
memset(att, 0, sizeof(*att));
bt_gatt_disconnected(chan->conn);
@ -1642,13 +1642,13 @@ static void security_changed(struct bt_conn *conn, bt_security_t level)
return;
}
BT_DBG("conn %p level %u\n", conn, level);
BT_DBG("conn %p level %u", conn, level);
req = &att->req;
if (!req->retrying)
return;
BT_DBG("Retrying\n");
BT_DBG("Retrying");
/* Resend buffer */
bt_l2cap_send(conn, BT_L2CAP_CID_ATT, req->buf);
@ -1669,7 +1669,7 @@ static int bt_att_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
.recv = bt_att_recv,
};
BT_DBG("conn %p handle %u\n", conn, conn->handle);
BT_DBG("conn %p handle %u", conn, conn->handle);
for (i = 0; i < ARRAY_SIZE(bt_att_pool); i++) {
struct bt_att *att = &bt_att_pool[i];
@ -1685,7 +1685,7 @@ static int bt_att_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
return 0;
}
BT_ERR("No available ATT context for conn %p\n", conn);
BT_ERR("No available ATT context for conn %p", conn);
return -ENOMEM;
}
@ -1756,7 +1756,7 @@ int bt_att_send(struct bt_conn *conn, struct net_buf *buf, bt_att_func_t func,
err = bt_smp_sign(conn, buf);
if (err) {
BT_ERR("Error signing data\n");
BT_ERR("Error signing data");
return err;
}
}

View file

@ -248,7 +248,7 @@ void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags)
struct bt_l2cap_hdr *hdr;
uint16_t len;
BT_DBG("handle %u len %u flags %02x\n", conn->handle, buf->len, flags);
BT_DBG("handle %u len %u flags %02x", conn->handle, buf->len, flags);
/* Check packet boundary flags */
switch (flags) {
@ -256,15 +256,15 @@ void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags)
hdr = (void *)buf->data;
len = sys_le16_to_cpu(hdr->len);
BT_DBG("First, len %u final %u\n", buf->len, len);
BT_DBG("First, len %u final %u", buf->len, len);
if (conn->rx_len) {
BT_ERR("Unexpected first L2CAP frame\n");
BT_ERR("Unexpected first L2CAP frame");
bt_conn_reset_rx_state(conn);
}
conn->rx_len = (sizeof(*hdr) + len) - buf->len;
BT_DBG("rx_len %u\n", conn->rx_len);
BT_DBG("rx_len %u", conn->rx_len);
if (conn->rx_len) {
conn->rx = buf;
return;
@ -273,23 +273,23 @@ void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags)
break;
case BT_ACL_CONT:
if (!conn->rx_len) {
BT_ERR("Unexpected L2CAP continuation\n");
BT_ERR("Unexpected L2CAP continuation");
bt_conn_reset_rx_state(conn);
net_buf_unref(buf);
return;
}
if (buf->len > conn->rx_len) {
BT_ERR("L2CAP data overflow\n");
BT_ERR("L2CAP data overflow");
bt_conn_reset_rx_state(conn);
net_buf_unref(buf);
return;
}
BT_DBG("Cont, len %u rx_len %u\n", buf->len, conn->rx_len);
BT_DBG("Cont, len %u rx_len %u", buf->len, conn->rx_len);
if (buf->len > net_buf_tailroom(conn->rx)) {
BT_ERR("Not enough buffer space for L2CAP data\n");
BT_ERR("Not enough buffer space for L2CAP data");
bt_conn_reset_rx_state(conn);
net_buf_unref(buf);
return;
@ -309,7 +309,7 @@ void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags)
break;
default:
BT_ERR("Unexpected ACL flags (0x%02x)\n", flags);
BT_ERR("Unexpected ACL flags (0x%02x)", flags);
bt_conn_reset_rx_state(conn);
net_buf_unref(buf);
return;
@ -319,22 +319,22 @@ void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags)
len = sys_le16_to_cpu(hdr->len);
if (sizeof(*hdr) + len != buf->len) {
BT_ERR("ACL len mismatch (%u != %u)\n", len, buf->len);
BT_ERR("ACL len mismatch (%u != %u)", len, buf->len);
net_buf_unref(buf);
return;
}
BT_DBG("Successfully parsed %u byte L2CAP packet\n", buf->len);
BT_DBG("Successfully parsed %u byte L2CAP packet", buf->len);
bt_l2cap_recv(conn, buf);
}
void bt_conn_send(struct bt_conn *conn, struct net_buf *buf)
{
BT_DBG("conn handle %u buf len %u\n", conn->handle, buf->len);
BT_DBG("conn handle %u buf len %u", conn->handle, buf->len);
if (conn->state != BT_CONN_CONNECTED) {
BT_ERR("not connected!\n");
BT_ERR("not connected!");
net_buf_unref(buf);
return;
}
@ -348,7 +348,7 @@ static bool send_frag(struct bt_conn *conn, struct net_buf *buf, uint8_t flags,
struct bt_hci_acl_hdr *hdr;
int err;
BT_DBG("conn %p buf %p len %u flags 0x%02x\n", conn, buf, buf->len,
BT_DBG("conn %p buf %p len %u flags 0x%02x", conn, buf, buf->len,
flags);
/* Wait until the controller can accept ACL packets */
@ -363,10 +363,10 @@ static bool send_frag(struct bt_conn *conn, struct net_buf *buf, uint8_t flags,
hdr->handle = sys_cpu_to_le16(bt_acl_handle_pack(conn->handle, flags));
hdr->len = sys_cpu_to_le16(buf->len - sizeof(*hdr));
BT_DBG("passing buf %p len %u to driver\n", buf, buf->len);
BT_DBG("passing buf %p len %u to driver", buf, buf->len);
err = bt_dev.drv->send(BT_ACL_OUT, buf);
if (err) {
BT_ERR("Unable to send to driver (err %d)\n", err);
BT_ERR("Unable to send to driver (err %d)", err);
goto fail;
}
@ -417,7 +417,7 @@ static bool send_buf(struct bt_conn *conn, struct net_buf *buf)
{
struct net_buf *frag;
BT_DBG("conn %p buf %p len %u\n", conn, buf, buf->len);
BT_DBG("conn %p buf %p len %u", conn, buf, buf->len);
/* Send directly if the packet fits the ACL MTU */
if (buf->len <= conn_mtu(conn)) {
@ -457,7 +457,7 @@ static void conn_tx_fiber(int arg1, int arg2)
struct bt_conn *conn = (struct bt_conn *)arg1;
struct net_buf *buf;
BT_DBG("Started for handle %u\n", conn->handle);
BT_DBG("Started for handle %u", conn->handle);
while (conn->state == BT_CONN_CONNECTED) {
/* Get next ACL packet for connection */
@ -472,7 +472,7 @@ static void conn_tx_fiber(int arg1, int arg2)
}
}
BT_DBG("handle %u disconnected - cleaning up\n", conn->handle);
BT_DBG("handle %u disconnected - cleaning up", conn->handle);
/* Give back any allocated buffers */
while ((buf = nano_fifo_get(&conn->tx_queue))) {
@ -488,7 +488,7 @@ static void conn_tx_fiber(int arg1, int arg2)
bt_conn_reset_rx_state(conn);
BT_DBG("handle %u exiting\n", conn->handle);
BT_DBG("handle %u exiting", conn->handle);
bt_conn_unref(conn);
}
@ -564,10 +564,10 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state)
{
bt_conn_state_t old_state;
BT_DBG("%s -> %s\n", state2str(conn->state), state2str(state));
BT_DBG("%s -> %s", state2str(conn->state), state2str(state));
if (conn->state == state) {
BT_WARN("no transition\n");
BT_WARN("no transition");
return;
}
@ -638,7 +638,7 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state)
case BT_CONN_DISCONNECT:
break;
default:
BT_WARN("no valid (%u) state was set\n", state);
BT_WARN("no valid (%u) state was set", state);
break;
}
@ -711,7 +711,7 @@ struct bt_conn *bt_conn_ref(struct bt_conn *conn)
{
atomic_inc(&conn->ref);
BT_DBG("handle %u ref %u\n", conn->handle, atomic_get(&conn->ref));
BT_DBG("handle %u ref %u", conn->handle, atomic_get(&conn->ref));
return conn;
}
@ -720,7 +720,7 @@ void bt_conn_unref(struct bt_conn *conn)
{
atomic_dec(&conn->ref);
BT_DBG("handle %u ref %u\n", conn->handle, atomic_get(&conn->ref));
BT_DBG("handle %u ref %u", conn->handle, atomic_get(&conn->ref));
}
const bt_addr_le_t *bt_conn_get_dst(const struct bt_conn *conn)

View file

@ -96,7 +96,7 @@ populate:
attrs->_next = &attrs[1];
}
BT_DBG("attr %p next %p handle 0x%04x uuid %s perm 0x%02x\n",
BT_DBG("attr %p next %p handle 0x%04x uuid %s perm 0x%02x",
attrs, attrs->_next, attrs->handle,
bt_uuid_str(attrs->uuid), attrs->perm);
}
@ -116,7 +116,7 @@ int bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
len = min(buf_len, value_len - offset);
BT_DBG("handle 0x%04x offset %u length %u\n", attr->handle, offset,
BT_DBG("handle 0x%04x offset %u length %u", attr->handle, offset,
len);
memcpy(buf, value + offset, len);
@ -199,7 +199,7 @@ int bt_gatt_attr_read_chrc(struct bt_conn *conn,
* Characteristic Value declaration.
*/
if (!attr->_next) {
BT_WARN("Characteritic at 0x%04x don't have descriptor\n",
BT_WARN("Characteritic at 0x%04x don't have descriptor",
attr->handle);
pdu.value_handle = 0x0000;
} else {
@ -272,7 +272,7 @@ static void gatt_ccc_changed(struct _bt_gatt_ccc *ccc)
}
}
BT_DBG("ccc %p value 0x%04x\n", ccc, value);
BT_DBG("ccc %p value 0x%04x", ccc, value);
if (value != ccc->value) {
ccc->value = value;
@ -321,14 +321,14 @@ int bt_gatt_attr_write_ccc(struct bt_conn *conn,
}
if (i == ccc->cfg_len) {
BT_WARN("No space to store CCC cfg\n");
BT_WARN("No space to store CCC cfg");
return -ENOMEM;
}
}
ccc->cfg[i].value = sys_le16_to_cpu(*data);
BT_DBG("handle 0x%04x value %u\n", attr->handle, ccc->cfg[i].value);
BT_DBG("handle 0x%04x value %u", attr->handle, ccc->cfg[i].value);
/* Update cfg if don't match */
if (ccc->cfg[i].value != ccc->value) {
@ -367,7 +367,7 @@ static int att_notify(struct bt_conn *conn, uint16_t handle, const void *data,
return -ENOMEM;
}
BT_DBG("conn %p handle 0x%04x\n", conn, handle);
BT_DBG("conn %p handle 0x%04x", conn, handle);
nfy = net_buf_add(buf, sizeof(*nfy));
nfy->handle = sys_cpu_to_le16(handle);
@ -481,7 +481,7 @@ static uint8_t connected_cb(const struct bt_gatt_attr *attr, void *user_data)
void bt_gatt_connected(struct bt_conn *conn)
{
BT_DBG("conn %p\n", conn);
BT_DBG("conn %p", conn);
bt_gatt_foreach_attr(0x0001, 0xffff, connected_cb, conn);
}
@ -525,7 +525,7 @@ static uint8_t disconnected_cb(const struct bt_gatt_attr *attr, void *user_data)
memset(&ccc->value, 0, sizeof(ccc->value));
ccc->cfg_changed(ccc->value);
BT_DBG("ccc %p reseted\n", ccc);
BT_DBG("ccc %p reseted", ccc);
return BT_GATT_ITER_CONTINUE;
}
@ -536,7 +536,7 @@ void bt_gatt_notification(struct bt_conn *conn, uint16_t handle,
{
struct bt_gatt_subscribe_params *params;
BT_DBG("handle 0x%04x length %u\n", handle, length);
BT_DBG("handle 0x%04x length %u", handle, length);
for (params = subscriptions; params; params = params->_next) {
if (handle != params->value_handle) {
@ -595,7 +595,7 @@ static int gatt_send(struct bt_conn *conn, struct net_buf *buf,
err = bt_att_send(conn, buf, func, user_data, destroy);
if (err) {
BT_ERR("Error sending ATT PDU: %d\n", err);
BT_ERR("Error sending ATT PDU: %d", err);
net_buf_unref(buf);
}
@ -619,7 +619,7 @@ int bt_gatt_exchange_mtu(struct bt_conn *conn, bt_gatt_rsp_func_t func)
mtu = CONFIG_BLUETOOTH_ATT_MTU;
BT_DBG("Client MTU %u\n", mtu);
BT_DBG("Client MTU %u", mtu);
req = net_buf_add(buf, sizeof(*req));
req->mtu = sys_cpu_to_le16(mtu);
@ -637,7 +637,7 @@ static void att_find_type_rsp(struct bt_conn *conn, uint8_t err,
uint8_t i;
uint16_t end_handle = 0, start_handle;
BT_DBG("err 0x%02x\n", err);
BT_DBG("err 0x%02x", err);
if (err) {
goto done;
@ -651,7 +651,7 @@ static void att_find_type_rsp(struct bt_conn *conn, uint8_t err,
start_handle = sys_le16_to_cpu(rsp->list[i].start_handle);
end_handle = sys_le16_to_cpu(rsp->list[i].end_handle);
BT_DBG("start_handle 0x%04x end_handle 0x%04x\n", start_handle,
BT_DBG("start_handle 0x%04x end_handle 0x%04x", start_handle,
end_handle);
value.end_handle = end_handle;
@ -716,7 +716,7 @@ static int att_find_type(struct bt_conn *conn,
req->type = sys_cpu_to_le16(BT_UUID_GATT_SECONDARY);
}
BT_DBG("uuid %s start_handle 0x%04x end_handle 0x%04x\n",
BT_DBG("uuid %s start_handle 0x%04x end_handle 0x%04x",
bt_uuid_str(params->uuid), params->start_handle,
params->end_handle);
@ -731,7 +731,7 @@ static int att_find_type(struct bt_conn *conn,
sizeof(params->uuid->u128));
break;
default:
BT_ERR("Unkown UUID type %u\n", params->uuid->type);
BT_ERR("Unknown UUID type %u", params->uuid->type);
net_buf_unref(buf);
return -EINVAL;
}
@ -761,7 +761,7 @@ static uint16_t parse_include(const void *pdu,
uuid.type = BT_UUID_128;
break;
default:
BT_ERR("Invalid data len %u\n", rsp->len);
BT_ERR("Invalid data len %u", rsp->len);
goto done;
}
@ -839,7 +839,7 @@ static uint16_t parse_characteristic(const void *pdu,
uuid.type = BT_UUID_128;
break;
default:
BT_ERR("Invalid data len %u\n", rsp->len);
BT_ERR("Invalid data len %u", rsp->len);
goto done;
}
@ -865,7 +865,7 @@ static uint16_t parse_characteristic(const void *pdu,
break;
}
BT_DBG("handle 0x%04x uuid %s properties 0x%02x\n", handle,
BT_DBG("handle 0x%04x uuid %s properties 0x%02x", handle,
bt_uuid_str(&uuid), chrc->properties);
/* Skip if UUID is set but doesn't match */
@ -899,7 +899,7 @@ static void att_read_type_rsp(struct bt_conn *conn, uint8_t err,
struct bt_gatt_discover_params *params = user_data;
uint16_t handle;
BT_DBG("err 0x%02x\n", err);
BT_DBG("err 0x%02x", err);
if (err) {
goto done;
@ -959,7 +959,7 @@ static int att_read_type(struct bt_conn *conn,
else
*value = sys_cpu_to_le16(BT_UUID_GATT_CHRC);
BT_DBG("start_handle 0x%04x end_handle 0x%04x\n", params->start_handle,
BT_DBG("start_handle 0x%04x end_handle 0x%04x", params->start_handle,
params->end_handle);
return gatt_send(conn, buf, att_read_type_rsp, params, NULL);
@ -979,7 +979,7 @@ static void att_find_info_rsp(struct bt_conn *conn, uint8_t err,
const struct bt_att_info_128 *i128;
} info;
BT_DBG("err 0x%02x\n", err);
BT_DBG("err 0x%02x", err);
if (err) {
goto done;
@ -996,7 +996,7 @@ static void att_find_info_rsp(struct bt_conn *conn, uint8_t err,
len = sizeof(*info.i128);
break;
default:
BT_ERR("Invalid format %u\n", rsp->format);
BT_ERR("Invalid format %u", rsp->format);
goto done;
}
@ -1017,7 +1017,7 @@ static void att_find_info_rsp(struct bt_conn *conn, uint8_t err,
break;
}
BT_DBG("handle 0x%04x uuid %s\n", handle, bt_uuid_str(&uuid));
BT_DBG("handle 0x%04x uuid %s", handle, bt_uuid_str(&uuid));
/* Skip if UUID is set but doesn't match */
if (params->uuid && bt_uuid_cmp(&uuid, params->uuid)) {
@ -1075,7 +1075,7 @@ static int att_find_info(struct bt_conn *conn,
req->start_handle = sys_cpu_to_le16(params->start_handle);
req->end_handle = sys_cpu_to_le16(params->end_handle);
BT_DBG("start_handle 0x%04x end_handle 0x%04x\n", params->start_handle,
BT_DBG("start_handle 0x%04x end_handle 0x%04x", params->start_handle,
params->end_handle);
return gatt_send(conn, buf, att_find_info_rsp, params, NULL);
@ -1101,7 +1101,7 @@ int bt_gatt_discover(struct bt_conn *conn,
case BT_GATT_DISCOVER_DESCRIPTOR:
return att_find_info(conn, params);
default:
BT_ERR("Invalid discovery type: %u\n", params->type);
BT_ERR("Invalid discovery type: %u", params->type);
}
return -EINVAL;
@ -1112,7 +1112,7 @@ static void att_read_rsp(struct bt_conn *conn, uint8_t err, const void *pdu,
{
struct bt_gatt_read_params *params = user_data;
BT_DBG("err 0x%02x\n", err);
BT_DBG("err 0x%02x", err);
if (err) {
params->func(conn, err, NULL, 0);
@ -1163,7 +1163,7 @@ static int gatt_read_blob(struct bt_conn *conn,
req->handle = sys_cpu_to_le16(params->handle);
req->offset = sys_cpu_to_le16(params->offset);
BT_DBG("handle 0x%04x offset 0x%04x\n", params->handle, params->offset);
BT_DBG("handle 0x%04x offset 0x%04x", params->handle, params->offset);
return gatt_send(conn, buf, att_read_rsp, params, NULL);
}
@ -1190,7 +1190,7 @@ int bt_gatt_read(struct bt_conn *conn, struct bt_gatt_read_params *params)
req = net_buf_add(buf, sizeof(*req));
req->handle = sys_cpu_to_le16(params->handle);
BT_DBG("handle 0x%04x\n", params->handle);
BT_DBG("handle 0x%04x", params->handle);
return gatt_send(conn, buf, att_read_rsp, params, NULL);
}
@ -1200,7 +1200,7 @@ static void att_write_rsp(struct bt_conn *conn, uint8_t err, const void *pdu,
{
bt_gatt_rsp_func_t func = user_data;
BT_DBG("err 0x%02x\n", err);
BT_DBG("err 0x%02x", err);
func(conn, err);
}
@ -1240,7 +1240,7 @@ int bt_gatt_write_without_response(struct bt_conn *conn, uint16_t handle,
memcpy(cmd->value, data, length);
net_buf_add(buf, length);
BT_DBG("handle 0x%04x length %u\n", handle, length);
BT_DBG("handle 0x%04x length %u", handle, length);
return gatt_send(conn, buf, NULL, NULL, NULL);
}
@ -1258,7 +1258,7 @@ static int gatt_exec_write(struct bt_conn *conn, bt_gatt_rsp_func_t func)
req = net_buf_add(buf, sizeof(*req));
req->flags = BT_ATT_FLAG_EXEC;
BT_DBG("\n");
BT_DBG("");
return gatt_send(conn, buf, att_write_rsp, func, NULL);
}
@ -1278,7 +1278,7 @@ static void att_prepare_write_rsp(struct bt_conn *conn, uint8_t err,
struct prepare_write_data *data = user_data;
bt_gatt_rsp_func_t func = data->func;
BT_DBG("err 0x%02x\n", err);
BT_DBG("err 0x%02x", err);
/* Reset func so next prepare don't fail */
data->func = NULL;
@ -1333,7 +1333,7 @@ static int gatt_prepare_write(struct bt_conn *conn, uint16_t handle,
memcpy(req->value, data, len);
net_buf_add(buf, len);
BT_DBG("handle 0x%04x offset %u len %u\n", handle, offset, len);
BT_DBG("handle 0x%04x offset %u len %u", handle, offset, len);
return gatt_send(conn, buf, att_prepare_write_rsp, &prep_data, NULL);
}
@ -1365,7 +1365,7 @@ int bt_gatt_write(struct bt_conn *conn, uint16_t handle, uint16_t offset,
memcpy(req->value, data, length);
net_buf_add(buf, length);
BT_DBG("handle 0x%04x length %u\n", handle, length);
BT_DBG("handle 0x%04x length %u", handle, length);
return gatt_send(conn, buf, att_write_rsp, func, NULL);
}
@ -1385,7 +1385,7 @@ static void att_write_ccc_rsp(struct bt_conn *conn, uint8_t err,
{
struct bt_gatt_subscribe_params *params = user_data;
BT_DBG("err 0x%02x\n", err);
BT_DBG("err 0x%02x", err);
params->func(conn, err, NULL, 0);
@ -1415,7 +1415,7 @@ static int gatt_write_ccc(struct bt_conn *conn, uint16_t handle, uint16_t value,
req->handle = sys_cpu_to_le16(handle);
net_buf_add_le16(buf, value);
BT_DBG("handle 0x%04x value 0x%04x\n", handle, value);
BT_DBG("handle 0x%04x value 0x%04x", handle, value);
return gatt_send(conn, buf, func, params, NULL);
}
@ -1520,7 +1520,7 @@ static void att_read_multiple_rsp(struct bt_conn *conn, uint8_t err,
{
bt_gatt_read_func_t func = user_data;
BT_DBG("err 0x%02x\n", err);
BT_DBG("err 0x%02x", err);
if (err) {
func(conn, err, NULL, 0);
@ -1560,7 +1560,7 @@ int bt_gatt_read_multiple(struct bt_conn *conn, const uint16_t *handles,
void bt_gatt_disconnected(struct bt_conn *conn)
{
BT_DBG("conn %p\n", conn);
BT_DBG("conn %p", conn);
bt_gatt_foreach_attr(0x0001, 0xffff, disconnected_cb, conn);
#if defined(CONFIG_BLUETOOTH_GATT_CLIENT)

View file

@ -104,14 +104,14 @@ static void report_completed_packet(struct net_buf *buf)
uint16_t handle = acl(buf)->handle;
struct bt_hci_handle_count *hc;
BT_DBG("Reporting completed packet for handle %u\n", handle);
BT_DBG("Reporting completed packet for handle %u", handle);
nano_fifo_put(buf->free, buf);
buf = bt_hci_cmd_create(BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS,
sizeof(*cp) + sizeof(*hc));
if (!buf) {
BT_ERR("Unable to allocate new HCI command\n");
BT_ERR("Unable to allocate new HCI command");
return;
}
@ -175,15 +175,15 @@ struct net_buf *bt_hci_cmd_create(uint16_t opcode, uint8_t param_len)
struct bt_hci_cmd_hdr *hdr;
struct net_buf *buf;
BT_DBG("opcode %x param_len %u\n", opcode, param_len);
BT_DBG("opcode %x param_len %u", opcode, param_len);
buf = net_buf_get(&avail_hci_cmd, CONFIG_BLUETOOTH_HCI_SEND_RESERVE);
if (!buf) {
BT_ERR("Cannot get free buffer\n");
BT_ERR("Cannot get free buffer");
return NULL;
}
BT_DBG("buf %p\n", buf);
BT_DBG("buf %p", buf);
cmd(buf)->opcode = opcode;
cmd(buf)->sync = NULL;
@ -204,7 +204,7 @@ int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf)
}
}
BT_DBG("opcode %x len %u\n", opcode, buf->len);
BT_DBG("opcode %x len %u", opcode, buf->len);
/* Host Number of Completed Packets can ignore the ncmd value
* and does not generate any cmd complete/status events.
@ -214,7 +214,7 @@ int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf)
err = bt_dev.drv->send(BT_CMD, buf);
if (err) {
BT_ERR("Unable to send to driver (err %d)\n", err);
BT_ERR("Unable to send to driver (err %d)", err);
net_buf_unref(buf);
}
@ -239,7 +239,7 @@ int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf,
}
}
BT_DBG("opcode %x len %u\n", opcode, buf->len);
BT_DBG("opcode %x len %u", opcode, buf->len);
nano_sem_init(&sync_sem);
cmd(buf)->sync = &sync_sem;
@ -310,7 +310,7 @@ static const bt_addr_le_t *find_id_addr(const bt_addr_le_t *addr)
keys = bt_keys_find_irk(addr);
if (keys) {
BT_DBG("Identity %s matched RPA %s\n",
BT_DBG("Identity %s matched RPA %s",
bt_addr_le_str(&keys->addr), bt_addr_le_str(addr));
return &keys->addr;
}
@ -326,7 +326,7 @@ static void hci_acl(struct net_buf *buf)
struct bt_conn *conn;
uint8_t flags;
BT_DBG("buf %p\n", buf);
BT_DBG("buf %p", buf);
handle = sys_le16_to_cpu(hdr->handle);
flags = bt_acl_flags(handle);
@ -335,17 +335,17 @@ static void hci_acl(struct net_buf *buf)
net_buf_pull(buf, sizeof(*hdr));
BT_DBG("handle %u len %u flags %u\n", acl(buf)->handle, len, flags);
BT_DBG("handle %u len %u flags %u", acl(buf)->handle, len, flags);
if (buf->len != len) {
BT_ERR("ACL data length mismatch (%u != %u)\n", buf->len, len);
BT_ERR("ACL data length mismatch (%u != %u)", buf->len, len);
net_buf_unref(buf);
return;
}
conn = bt_conn_lookup_handle(acl(buf)->handle);
if (!conn) {
BT_ERR("Unable to find conn for handle %u\n", acl(buf)->handle);
BT_ERR("Unable to find conn for handle %u", acl(buf)->handle);
net_buf_unref(buf);
return;
}
@ -359,7 +359,7 @@ static void hci_num_completed_packets(struct net_buf *buf)
struct bt_hci_evt_num_completed_packets *evt = (void *)buf->data;
uint16_t i, num_handles = sys_le16_to_cpu(evt->num_handles);
BT_DBG("num_handles %u\n", num_handles);
BT_DBG("num_handles %u", num_handles);
for (i = 0; i < num_handles; i++) {
uint16_t handle, count;
@ -368,19 +368,19 @@ static void hci_num_completed_packets(struct net_buf *buf)
handle = sys_le16_to_cpu(evt->h[i].handle);
count = sys_le16_to_cpu(evt->h[i].count);
BT_DBG("handle %u count %u\n", handle, count);
BT_DBG("handle %u count %u", handle, count);
conn = bt_conn_lookup_handle(handle);
if (!conn) {
BT_ERR("No connection for handle %u\n", handle);
BT_ERR("No connection for handle %u", handle);
continue;
}
if (conn->pending_pkts >= count) {
conn->pending_pkts -= count;
} else {
BT_ERR("completed packets mismatch: %u > %u\n",
count, conn->pending_pkts);
BT_ERR("completed packets mismatch: %u > %u",
count, conn->pending_pkts);
conn->pending_pkts = 0;
}
@ -420,7 +420,7 @@ static void hci_disconn_complete(struct net_buf *buf)
uint16_t handle = sys_le16_to_cpu(evt->handle);
struct bt_conn *conn;
BT_DBG("status %u handle %u reason %u\n", evt->status, handle,
BT_DBG("status %u handle %u reason %u", evt->status, handle,
evt->reason);
if (evt->status) {
@ -429,7 +429,7 @@ static void hci_disconn_complete(struct net_buf *buf)
conn = bt_conn_lookup_handle(handle);
if (!conn) {
BT_ERR("Unable to look up conn with handle %u\n", handle);
BT_ERR("Unable to look up conn with handle %u", handle);
return;
}
@ -483,7 +483,7 @@ static int hci_le_read_remote_features(struct bt_conn *conn)
static int update_conn_params(struct bt_conn *conn)
{
BT_DBG("conn %p features 0x%x\n", conn, conn->le.features[0]);
BT_DBG("conn %p features 0x%x", conn, conn->le.features[0]);
/* Check if there's a need to update conn params */
if (conn->le.conn_interval >= LE_CONN_MIN_INTERVAL &&
@ -515,7 +515,7 @@ static void le_conn_complete(struct net_buf *buf)
bt_addr_le_t src;
int err;
BT_DBG("status %u handle %u role %u %s\n", evt->status, handle,
BT_DBG("status %u handle %u role %u %s", evt->status, handle,
evt->role, bt_addr_le_str(&evt->peer_addr));
id_addr = find_id_addr(&evt->peer_addr);
@ -546,7 +546,7 @@ static void le_conn_complete(struct net_buf *buf)
}
if (!conn) {
BT_ERR("Unable to add new conn for handle %u\n", handle);
BT_ERR("Unable to add new conn for handle %u", handle);
return;
}
@ -594,7 +594,7 @@ static void le_remote_feat_complete(struct net_buf *buf)
conn = bt_conn_lookup_handle(handle);
if (!conn) {
BT_ERR("Unable to lookup conn for handle %u\n", handle);
BT_ERR("Unable to lookup conn for handle %u", handle);
return;
}
@ -663,7 +663,7 @@ static int le_conn_param_req(struct net_buf *buf)
conn = bt_conn_lookup_handle(handle);
if (!conn) {
BT_ERR("Unable to lookup conn for handle %u\n", handle);
BT_ERR("Unable to lookup conn for handle %u", handle);
return le_conn_param_neg_reply(handle,
BT_HCI_ERR_UNKNOWN_CONN_ID);
}
@ -687,11 +687,11 @@ static void le_conn_update_complete(struct net_buf *buf)
handle = sys_le16_to_cpu(evt->handle);
interval = sys_le16_to_cpu(evt->interval);
BT_DBG("status %u, handle %u\n", evt->status, handle);
BT_DBG("status %u, handle %u", evt->status, handle);
conn = bt_conn_lookup_handle(handle);
if (!conn) {
BT_ERR("Unable to lookup conn for handle %u\n", handle);
BT_ERR("Unable to lookup conn for handle %u", handle);
return;
}
@ -787,7 +787,7 @@ static void update_sec_level(struct bt_conn *conn)
}
if (conn->required_sec_level > conn->sec_level) {
BT_ERR("Failed to set required security level\n");
BT_ERR("Failed to set required security level");
bt_conn_disconnect(conn, BT_HCI_ERR_AUTHENTICATION_FAIL);
}
}
@ -798,12 +798,12 @@ static void hci_encrypt_change(struct net_buf *buf)
uint16_t handle = sys_le16_to_cpu(evt->handle);
struct bt_conn *conn;
BT_DBG("status %u handle %u encrypt 0x%02x\n", evt->status, handle,
BT_DBG("status %u handle %u encrypt 0x%02x", evt->status, handle,
evt->encrypt);
conn = bt_conn_lookup_handle(handle);
if (!conn) {
BT_ERR("Unable to look up conn with handle %u\n", handle);
BT_ERR("Unable to look up conn with handle %u", handle);
return;
}
@ -842,7 +842,7 @@ static void hci_encrypt_key_refresh_complete(struct net_buf *buf)
handle = sys_le16_to_cpu(evt->handle);
BT_DBG("status %u handle %u\n", evt->status, handle);
BT_DBG("status %u handle %u", evt->status, handle);
if (evt->status) {
return;
@ -850,7 +850,7 @@ static void hci_encrypt_key_refresh_complete(struct net_buf *buf)
conn = bt_conn_lookup_handle(handle);
if (!conn) {
BT_ERR("Unable to look up conn with handle %u\n", handle);
BT_ERR("Unable to look up conn with handle %u", handle);
return;
}
@ -869,11 +869,11 @@ static void le_ltk_request(struct net_buf *buf)
handle = sys_le16_to_cpu(evt->handle);
BT_DBG("handle %u\n", handle);
BT_DBG("handle %u", handle);
conn = bt_conn_lookup_handle(handle);
if (!conn) {
BT_ERR("Unable to lookup conn for handle %u\n", handle);
BT_ERR("Unable to lookup conn for handle %u", handle);
return;
}
@ -889,7 +889,7 @@ static void le_ltk_request(struct net_buf *buf)
buf = bt_hci_cmd_create(BT_HCI_OP_LE_LTK_REQ_REPLY,
sizeof(*cp));
if (!buf) {
BT_ERR("Out of command buffers\n");
BT_ERR("Out of command buffers");
goto done;
}
@ -916,7 +916,7 @@ static void le_ltk_request(struct net_buf *buf)
buf = bt_hci_cmd_create(BT_HCI_OP_LE_LTK_REQ_REPLY,
sizeof(*cp));
if (!buf) {
BT_ERR("Out of command buffers\n");
BT_ERR("Out of command buffers");
goto done;
}
@ -939,7 +939,7 @@ static void le_ltk_request(struct net_buf *buf)
buf = bt_hci_cmd_create(BT_HCI_OP_LE_LTK_REQ_REPLY,
sizeof(*cp));
if (!buf) {
BT_ERR("Out of command buffers\n");
BT_ERR("Out of command buffers");
goto done;
}
@ -961,7 +961,7 @@ static void le_ltk_request(struct net_buf *buf)
buf = bt_hci_cmd_create(BT_HCI_OP_LE_LTK_REQ_NEG_REPLY,
sizeof(*cp));
if (!buf) {
BT_ERR("Out of command buffers\n");
BT_ERR("Out of command buffers");
goto done;
}
@ -981,7 +981,7 @@ static void le_pkey_complete(struct net_buf *buf)
{
struct bt_hci_evt_le_p256_public_key_complete *evt = (void *)buf->data;
BT_DBG("status: 0x%x\n", evt->status);
BT_DBG("status: 0x%x", evt->status);
if (evt->status) {
return;
@ -999,7 +999,7 @@ static void le_dhkey_complete(struct net_buf *buf)
{
struct bt_hci_evt_le_generate_dhkey_complete *evt = (void *)buf->data;
BT_DBG("status: 0x%x\n", evt->status);
BT_DBG("status: 0x%x", evt->status);
if (evt->status) {
bt_smp_dhkey_ready(NULL);
@ -1015,7 +1015,7 @@ static void hci_reset_complete(struct net_buf *buf)
{
uint8_t status = buf->data[0];
BT_DBG("status %u\n", status);
BT_DBG("status %u", status);
if (status) {
return;
@ -1035,7 +1035,7 @@ static void hci_cmd_done(uint16_t opcode, uint8_t status, struct net_buf *buf)
}
if (cmd(sent)->opcode != opcode) {
BT_ERR("Unexpected completion of opcode 0x%04x\n", opcode);
BT_ERR("Unexpected completion of opcode 0x%04x", opcode);
return;
}
@ -1063,7 +1063,7 @@ static void hci_cmd_complete(struct net_buf *buf)
uint16_t opcode = sys_le16_to_cpu(evt->opcode);
uint8_t *status;
BT_DBG("opcode %x\n", opcode);
BT_DBG("opcode %x", opcode);
net_buf_pull(buf, sizeof(*evt));
@ -1077,7 +1077,7 @@ static void hci_cmd_complete(struct net_buf *buf)
hci_reset_complete(buf);
break;
default:
BT_DBG("Unhandled opcode %x\n", opcode);
BT_DBG("Unhandled opcode %x", opcode);
break;
}
@ -1095,13 +1095,13 @@ static void hci_cmd_status(struct net_buf *buf)
struct bt_hci_evt_cmd_status *evt = (void *)buf->data;
uint16_t opcode = sys_le16_to_cpu(evt->opcode);
BT_DBG("opcode %x\n", opcode);
BT_DBG("opcode %x", opcode);
net_buf_pull(buf, sizeof(*evt));
switch (opcode) {
default:
BT_DBG("Unhandled opcode %x\n", opcode);
BT_DBG("Unhandled opcode %x", opcode);
break;
}
@ -1208,7 +1208,7 @@ static void le_adv_report(struct net_buf *buf)
uint8_t num_reports = buf->data[0];
struct bt_hci_ev_le_advertising_info *info;
BT_DBG("Adv number of reports %u\n", num_reports);
BT_DBG("Adv number of reports %u", num_reports);
info = net_buf_pull(buf, sizeof(num_reports));
@ -1216,9 +1216,9 @@ static void le_adv_report(struct net_buf *buf)
int8_t rssi = info->data[info->length];
const bt_addr_le_t *addr;
BT_DBG("%s event %u, len %u, rssi %d dBm\n",
bt_addr_le_str(&info->addr),
info->evt_type, info->length, rssi);
BT_DBG("%s event %u, len %u, rssi %d dBm",
bt_addr_le_str(&info->addr),
info->evt_type, info->length, rssi);
addr = find_id_addr(&info->addr);
@ -1277,7 +1277,7 @@ static void hci_le_meta_event(struct net_buf *buf)
le_adv_report(buf);
break;
default:
BT_DBG("Unhandled LE event %x\n", evt->subevent);
BT_DBG("Unhandled LE event %x", evt->subevent);
break;
}
}
@ -1286,7 +1286,7 @@ static void hci_event(struct net_buf *buf)
{
struct bt_hci_evt_hdr *hdr = (void *)buf->data;
BT_DBG("event %u\n", hdr->evt);
BT_DBG("event %u", hdr->evt);
net_buf_pull(buf, sizeof(*hdr));
@ -1308,7 +1308,7 @@ static void hci_event(struct net_buf *buf)
hci_le_meta_event(buf);
break;
default:
BT_WARN("Unhandled event 0x%02x\n", hdr->evt);
BT_WARN("Unhandled event 0x%02x", hdr->evt);
break;
}
@ -1320,36 +1320,36 @@ static void hci_cmd_tx_fiber(void)
{
struct bt_driver *drv = bt_dev.drv;
BT_DBG("started\n");
BT_DBG("started");
while (1) {
struct net_buf *buf;
int err;
/* Wait until ncmd > 0 */
BT_DBG("calling sem_take_wait\n");
BT_DBG("calling sem_take_wait");
nano_fiber_sem_take_wait(&bt_dev.ncmd_sem);
/* Get next command - wait if necessary */
BT_DBG("calling fifo_get_wait\n");
BT_DBG("calling fifo_get_wait");
buf = nano_fifo_get_wait(&bt_dev.cmd_tx_queue);
bt_dev.ncmd = 0;
/* Clear out any existing sent command */
if (bt_dev.sent_cmd) {
BT_ERR("Uncleared pending sent_cmd\n");
BT_ERR("Uncleared pending sent_cmd");
net_buf_unref(bt_dev.sent_cmd);
bt_dev.sent_cmd = NULL;
}
bt_dev.sent_cmd = net_buf_ref(buf);
BT_DBG("Sending command %x (buf %p) to driver\n",
BT_DBG("Sending command %x (buf %p) to driver",
cmd(buf)->opcode, buf);
err = drv->send(BT_CMD, buf);
if (err) {
BT_ERR("Unable to send to driver (err %d)\n", err);
BT_ERR("Unable to send to driver (err %d)", err);
nano_fiber_sem_give(&bt_dev.ncmd_sem);
net_buf_unref(bt_dev.sent_cmd);
bt_dev.sent_cmd = NULL;
@ -1362,18 +1362,18 @@ static void rx_prio_fiber(void)
{
struct net_buf *buf;
BT_DBG("started\n");
BT_DBG("started");
while (1) {
struct bt_hci_evt_hdr *hdr;
BT_DBG("calling fifo_get_wait\n");
BT_DBG("calling fifo_get_wait");
buf = nano_fifo_get_wait(&bt_dev.rx_prio_queue);
BT_DBG("buf %p type %u len %u\n", buf, bt_type(buf), buf->len);
BT_DBG("buf %p type %u len %u", buf, bt_type(buf), buf->len);
if (bt_type(buf) != BT_EVT) {
BT_ERR("Unknown buf type %u\n", bt_type(buf));
BT_ERR("Unknown buf type %u", bt_type(buf));
net_buf_unref(buf);
continue;
}
@ -1394,7 +1394,7 @@ static void rx_prio_fiber(void)
break;
#endif /* CONFIG_BLUETOOTH_CONN */
default:
BT_ERR("Unknown event 0x%02x\n", hdr->evt);
BT_ERR("Unknown event 0x%02x", hdr->evt);
break;
}
@ -1406,7 +1406,7 @@ static void read_local_features_complete(struct net_buf *buf)
{
struct bt_hci_rp_read_local_features *rp = (void *)buf->data;
BT_DBG("status %u\n", rp->status);
BT_DBG("status %u", rp->status);
memcpy(bt_dev.features, rp->features, sizeof(bt_dev.features));
}
@ -1415,7 +1415,7 @@ static void read_local_ver_complete(struct net_buf *buf)
{
struct bt_hci_rp_read_local_version_info *rp = (void *)buf->data;
BT_DBG("status %u\n", rp->status);
BT_DBG("status %u", rp->status);
bt_dev.hci_version = rp->hci_version;
bt_dev.hci_revision = sys_le16_to_cpu(rp->hci_revision);
@ -1426,7 +1426,7 @@ static void read_bdaddr_complete(struct net_buf *buf)
{
struct bt_hci_rp_read_bd_addr *rp = (void *)buf->data;
BT_DBG("status %u\n", rp->status);
BT_DBG("status %u", rp->status);
bt_addr_copy(&bt_dev.bdaddr, &rp->bdaddr);
}
@ -1435,7 +1435,7 @@ static void read_le_features_complete(struct net_buf *buf)
{
struct bt_hci_rp_le_read_local_features *rp = (void *)buf->data;
BT_DBG("status %u\n", rp->status);
BT_DBG("status %u", rp->status);
memcpy(bt_dev.le.features, rp->features, sizeof(bt_dev.le.features));
}
@ -1457,12 +1457,12 @@ static void read_buffer_size_complete(struct net_buf *buf)
struct bt_hci_rp_read_buffer_size *rp = (void *)buf->data;
uint16_t pkts;
BT_DBG("status %u\n", rp->status);
BT_DBG("status %u", rp->status);
bt_dev.br.mtu = sys_le16_to_cpu(rp->acl_max_len);
pkts = sys_le16_to_cpu(rp->acl_max_num);
BT_DBG("ACL BR/EDR buffers: pkts %u mtu %u\n", pkts, bt_dev.br.mtu);
BT_DBG("ACL BR/EDR buffers: pkts %u mtu %u", pkts, bt_dev.br.mtu);
init_sem(&bt_dev.br.pkts, pkts);
}
@ -1472,7 +1472,7 @@ static void read_buffer_size_complete(struct net_buf *buf)
struct bt_hci_rp_read_buffer_size *rp = (void *)buf->data;
uint16_t pkts;
BT_DBG("status %u\n", rp->status);
BT_DBG("status %u", rp->status);
/* If LE-side has buffers we can ignore the BR/EDR values */
if (bt_dev.le.mtu) {
@ -1482,7 +1482,7 @@ static void read_buffer_size_complete(struct net_buf *buf)
bt_dev.le.mtu = sys_le16_to_cpu(rp->acl_max_len);
pkts = sys_le16_to_cpu(rp->acl_max_num);
BT_DBG("ACL BR/EDR buffers: pkts %u mtu %u\n", pkts, bt_dev.le.mtu);
BT_DBG("ACL BR/EDR buffers: pkts %u mtu %u", pkts, bt_dev.le.mtu);
init_sem(&bt_dev.le.pkts, pkts);
}
@ -1492,13 +1492,13 @@ static void le_read_buffer_size_complete(struct net_buf *buf)
{
struct bt_hci_rp_le_read_buffer_size *rp = (void *)buf->data;
BT_DBG("status %u\n", rp->status);
BT_DBG("status %u", rp->status);
bt_dev.le.mtu = sys_le16_to_cpu(rp->le_max_len);
if (bt_dev.le.mtu) {
init_sem(&bt_dev.le.pkts, rp->le_max_num);
BT_DBG("ACL LE buffers: pkts %u mtu %u\n", rp->le_max_num,
BT_DBG("ACL LE buffers: pkts %u mtu %u", rp->le_max_num,
bt_dev.le.mtu);
}
}
@ -1507,7 +1507,7 @@ static void read_supported_commands_complete(struct net_buf *buf)
{
struct bt_hci_rp_read_supported_commands *rp = (void *)buf->data;
BT_DBG("status %u\n", rp->status);
BT_DBG("status %u", rp->status);
memcpy(bt_dev.supported_commands, rp->commands,
sizeof(bt_dev.supported_commands));
@ -1569,7 +1569,7 @@ static int le_init(void)
/* For now we only support LE capable controllers */
if (!lmp_le_capable(bt_dev)) {
BT_ERR("Non-LE capable controller detected!\n");
BT_ERR("Non-LE capable controller detected!");
return -ENODEV;
}
@ -1772,7 +1772,7 @@ static int hci_init(void)
return err;
}
} else {
BT_DBG("Non-BR/EDR controller detected! Skipping BR init.\n");
BT_DBG("Non-BR/EDR controller detected! Skipping BR init.");
}
err = set_event_mask();
@ -1780,7 +1780,7 @@ static int hci_init(void)
return err;
}
BT_DBG("HCI ver %u rev %u, manufacturer %u\n", bt_dev.hci_version,
BT_DBG("HCI ver %u rev %u, manufacturer %u", bt_dev.hci_version,
bt_dev.hci_revision, bt_dev.manufacturer);
return 0;
@ -1792,7 +1792,7 @@ void bt_recv(struct net_buf *buf)
{
struct bt_hci_evt_hdr *hdr;
BT_DBG("buf %p len %u\n", buf, buf->len);
BT_DBG("buf %p len %u", buf, buf->len);
if (bt_type(buf) == BT_ACL_IN) {
nano_fifo_put(&bt_dev.rx_queue, buf);
@ -1800,7 +1800,7 @@ void bt_recv(struct net_buf *buf)
}
if (bt_type(buf) != BT_EVT) {
BT_ERR("Invalid buf type %u\n", bt_type(buf));
BT_ERR("Invalid buf type %u", bt_type(buf));
net_buf_unref(buf);
return;
}
@ -1846,7 +1846,7 @@ static int bt_init(void)
err = drv->open();
if (err) {
BT_ERR("HCI driver open failed (%d)\n", err);
BT_ERR("HCI driver open failed (%d)", err);
return err;
}
@ -1865,17 +1865,17 @@ static void hci_rx_fiber(bt_ready_cb_t ready_cb)
{
struct net_buf *buf;
BT_DBG("started\n");
BT_DBG("started");
if (ready_cb) {
ready_cb(bt_init());
}
while (1) {
BT_DBG("calling fifo_get_wait\n");
BT_DBG("calling fifo_get_wait");
buf = nano_fifo_get_wait(&bt_dev.rx_queue);
BT_DBG("buf %p type %u len %u\n", buf, bt_type(buf), buf->len);
BT_DBG("buf %p type %u len %u", buf, bt_type(buf), buf->len);
switch (bt_type(buf)) {
#if defined(CONFIG_BLUETOOTH_CONN)
@ -1887,7 +1887,7 @@ static void hci_rx_fiber(bt_ready_cb_t ready_cb)
hci_event(buf);
break;
default:
BT_ERR("Unknown buf type %u\n", bt_type(buf));
BT_ERR("Unknown buf type %u", bt_type(buf));
net_buf_unref(buf);
break;
}
@ -1898,7 +1898,7 @@ static void hci_rx_fiber(bt_ready_cb_t ready_cb)
int bt_enable(bt_ready_cb_t cb)
{
if (!bt_dev.drv) {
BT_ERR("No HCI driver registered\n");
BT_ERR("No HCI driver registered");
return -ENODEV;
}

View file

@ -41,7 +41,7 @@ struct bt_keys *bt_keys_get_addr(const bt_addr_le_t *addr)
struct bt_keys *keys;
int i;
BT_DBG("%s\n", bt_addr_le_str(addr));
BT_DBG("%s", bt_addr_le_str(addr));
for (i = 0; i < ARRAY_SIZE(key_pool); i++) {
keys = &key_pool[i];
@ -52,20 +52,20 @@ struct bt_keys *bt_keys_get_addr(const bt_addr_le_t *addr)
if (!bt_addr_le_cmp(&keys->addr, BT_ADDR_LE_ANY)) {
bt_addr_le_copy(&keys->addr, addr);
BT_DBG("created %p for %s\n", keys,
BT_DBG("created %p for %s", keys,
bt_addr_le_str(addr));
return keys;
}
}
BT_DBG("unable to create keys for %s\n", bt_addr_le_str(addr));
BT_DBG("unable to create keys for %s", bt_addr_le_str(addr));
return NULL;
}
void bt_keys_clear(struct bt_keys *keys, int type)
{
BT_DBG("keys for %s type %d\n", bt_addr_le_str(&keys->addr), type);
BT_DBG("keys for %s type %d", bt_addr_le_str(&keys->addr), type);
keys->keys &= ~type;
@ -78,7 +78,7 @@ struct bt_keys *bt_keys_find(int type, const bt_addr_le_t *addr)
{
int i;
BT_DBG("type %d %s\n", type, bt_addr_le_str(addr));
BT_DBG("type %d %s", type, bt_addr_le_str(addr));
for (i = 0; i < ARRAY_SIZE(key_pool); i++) {
if ((key_pool[i].keys & type) &&
@ -99,7 +99,7 @@ struct bt_keys *bt_keys_get_type(int type, const bt_addr_le_t *addr)
{
struct bt_keys *keys;
BT_DBG("type %d %s\n", type, bt_addr_le_str(addr));
BT_DBG("type %d %s", type, bt_addr_le_str(addr));
keys = bt_keys_find(type, addr);
if (keys) {
@ -120,7 +120,7 @@ struct bt_keys *bt_keys_find_irk(const bt_addr_le_t *addr)
{
int i;
BT_DBG("%s\n", bt_addr_le_str(addr));
BT_DBG("%s", bt_addr_le_str(addr));
if (!bt_addr_le_is_rpa(addr)) {
return NULL;
@ -133,7 +133,7 @@ struct bt_keys *bt_keys_find_irk(const bt_addr_le_t *addr)
if (!bt_addr_cmp((bt_addr_t *)addr->val,
&key_pool[i].irk.rpa)) {
BT_DBG("cached RPA %s for %s\n",
BT_DBG("cached RPA %s for %s",
bt_addr_str(&key_pool[i].irk.rpa),
bt_addr_le_str(&key_pool[i].addr));
return &key_pool[i];
@ -147,7 +147,7 @@ struct bt_keys *bt_keys_find_irk(const bt_addr_le_t *addr)
if (bt_smp_irk_matches(key_pool[i].irk.val,
(bt_addr_t *)addr->val)) {
BT_DBG("RPA %s matches %s\n",
BT_DBG("RPA %s matches %s",
bt_addr_str(&key_pool[i].irk.rpa),
bt_addr_le_str(&key_pool[i].addr));
@ -158,7 +158,7 @@ struct bt_keys *bt_keys_find_irk(const bt_addr_le_t *addr)
}
}
BT_DBG("No IRK for %s\n", bt_addr_le_str(addr));
BT_DBG("No IRK for %s", bt_addr_le_str(addr));
return NULL;
}
@ -167,7 +167,7 @@ struct bt_keys *bt_keys_find_addr(const bt_addr_le_t *addr)
{
int i;
BT_DBG("%s\n", bt_addr_le_str(addr));
BT_DBG("%s", bt_addr_le_str(addr));
for (i = 0; i < ARRAY_SIZE(key_pool); i++) {
if (!bt_addr_le_cmp(&key_pool[i].addr, addr)) {

View file

@ -121,7 +121,7 @@ static uint8_t get_ident(struct bt_conn *conn)
void bt_l2cap_fixed_chan_register(struct bt_l2cap_fixed_chan *chan)
{
BT_DBG("CID 0x%04x\n", chan->cid);
BT_DBG("CID 0x%04x", chan->cid);
chan->_next = channels;
channels = chan;
@ -154,7 +154,7 @@ static int l2cap_chan_add(struct bt_conn *conn, struct bt_l2cap_chan *chan)
l2cap_chan_alloc_cid(conn, chan);
if (!chan->rx.cid) {
BT_ERR("Unable to allocate L2CAP CID\n");
BT_ERR("Unable to allocate L2CAP CID");
return -ENOMEM;
}
@ -163,7 +163,7 @@ static int l2cap_chan_add(struct bt_conn *conn, struct bt_l2cap_chan *chan)
conn->channels = chan;
chan->conn = conn;
BT_DBG("conn %p chan %p cid 0x%04x\n", conn, chan, chan->rx.cid);
BT_DBG("conn %p chan %p cid 0x%04x", conn, chan, chan->rx.cid);
return 0;
}
@ -265,11 +265,11 @@ static void le_conn_param_rsp(struct bt_l2cap *l2cap, struct net_buf *buf)
struct bt_l2cap_conn_param_rsp *rsp = (void *)buf->data;
if (buf->len < sizeof(*rsp)) {
BT_ERR("Too small LE conn param rsp\n");
BT_ERR("Too small LE conn param rsp");
return;
}
BT_DBG("LE conn param rsp result %u\n", sys_le16_to_cpu(rsp->result));
BT_DBG("LE conn param rsp result %u", sys_le16_to_cpu(rsp->result));
}
#if defined(CONFIG_BLUETOOTH_CENTRAL)
@ -284,7 +284,7 @@ static void le_conn_param_update_req(struct bt_l2cap *l2cap, uint8_t ident,
struct bt_l2cap_conn_param_req *req = (void *)buf->data;
if (buf->len < sizeof(*req)) {
BT_ERR("Too small LE conn update param req\n");
BT_ERR("Too small LE conn update param req");
return;
}
@ -351,11 +351,11 @@ int bt_l2cap_server_register(struct bt_l2cap_server *server)
/* Check if given PSM is already in use */
if (l2cap_server_lookup_psm(server->psm)) {
BT_DBG("PSM already registered\n");
BT_DBG("PSM already registered");
return -EADDRINUSE;
}
BT_DBG("PSM 0x%04x\n", server->psm);
BT_DBG("PSM 0x%04x", server->psm);
server->_next = servers;
servers = server;
@ -365,7 +365,7 @@ int bt_l2cap_server_register(struct bt_l2cap_server *server)
static void l2cap_chan_rx_init(struct bt_l2cap_chan *chan)
{
BT_DBG("chan %p\n", chan);
BT_DBG("chan %p", chan);
/* Use existing MTU if defined */
if (!chan->rx.mtu) {
@ -378,7 +378,7 @@ static void l2cap_chan_rx_init(struct bt_l2cap_chan *chan)
static void l2cap_chan_tx_init(struct bt_l2cap_chan *chan)
{
BT_DBG("chan %p\n", chan);
BT_DBG("chan %p", chan);
memset(&chan->tx, 0, sizeof(chan->tx));
nano_sem_init(&chan->tx.credits);
@ -387,7 +387,7 @@ static void l2cap_chan_tx_init(struct bt_l2cap_chan *chan)
static void l2cap_chan_tx_give_credits(struct bt_l2cap_chan *chan,
uint16_t credits)
{
BT_DBG("chan %p credits %u\n", chan, credits);
BT_DBG("chan %p credits %u", chan, credits);
while (credits--) {
nano_sem_give(&chan->tx.credits);
@ -397,7 +397,7 @@ static void l2cap_chan_tx_give_credits(struct bt_l2cap_chan *chan,
static void l2cap_chan_rx_give_credits(struct bt_l2cap_chan *chan,
uint16_t credits)
{
BT_DBG("chan %p credits %u\n", chan, credits);
BT_DBG("chan %p credits %u", chan, credits);
while (credits--) {
nano_sem_give(&chan->rx.credits);
@ -416,7 +416,7 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
uint16_t psm, scid, mtu, mps, credits;
if (buf->len < sizeof(*req)) {
BT_ERR("Too small LE conn req packet size\n");
BT_ERR("Too small LE conn req packet size");
return;
}
@ -426,11 +426,11 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
mps = sys_le16_to_cpu(req->mps);
credits = sys_le16_to_cpu(req->credits);
BT_DBG("psm 0x%02x scid 0x%04x mtu %u mps %u credits %u\n", psm, scid,
BT_DBG("psm 0x%02x scid 0x%04x mtu %u mps %u credits %u", psm, scid,
mtu, mps, credits);
if (mtu < L2CAP_LE_MIN_MTU || mps < L2CAP_LE_MIN_MTU) {
BT_ERR("Invalid LE-Conn Req params\n");
BT_ERR("Invalid LE-Conn Req params");
return;
}
@ -529,7 +529,7 @@ static struct bt_l2cap_chan *l2cap_remove_tx_cid(struct bt_conn *conn,
static void l2cap_chan_del(struct bt_l2cap_chan *chan)
{
BT_DBG("conn %p chan %p cid 0x%04x\n", chan->conn, chan, chan->rx.cid);
BT_DBG("conn %p chan %p cid 0x%04x", chan->conn, chan, chan->rx.cid);
chan->conn = NULL;
@ -563,14 +563,14 @@ static void le_disconn_req(struct bt_l2cap *l2cap, uint8_t ident,
uint16_t scid, dcid;
if (buf->len < sizeof(*req)) {
BT_ERR("Too small LE conn req packet size\n");
BT_ERR("Too small LE conn req packet size");
return;
}
dcid = sys_le16_to_cpu(req->dcid);
scid = sys_le16_to_cpu(req->scid);
BT_DBG("scid 0x%04x dcid 0x%04x\n", dcid, scid);
BT_DBG("scid 0x%04x dcid 0x%04x", dcid, scid);
chan = l2cap_remove_tx_cid(conn, scid);
if (!chan) {
@ -633,7 +633,7 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
uint16_t dcid, mtu, mps, credits, result;
if (buf->len < sizeof(*rsp)) {
BT_ERR("Too small LE conn rsp packet size\n");
BT_ERR("Too small LE conn rsp packet size");
return;
}
@ -643,7 +643,7 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
credits = sys_le16_to_cpu(rsp->credits);
result = sys_le16_to_cpu(rsp->result);
BT_DBG("dcid 0x%04x mtu %u mps %u credits %u result 0x%04x\n", dcid,
BT_DBG("dcid 0x%04x mtu %u mps %u credits %u result 0x%04x", dcid,
mtu, mps, credits, result);
if (result == BT_L2CAP_SUCCESS) {
@ -653,7 +653,7 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
}
if (!chan) {
BT_ERR("Cannot find channel for ident %u\n", ident);
BT_ERR("Cannot find channel for ident %u", ident);
return;
}
@ -689,14 +689,14 @@ static void le_disconn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
uint16_t dcid, scid;
if (buf->len < sizeof(*rsp)) {
BT_ERR("Too small LE disconn rsp packet size\n");
BT_ERR("Too small LE disconn rsp packet size");
return;
}
dcid = sys_le16_to_cpu(rsp->dcid);
scid = sys_le16_to_cpu(rsp->scid);
BT_DBG("dcid 0x%04x scid 0x%04x\n", dcid, scid);
BT_DBG("dcid 0x%04x scid 0x%04x", dcid, scid);
chan = l2cap_remove_tx_cid(conn, scid);
if (!chan) {
@ -715,30 +715,30 @@ static void le_credits(struct bt_l2cap *l2cap, uint8_t ident,
uint16_t credits, cid;
if (buf->len < sizeof(*ev)) {
BT_ERR("Too small LE Credits packet size\n");
BT_ERR("Too small LE Credits packet size");
return;
}
cid = sys_le16_to_cpu(ev->cid);
credits = sys_le16_to_cpu(ev->credits);
BT_DBG("cid 0x%04x credits %u\n", cid, credits);
BT_DBG("cid 0x%04x credits %u", cid, credits);
chan = bt_l2cap_lookup_tx_cid(conn, cid);
if (!chan) {
BT_ERR("Unable to find channel of LE Credits packet\n");
BT_ERR("Unable to find channel of LE Credits packet");
return;
}
if (chan->tx.credits.nsig + credits > UINT16_MAX) {
BT_ERR("Credits overflow\n");
BT_ERR("Credits overflow");
bt_l2cap_chan_disconnect(chan);
return;
}
l2cap_chan_tx_give_credits(chan, credits);
BT_DBG("chan %p total credits %u\n", chan, chan->tx.credits.nsig);
BT_DBG("chan %p total credits %u", chan, chan->tx.credits.nsig);
}
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
@ -749,23 +749,23 @@ static void l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
uint16_t len;
if (buf->len < sizeof(*hdr)) {
BT_ERR("Too small L2CAP LE signaling PDU\n");
BT_ERR("Too small L2CAP LE signaling PDU");
return;
}
len = sys_le16_to_cpu(hdr->len);
net_buf_pull(buf, sizeof(*hdr));
BT_DBG("LE signaling code 0x%02x ident %u len %u\n", hdr->code,
BT_DBG("LE signaling code 0x%02x ident %u len %u", hdr->code,
hdr->ident, len);
if (buf->len != len) {
BT_ERR("L2CAP length mismatch (%u != %u)\n", buf->len, len);
BT_ERR("L2CAP length mismatch (%u != %u)", buf->len, len);
return;
}
if (!hdr->ident) {
BT_ERR("Invalid ident value in L2CAP PDU\n");
BT_ERR("Invalid ident value in L2CAP PDU");
return;
}
@ -796,7 +796,7 @@ static void l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
break;
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
default:
BT_WARN("Unknown L2CAP PDU code 0x%02x\n", hdr->code);
BT_WARN("Unknown L2CAP PDU code 0x%02x", hdr->code);
l2cap_send_reject(chan->conn, hdr->ident,
BT_L2CAP_REJ_NOT_UNDERSTOOD);
break;
@ -822,7 +822,7 @@ static void l2cap_chan_update_credits(struct bt_l2cap_chan *chan)
buf = bt_l2cap_create_pdu(&le_sig);
if (!buf) {
BT_ERR("Unable to send credits\n");
BT_ERR("Unable to send credits");
return;
}
@ -838,16 +838,16 @@ static void l2cap_chan_update_credits(struct bt_l2cap_chan *chan)
bt_l2cap_send(chan->conn, BT_L2CAP_CID_LE_SIG, buf);
done:
BT_DBG("chan %p credits %u\n", chan, chan->rx.credits.nsig);
BT_DBG("chan %p credits %u", chan, chan->rx.credits.nsig);
}
static void l2cap_chan_le_recv_sdu(struct bt_l2cap_chan *chan,
struct net_buf *buf)
{
BT_DBG("chan %p len %u sdu len %u\n", chan, buf->len, chan->_sdu->len);
BT_DBG("chan %p len %u sdu len %u", chan, buf->len, chan->_sdu->len);
if (chan->_sdu->len + buf->len > chan->_sdu_len) {
BT_ERR("SDU length mismatch\n");
BT_ERR("SDU length mismatch");
bt_l2cap_chan_disconnect(chan);
return;
}
@ -870,7 +870,7 @@ static void l2cap_chan_le_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
uint16_t sdu_len;
if (!nano_fiber_sem_take(&chan->rx.credits)) {
BT_ERR("No credits to receive packet\n");
BT_ERR("No credits to receive packet");
bt_l2cap_chan_disconnect(chan);
return;
}
@ -883,10 +883,10 @@ static void l2cap_chan_le_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
sdu_len = net_buf_pull_le16(buf);
BT_DBG("chan %p len %u sdu_len %u\n", chan, buf->len, sdu_len);
BT_DBG("chan %p len %u sdu_len %u", chan, buf->len, sdu_len);
if (sdu_len > chan->rx.mtu) {
BT_ERR("Invalid SDU length\n");
BT_ERR("Invalid SDU length");
bt_l2cap_chan_disconnect(chan);
return;
}
@ -895,7 +895,7 @@ static void l2cap_chan_le_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
if (sdu_len > buf->len) {
chan->_sdu = chan->ops->alloc_buf(chan);
if (!chan) {
BT_ERR("Unable to allocate buffer for SDU\n");
BT_ERR("Unable to allocate buffer for SDU");
bt_l2cap_chan_disconnect(chan);
return;
}
@ -923,7 +923,7 @@ static void l2cap_chan_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
}
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
BT_DBG("chan %p len %u\n", chan, buf->len);
BT_DBG("chan %p len %u", chan, buf->len);
chan->ops->recv(chan, buf);
}
@ -935,7 +935,7 @@ void bt_l2cap_recv(struct bt_conn *conn, struct net_buf *buf)
uint16_t cid;
if (buf->len < sizeof(*hdr)) {
BT_ERR("Too small L2CAP PDU received\n");
BT_ERR("Too small L2CAP PDU received");
net_buf_unref(buf);
return;
}
@ -943,11 +943,11 @@ void bt_l2cap_recv(struct bt_conn *conn, struct net_buf *buf)
cid = sys_le16_to_cpu(hdr->cid);
net_buf_pull(buf, sizeof(*hdr));
BT_DBG("Packet for CID %u len %u\n", cid, buf->len);
BT_DBG("Packet for CID %u len %u", cid, buf->len);
chan = bt_l2cap_lookup_rx_cid(conn, cid);
if (!chan) {
BT_WARN("Ignoring data for unknown CID 0x%04x\n", cid);
BT_WARN("Ignoring data for unknown CID 0x%04x", cid);
net_buf_unref(buf);
return;
}
@ -986,12 +986,12 @@ int bt_l2cap_update_conn_param(struct bt_conn *conn)
static void l2cap_connected(struct bt_l2cap_chan *chan)
{
BT_DBG("chan %p cid 0x%04x\n", chan, chan->rx.cid);
BT_DBG("chan %p cid 0x%04x", chan, chan->rx.cid);
}
static void l2cap_disconnected(struct bt_l2cap_chan *chan)
{
BT_DBG("chan %p cid 0x%04x\n", chan, chan->rx.cid);
BT_DBG("chan %p cid 0x%04x", chan, chan->rx.cid);
}
static int l2cap_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
@ -1003,7 +1003,7 @@ static int l2cap_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
.recv = l2cap_recv,
};
BT_DBG("conn %p handle %u\n", conn, conn->handle);
BT_DBG("conn %p handle %u", conn, conn->handle);
for (i = 0; i < ARRAY_SIZE(bt_l2cap_pool); i++) {
struct bt_l2cap *l2cap = &bt_l2cap_pool[i];
@ -1019,7 +1019,7 @@ static int l2cap_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
return 0;
}
BT_ERR("No available L2CAP context for conn %p\n", conn);
BT_ERR("No available L2CAP context for conn %p", conn);
return -ENOMEM;
}
@ -1087,7 +1087,7 @@ static int l2cap_le_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan,
buf = bt_l2cap_create_pdu(&le_sig);
if (!buf) {
BT_ERR("Unable to send L2CP connection request\n");
BT_ERR("Unable to send L2CP connection request");
return -ENOMEM;
}
@ -1113,7 +1113,7 @@ static int l2cap_le_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan,
int bt_l2cap_chan_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan,
uint16_t psm)
{
BT_DBG("conn %p chan %p psm 0x%04x\n", conn, chan, psm);
BT_DBG("conn %p chan %p psm 0x%04x", conn, chan, psm);
if (!conn || conn->state != BT_CONN_CONNECTED) {
return -ENOTCONN;
@ -1134,7 +1134,7 @@ int bt_l2cap_chan_disconnect(struct bt_l2cap_chan *chan)
struct bt_l2cap_disconn_req *req;
struct bt_l2cap_sig_hdr *hdr;
BT_DBG("chan %p scid 0x%04x dcid 0x%04x\n", chan, chan->rx.cid,
BT_DBG("chan %p scid 0x%04x dcid 0x%04x", chan, chan->rx.cid,
chan->tx.cid);
if (!conn) {
@ -1143,7 +1143,7 @@ int bt_l2cap_chan_disconnect(struct bt_l2cap_chan *chan)
buf = bt_l2cap_create_pdu(&le_sig);
if (!buf) {
BT_ERR("Unable to send L2CP disconnect request\n");
BT_ERR("Unable to send L2CP disconnect request");
return -ENOMEM;
}
@ -1204,7 +1204,7 @@ segment:
memcpy(net_buf_add(seg, len), buf->data, len);
net_buf_pull(buf, len);
BT_DBG("chan %p seg %p len %u\n", chan, seg, seg->len);
BT_DBG("chan %p seg %p len %u", chan, seg, seg->len);
return seg;
}
@ -1225,7 +1225,7 @@ static int l2cap_chan_le_send(struct bt_l2cap_chan *chan, struct net_buf *buf,
return -ECONNRESET;
}
BT_DBG("chan %p cid 0x%04x len %u credits %u\n", chan, chan->tx.cid,
BT_DBG("chan %p cid 0x%04x len %u credits %u", chan, chan->tx.cid,
buf->len, chan->tx.credits.nsig);
bt_l2cap_send(chan->conn, chan->tx.cid, buf);
@ -1263,7 +1263,7 @@ static int l2cap_chan_le_send_sdu(struct bt_l2cap_chan *chan,
int bt_l2cap_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf)
{
BT_DBG("chan %p buf %p len %u\n", chan, buf, buf->len);
BT_DBG("chan %p buf %p len %u", chan, buf, buf->len);
if (!buf) {
return -EINVAL;

View file

@ -281,7 +281,7 @@ static int le_encrypt(const uint8_t key[16], const uint8_t plaintext[16],
struct tc_aes_key_sched_struct s;
uint8_t tmp[16];
BT_DBG("key %s plaintext %s\n", h(key, 16), h(plaintext, 16));
BT_DBG("key %s plaintext %s", h(key, 16), h(plaintext, 16));
swap_buf(tmp, key, 16);
@ -297,7 +297,7 @@ static int le_encrypt(const uint8_t key[16], const uint8_t plaintext[16],
swap_in_place(enc_data, 16);
BT_DBG("enc_data %s\n", h(enc_data, 16));
BT_DBG("enc_data %s", h(enc_data, 16));
return 0;
}
@ -310,7 +310,7 @@ static int le_encrypt(const uint8_t key[16], const uint8_t plaintext[16],
struct net_buf *buf, *rsp;
int err;
BT_DBG("key %s plaintext %s\n", h(key, 16), h(plaintext, 16));
BT_DBG("key %s plaintext %s", h(key, 16), h(plaintext, 16));
buf = bt_hci_cmd_create(BT_HCI_OP_LE_ENCRYPT, sizeof(*cp));
if (!buf) {
@ -330,7 +330,7 @@ static int le_encrypt(const uint8_t key[16], const uint8_t plaintext[16],
memcpy(enc_data, rp->enc_data, sizeof(rp->enc_data));
net_buf_unref(rsp);
BT_DBG("enc_data %s\n", h(enc_data, 16));
BT_DBG("enc_data %s", h(enc_data, 16));
return 0;
}
@ -348,7 +348,7 @@ static int le_rand(void *buf, size_t len)
err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_RAND, NULL, &rsp);
if (err) {
BT_ERR("HCI_LE_Random failed (%d)\n", err);
BT_ERR("HCI_LE_Random failed (%d)", err);
return err;
}
@ -369,7 +369,7 @@ static int smp_ah(const uint8_t irk[16], const uint8_t r[3], uint8_t out[3])
uint8_t res[16];
int err;
BT_DBG("irk %s\n, r %s", h(irk, 16), h(r, 3));
BT_DBG("irk %s, r %s", h(irk, 16), h(r, 3));
/* r' = padding || r */
memcpy(res, r, 3);
@ -399,9 +399,9 @@ static int smp_c1(const uint8_t k[16], const uint8_t r[16],
uint8_t p1[16], p2[16];
int err;
BT_DBG("k %s r %s\n", h(k, 16), h(r, 16));
BT_DBG("ia %s ra %s\n", bt_addr_le_str(ia), bt_addr_le_str(ra));
BT_DBG("preq %s pres %s\n", h(preq, 7), h(pres, 7));
BT_DBG("k %s r %s", h(k, 16), h(r, 16));
BT_DBG("ia %s ra %s", bt_addr_le_str(ia), bt_addr_le_str(ra));
BT_DBG("preq %s pres %s", h(preq, 7), h(pres, 7));
/* pres, preq, rat and iat are concatenated to generate p1 */
p1[0] = ia->type;
@ -409,7 +409,7 @@ static int smp_c1(const uint8_t k[16], const uint8_t r[16],
memcpy(p1 + 2, preq, 7);
memcpy(p1 + 9, pres, 7);
BT_DBG("p1 %s\n", h(p1, 16));
BT_DBG("p1 %s", h(p1, 16));
/* c1 = e(k, e(k, r XOR p1) XOR p2) */
@ -426,7 +426,7 @@ static int smp_c1(const uint8_t k[16], const uint8_t r[16],
memcpy(p2 + 6, ia->val, 6);
memset(p2 + 12, 0, 4);
BT_DBG("p2 %s\n", h(p2, 16));
BT_DBG("p2 %s", h(p2, 16));
xor_128((uint128_t *)enc_data, (uint128_t *)p2, (uint128_t *)enc_data);
@ -482,7 +482,7 @@ static int cmac_subkey(const uint8_t *key, uint8_t *k1, uint8_t *k2)
swap_in_place(l, 16);
BT_DBG("l %s\n", h(l, 16));
BT_DBG("l %s", h(l, 16));
/* if MSB(L) == 0 K1 = L << 1 */
if (!(l[0] & 0x80)) {
@ -534,11 +534,11 @@ static int bt_smp_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len,
/* (K1,K2) = Generate_Subkey(K) */
err = cmac_subkey(key_s, k1, k2);
if (err) {
BT_ERR("SMAC subkey generation failed\n");
BT_ERR("SMAC subkey generation failed");
return err;
}
BT_DBG("key %s subkeys k1 %s k2 %s\n", h(key, 16), h(k1, 16),
BT_DBG("key %s subkeys k1 %s k2 %s", h(key, 16), h(k1, 16),
h(k2, 16));
/* the number of blocks, n, is calculated, the block length is 16 bytes
@ -564,7 +564,7 @@ static int bt_smp_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len,
}
}
BT_DBG("len %u n %u flag %u\n", len, n, flag);
BT_DBG("len %u n %u flag %u", len, n, flag);
/* if flag is true then M_last = M_n XOR K1 */
if (flag) {
@ -658,7 +658,7 @@ static void smp_timeout(int arg1, int arg2)
struct bt_smp *smp = (struct bt_smp *)arg1;
ARG_UNUSED(arg2);
BT_ERR("SMP Timeout\n");
BT_ERR("SMP Timeout");
smp->timeout = NULL;
@ -731,7 +731,7 @@ static int smp_init(struct bt_smp *smp)
return BT_SMP_ERR_UNSPECIFIED;
}
BT_DBG("prnd %s\n", h(smp->prnd, 16));
BT_DBG("prnd %s", h(smp->prnd, 16));
atomic_set_bit(&smp->allowed_cmds, BT_SMP_CMD_PAIRING_FAIL);
@ -768,7 +768,7 @@ static uint8_t smp_request_tk(struct bt_smp *smp)
keys = bt_keys_find_addr(&conn->le.dst);
if (keys && keys->type == BT_KEYS_AUTHENTICATED &&
smp->method == JUST_WORKS) {
BT_ERR("JustWorks failed, authenticated keys present\n");
BT_ERR("JustWorks failed, authenticated keys present");
return BT_SMP_ERR_UNSPECIFIED;
}
@ -794,7 +794,7 @@ static uint8_t smp_request_tk(struct bt_smp *smp)
atomic_set_bit(&smp->flags, SMP_FLAG_TK_VALID);
break;
default:
BT_ERR("Unknown pairing method (%u)\n", smp->method);
BT_ERR("Unknown pairing method (%u)", smp->method);
return BT_SMP_ERR_UNSPECIFIED;
}
@ -837,7 +837,7 @@ int bt_smp_send_security_req(struct bt_conn *conn)
struct bt_smp_security_request *req;
struct net_buf *req_buf;
BT_DBG("\n");
BT_DBG("");
smp = smp_chan_get(conn);
if (!smp) {
return -ENOTCONN;
@ -883,7 +883,7 @@ static uint8_t smp_pairing_req(struct bt_smp *smp, struct net_buf *buf)
struct net_buf *rsp_buf;
int ret;
BT_DBG("\n");
BT_DBG("");
if ((req->max_key_size > BT_SMP_MAX_ENC_KEY_SIZE) ||
(req->max_key_size < BT_SMP_MIN_ENC_KEY_SIZE)) {
@ -955,9 +955,9 @@ static int smp_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x,
uint8_t m[65];
int err;
BT_DBG("u %s\n", h(u, 32));
BT_DBG("v %s\n", h(v, 32));
BT_DBG("x %s z 0x%x\n", h(x, 16), z);
BT_DBG("u %s", h(u, 32));
BT_DBG("v %s", h(v, 32));
BT_DBG("x %s z 0x%x", h(x, 16), z);
/*
* U, V and Z are concatenated and used as input m to the function
@ -981,7 +981,7 @@ static int smp_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x,
swap_in_place(res, 16);
BT_DBG("res %s\n", h(res, 16));
BT_DBG("res %s", h(res, 16));
return err;
}
@ -1005,8 +1005,8 @@ static int smp_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2,
uint8_t t[16], ws[32];
int err;
BT_DBG("w %s\n", h(w, 32));
BT_DBG("n1 %s n2 %s\n", h(n1, 16), h(n2, 16));
BT_DBG("w %s", h(w, 32));
BT_DBG("n1 %s n2 %s", h(n1, 16), h(n2, 16));
swap_buf(ws, w, 32);
@ -1015,7 +1015,7 @@ static int smp_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2,
return err;
}
BT_DBG("t %s\n", h(t, 16));
BT_DBG("t %s", h(t, 16));
swap_buf(m + 5, n1, 16);
swap_buf(m + 21, n2, 16);
@ -1029,7 +1029,7 @@ static int smp_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2,
return err;
}
BT_DBG("mackey %1s\n", h(mackey, 16));
BT_DBG("mackey %1s", h(mackey, 16));
swap_in_place(mackey, 16);
@ -1041,7 +1041,7 @@ static int smp_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2,
return err;
}
BT_DBG("ltk %s\n", h(ltk, 16));
BT_DBG("ltk %s", h(ltk, 16));
swap_in_place(ltk, 16);
@ -1056,10 +1056,10 @@ static int smp_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2,
uint8_t m[65];
int err;
BT_DBG("w %s\n", h(w, 16));
BT_DBG("n1 %s n2 %s\n", h(n1, 16), h(n2, 16));
BT_DBG("r %s io_cap\n", h(r, 16), h(iocap, 3));
BT_DBG("a1 %s a2 %s\n", h(a1, 7), h(a2, 7));
BT_DBG("w %s", h(w, 16));
BT_DBG("n1 %s n2 %s", h(n1, 16), h(n2, 16));
BT_DBG("r %s io_cap", h(r, 16), h(iocap, 3));
BT_DBG("a1 %s a2 %s", h(a1, 7), h(a2, 7));
swap_buf(m, n1, 16);
swap_buf(m + 16, n2, 16);
@ -1081,7 +1081,7 @@ static int smp_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2,
return err;
}
BT_DBG("res %s\n", h(check, 16));
BT_DBG("res %s", h(check, 16));
swap_in_place(check, 16);
@ -1094,9 +1094,9 @@ static int smp_g2(const uint8_t u[32], const uint8_t v[32],
uint8_t m[80], xs[16];
int err;
BT_DBG("u %s\n", h(u, 32));
BT_DBG("v %s\n", h(v, 32));
BT_DBG("x %s y %s\n", h(x, 16), h(y, 16));
BT_DBG("u %s", h(u, 32));
BT_DBG("v %s", h(v, 32));
BT_DBG("x %s y %s", h(x, 16), h(y, 16));
swap_buf(m, u, 32);
swap_buf(m + 32, v, 32);
@ -1109,7 +1109,7 @@ static int smp_g2(const uint8_t u[32], const uint8_t v[32],
if (err) {
return err;
}
BT_DBG("res %s\n", h(xs, 16));
BT_DBG("res %s", h(xs, 16));
/*
* TODO current this will work only for LE host but code below crashes
@ -1122,7 +1122,7 @@ static int smp_g2(const uint8_t u[32], const uint8_t v[32],
*passkey %= 1000000;
BT_DBG("passkey %u\n", *passkey);
BT_DBG("passkey %u", *passkey);
return 0;
}
@ -1189,7 +1189,7 @@ int bt_smp_send_pairing_req(struct bt_conn *conn)
struct bt_smp_pairing *req;
struct net_buf *req_buf;
BT_DBG("\n");
BT_DBG("");
smp = smp_chan_get(conn);
if (!smp) {
@ -1250,7 +1250,7 @@ static uint8_t smp_pairing_rsp(struct bt_smp *smp, struct net_buf *buf)
struct bt_smp_pairing *req = (struct bt_smp_pairing *)&smp->preq[1];
uint8_t ret;
BT_DBG("\n");
BT_DBG("");
if ((rsp->max_key_size > BT_SMP_MAX_ENC_KEY_SIZE) ||
(rsp->max_key_size < BT_SMP_MIN_ENC_KEY_SIZE)) {
@ -1324,7 +1324,7 @@ static uint8_t smp_pairing_confirm(struct bt_smp *smp, struct net_buf *buf)
{
struct bt_smp_pairing_confirm *req = (void *)buf->data;
BT_DBG("\n");
BT_DBG("");
memcpy(smp->pcnf, req->val, sizeof(smp->pcnf));
@ -1378,7 +1378,7 @@ static uint8_t sc_smp_send_dhkey_check(struct bt_smp *smp, const uint8_t *e)
struct bt_smp_dhkey_check *req;
struct net_buf *buf;
BT_DBG("\n");
BT_DBG("");
buf = bt_smp_create_pdu(smp->chan.conn, BT_SMP_DHKEY_CHECK,
sizeof(*req));
@ -1470,7 +1470,7 @@ void bt_smp_dhkey_ready(const uint8_t *dhkey)
struct bt_smp *smp = NULL;
int i;
BT_DBG("%p\n", dhkey);
BT_DBG("%p", dhkey);
for (i = 0; i < ARRAY_SIZE(bt_smp_pool); i++) {
if (atomic_test_and_clear_bit(&bt_smp_pool[i].flags,
@ -1521,7 +1521,7 @@ static uint8_t sc_smp_pairing_random(struct bt_smp *smp, struct net_buf *buf)
{
uint32_t passkey;
BT_DBG("\n");
BT_DBG("");
/* TODO */
if (smp->method == PASSKEY_DISPLAY || smp->method == PASSKEY_INPUT) {
@ -1538,7 +1538,7 @@ static uint8_t sc_smp_pairing_random(struct bt_smp *smp, struct net_buf *buf)
return BT_SMP_ERR_UNSPECIFIED;
}
BT_DBG("pcnf %s cfm %s\n", h(smp->pcnf, 16), h(cfm, 16));
BT_DBG("pcnf %s cfm %s", h(smp->pcnf, 16), h(cfm, 16));
if (memcmp(smp->pcnf, cfm, 16)) {
return BT_SMP_ERR_CONFIRM_FAILED;
@ -1591,7 +1591,7 @@ static uint8_t smp_pairing_random(struct bt_smp *smp, struct net_buf *buf)
uint8_t tmp[16];
int err;
BT_DBG("\n");
BT_DBG("");
memcpy(smp->rrnd, req->val, sizeof(smp->rrnd));
@ -1606,7 +1606,7 @@ static uint8_t smp_pairing_random(struct bt_smp *smp, struct net_buf *buf)
return BT_SMP_ERR_UNSPECIFIED;
}
BT_DBG("pcnf %s cfm %s\n", h(smp->pcnf, 16), h(tmp, 16));
BT_DBG("pcnf %s cfm %s", h(smp->pcnf, 16), h(tmp, 16));
if (memcmp(smp->pcnf, tmp, sizeof(smp->pcnf))) {
return BT_SMP_ERR_CONFIRM_FAILED;
@ -1623,7 +1623,7 @@ static uint8_t smp_pairing_random(struct bt_smp *smp, struct net_buf *buf)
/* Rand and EDiv are 0 for the STK */
if (bt_conn_le_start_encryption(conn, 0, 0, tmp,
get_encryption_key_size(smp))) {
BT_ERR("Failed to start encryption\n");
BT_ERR("Failed to start encryption");
return BT_SMP_ERR_UNSPECIFIED;
}
@ -1640,7 +1640,7 @@ static uint8_t smp_pairing_random(struct bt_smp *smp, struct net_buf *buf)
}
memcpy(smp->tk, tmp, sizeof(smp->tk));
BT_DBG("generated STK %s\n", h(smp->tk, 16));
BT_DBG("generated STK %s", h(smp->tk, 16));
atomic_set_bit(&smp->flags, SMP_FLAG_ENC_PENDING);
@ -1655,7 +1655,7 @@ static uint8_t smp_pairing_failed(struct bt_smp *smp, struct net_buf *buf)
struct bt_conn *conn = smp->chan.conn;
struct bt_smp_pairing_fail *req = (void *)buf->data;
BT_ERR("reason 0x%x\n", req->reason);
BT_ERR("reason 0x%x", req->reason);
/* TODO report error
* for now this to avoid warning about unused variable when debugs are
@ -1686,7 +1686,7 @@ static void bt_smp_distribute_keys(struct bt_smp *smp)
struct net_buf *buf;
if (!keys) {
BT_ERR("No keys space for %s\n", bt_addr_le_str(&conn->le.dst));
BT_ERR("No keys space for %s", bt_addr_le_str(&conn->le.dst));
return;
}
@ -1705,7 +1705,7 @@ static void bt_smp_distribute_keys(struct bt_smp *smp)
buf = bt_smp_create_pdu(conn, BT_SMP_CMD_ENCRYPT_INFO,
sizeof(*info));
if (!buf) {
BT_ERR("Unable to allocate Encrypt Info buffer\n");
BT_ERR("Unable to allocate Encrypt Info buffer");
return;
}
@ -1723,7 +1723,7 @@ static void bt_smp_distribute_keys(struct bt_smp *smp)
buf = bt_smp_create_pdu(conn, BT_SMP_CMD_MASTER_IDENT,
sizeof(*ident));
if (!buf) {
BT_ERR("Unable to allocate Master Ident buffer\n");
BT_ERR("Unable to allocate Master Ident buffer");
return;
}
@ -1748,7 +1748,7 @@ static void bt_smp_distribute_keys(struct bt_smp *smp)
buf = bt_smp_create_pdu(conn, BT_SMP_CMD_SIGNING_INFO,
sizeof(*info));
if (!buf) {
BT_ERR("Unable to allocate Signing Info buffer\n");
BT_ERR("Unable to allocate Signing Info buffer");
return;
}
@ -1766,11 +1766,11 @@ static uint8_t smp_encrypt_info(struct bt_smp *smp, struct net_buf *buf)
struct bt_smp_encrypt_info *req = (void *)buf->data;
struct bt_keys *keys;
BT_DBG("\n");
BT_DBG("");
keys = bt_keys_get_type(BT_KEYS_LTK, &conn->le.dst);
if (!keys) {
BT_ERR("Unable to get keys for %s\n",
BT_ERR("Unable to get keys for %s",
bt_addr_le_str(&conn->le.dst));
return BT_SMP_ERR_UNSPECIFIED;
}
@ -1788,11 +1788,11 @@ static uint8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf)
struct bt_smp_master_ident *req = (void *)buf->data;
struct bt_keys *keys;
BT_DBG("\n");
BT_DBG("");
keys = bt_keys_get_type(BT_KEYS_LTK, &conn->le.dst);
if (!keys) {
BT_ERR("Unable to get keys for %s\n",
BT_ERR("Unable to get keys for %s",
bt_addr_le_str(&conn->le.dst));
return BT_SMP_ERR_UNSPECIFIED;
}
@ -1828,11 +1828,11 @@ static uint8_t smp_ident_info(struct bt_smp *smp, struct net_buf *buf)
struct bt_smp_ident_info *req = (void *)buf->data;
struct bt_keys *keys;
BT_DBG("\n");
BT_DBG("");
keys = bt_keys_get_type(BT_KEYS_IRK, &conn->le.dst);
if (!keys) {
BT_ERR("Unable to get keys for %s\n",
BT_ERR("Unable to get keys for %s",
bt_addr_le_str(&conn->le.dst));
return BT_SMP_ERR_UNSPECIFIED;
}
@ -1851,17 +1851,17 @@ static uint8_t smp_ident_addr_info(struct bt_smp *smp, struct net_buf *buf)
const bt_addr_le_t *dst;
struct bt_keys *keys;
BT_DBG("identity %s\n", bt_addr_le_str(&req->addr));
BT_DBG("identity %s", bt_addr_le_str(&req->addr));
if (!bt_addr_le_is_identity(&req->addr)) {
BT_ERR("Invalid identity %s for %s\n",
BT_ERR("Invalid identity %s for %s",
bt_addr_le_str(&req->addr), bt_addr_le_str(&conn->le.dst));
return BT_SMP_ERR_INVALID_PARAMS;
}
keys = bt_keys_get_type(BT_KEYS_IRK, &conn->le.dst);
if (!keys) {
BT_ERR("Unable to get keys for %s\n",
BT_ERR("Unable to get keys for %s",
bt_addr_le_str(&conn->le.dst));
return BT_SMP_ERR_UNSPECIFIED;
}
@ -1920,11 +1920,11 @@ static uint8_t smp_signing_info(struct bt_smp *smp, struct net_buf *buf)
struct bt_smp_signing_info *req = (void *)buf->data;
struct bt_keys *keys;
BT_DBG("\n");
BT_DBG("");
keys = bt_keys_get_type(BT_KEYS_REMOTE_CSRK, &conn->le.dst);
if (!keys) {
BT_ERR("Unable to get keys for %s\n",
BT_ERR("Unable to get keys for %s",
bt_addr_le_str(&conn->le.dst));
return BT_SMP_ERR_UNSPECIFIED;
}
@ -1960,7 +1960,7 @@ static uint8_t smp_security_request(struct bt_smp *smp, struct net_buf *buf)
struct bt_smp_security_request *req = (void *)buf->data;
uint8_t auth;
BT_DBG("\n");
BT_DBG("");
if (sc_supported) {
auth = req->auth_req & BT_SMP_AUTH_MASK_SC;
@ -1983,19 +1983,19 @@ static uint8_t smp_security_request(struct bt_smp *smp, struct net_buf *buf)
if ((auth & BT_SMP_AUTH_MITM) &&
conn->keys->type != BT_KEYS_AUTHENTICATED) {
if (bt_smp_io_capa != BT_SMP_IO_NO_INPUT_OUTPUT) {
BT_INFO("New auth requirements: 0x%x, repairing\n",
BT_INFO("New auth requirements: 0x%x, repairing",
auth);
goto pair;
}
BT_WARN("Unsupported auth requirements: 0x%x, repairing\n",
BT_WARN("Unsupported auth requirements: 0x%x, repairing",
auth);
goto pair;
}
/* if LE SC required and no p256 key present reapair */
if ((auth & BT_SMP_AUTH_SC) && !(conn->keys->keys & BT_KEYS_LTK_P256)) {
BT_INFO("New auth requirements: 0x%x, repairing\n", auth);
BT_INFO("New auth requirements: 0x%x, repairing", auth);
goto pair;
}
@ -2029,7 +2029,7 @@ static uint8_t smp_public_key(struct bt_smp *smp, struct net_buf *buf)
struct bt_hci_cp_le_generate_dhkey *cp;
uint8_t err;
BT_DBG("\n");
BT_DBG("");
memcpy(smp->pkey, req->x, 32);
memcpy(&smp->pkey[32], req->y, 32);
@ -2071,7 +2071,7 @@ static uint8_t smp_dhkey_check(struct bt_smp *smp, struct net_buf *buf)
{
struct bt_smp_dhkey_check *req = (void *)buf->data;
BT_DBG("\n");
BT_DBG("");
#if defined(CONFIG_BLUETOOTH_CENTRAL)
if (smp->chan.conn->role == BT_HCI_ROLE_MASTER) {
@ -2151,11 +2151,11 @@ static void bt_smp_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
uint8_t err;
if (buf->len < sizeof(*hdr)) {
BT_ERR("Too small SMP PDU received\n");
BT_ERR("Too small SMP PDU received");
return;
}
BT_DBG("Received SMP code 0x%02x len %u\n", hdr->code, buf->len);
BT_DBG("Received SMP code 0x%02x len %u", hdr->code, buf->len);
net_buf_pull(buf, sizeof(*hdr));
@ -2165,22 +2165,22 @@ static void bt_smp_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
* performed when a new physical link has been established."
*/
if (atomic_test_bit(&smp->flags, SMP_FLAG_TIMEOUT)) {
BT_WARN("SMP command (code 0x%02x) received after timeout\n",
BT_WARN("SMP command (code 0x%02x) received after timeout",
hdr->code);
return;
}
if (hdr->code >= ARRAY_SIZE(handlers) || !handlers[hdr->code].func) {
BT_WARN("Unhandled SMP code 0x%02x\n", hdr->code);
BT_WARN("Unhandled SMP code 0x%02x", hdr->code);
err = BT_SMP_ERR_CMD_NOTSUPP;
} else {
if (!atomic_test_and_clear_bit(&smp->allowed_cmds, hdr->code)) {
BT_WARN("Unexpected SMP code 0x%02x\n", hdr->code);
BT_WARN("Unexpected SMP code 0x%02x", hdr->code);
return;
}
if (buf->len != handlers[hdr->code].expect_len) {
BT_ERR("Invalid len %u for code 0x%02x\n", buf->len,
BT_ERR("Invalid len %u for code 0x%02x", buf->len,
hdr->code);
err = BT_SMP_ERR_INVALID_PARAMS;
} else {
@ -2197,7 +2197,7 @@ static void bt_smp_connected(struct bt_l2cap_chan *chan)
{
struct bt_smp *smp = CONTAINER_OF(chan, struct bt_smp, chan);
BT_DBG("chan %p cid 0x%04x\n", chan, chan->tx.cid);
BT_DBG("chan %p cid 0x%04x", chan, chan->tx.cid);
smp_reset(smp);
}
@ -2206,7 +2206,7 @@ static void bt_smp_disconnected(struct bt_l2cap_chan *chan)
{
struct bt_smp *smp = CONTAINER_OF(chan, struct bt_smp, chan);
BT_DBG("chan %p cid 0x%04x\n", chan, chan->tx.cid);
BT_DBG("chan %p cid 0x%04x", chan, chan->tx.cid);
if (smp->timeout) {
fiber_fiber_delayed_start_cancel(smp->timeout);
@ -2220,7 +2220,7 @@ static void bt_smp_encrypt_change(struct bt_l2cap_chan *chan)
struct bt_smp *smp = CONTAINER_OF(chan, struct bt_smp, chan);
struct bt_conn *conn = chan->conn;
BT_DBG("chan %p conn %p handle %u encrypt 0x%02x\n", chan, conn,
BT_DBG("chan %p conn %p handle %u encrypt 0x%02x", chan, conn,
conn->handle, conn->encrypt);
if (!smp || !conn->encrypt) {
@ -2295,14 +2295,14 @@ static int smp_sign_buf(const uint8_t *key, uint8_t *msg, uint16_t len)
uint8_t key_s[16], tmp[16];
int err;
BT_DBG("Signing msg %s len %u key %s\n", h(msg, len), len, h(key, 16));
BT_DBG("Signing msg %s len %u key %s", h(msg, len), len, h(key, 16));
swap_in_place(m, len + sizeof(cnt));
swap_buf(key_s, key, 16);
err = bt_smp_aes_cmac(key_s, m, len + sizeof(cnt), tmp);
if (err) {
BT_ERR("Data signing failed\n");
BT_ERR("Data signing failed");
return err;
}
@ -2314,7 +2314,7 @@ static int smp_sign_buf(const uint8_t *key, uint8_t *msg, uint16_t len)
memcpy(sig, tmp + 4, 12);
BT_DBG("sig %s\n", h(sig, 12));
BT_DBG("sig %s", h(sig, 12));
return 0;
}
@ -2331,7 +2331,7 @@ int bt_smp_sign_verify(struct bt_conn *conn, struct net_buf *buf)
keys = bt_keys_find(BT_KEYS_REMOTE_CSRK, &conn->le.dst);
if (!keys) {
BT_ERR("Unable to find Remote CSRK for %s\n",
BT_ERR("Unable to find Remote CSRK for %s",
bt_addr_le_str(&conn->le.dst));
return -ENOENT;
}
@ -2340,19 +2340,19 @@ int bt_smp_sign_verify(struct bt_conn *conn, struct net_buf *buf)
cnt = sys_cpu_to_le32(keys->remote_csrk.cnt);
memcpy(net_buf_tail(buf) - sizeof(sig), &cnt, sizeof(cnt));
BT_DBG("Sign data len %u key %s count %u\n", buf->len - sizeof(sig),
BT_DBG("Sign data len %u key %s count %u", buf->len - sizeof(sig),
h(keys->remote_csrk.val, 16), keys->remote_csrk.cnt);
err = smp_sign_buf(keys->remote_csrk.val, buf->data,
buf->len - sizeof(sig));
if (err) {
BT_ERR("Unable to create signature for %s\n",
BT_ERR("Unable to create signature for %s",
bt_addr_le_str(&conn->le.dst));
return -EIO;
};
if (memcmp(sig, net_buf_tail(buf) - sizeof(sig), sizeof(sig))) {
BT_ERR("Unable to verify signature for %s\n",
BT_ERR("Unable to verify signature for %s",
bt_addr_le_str(&conn->le.dst));
return -EBADMSG;
};
@ -2370,7 +2370,7 @@ int bt_smp_sign(struct bt_conn *conn, struct net_buf *buf)
keys = bt_keys_find(BT_KEYS_LOCAL_CSRK, &conn->le.dst);
if (!keys) {
BT_ERR("Unable to find local CSRK for %s\n",
BT_ERR("Unable to find local CSRK for %s",
bt_addr_le_str(&conn->le.dst));
return -ENOENT;
}
@ -2382,12 +2382,12 @@ int bt_smp_sign(struct bt_conn *conn, struct net_buf *buf)
cnt = sys_cpu_to_le32(keys->local_csrk.cnt);
memcpy(net_buf_tail(buf) - 12, &cnt, sizeof(cnt));
BT_DBG("Sign data len %u key %s count %u\n", buf->len,
BT_DBG("Sign data len %u key %s count %u", buf->len,
h(keys->local_csrk.val, 16), keys->local_csrk.cnt);
err = smp_sign_buf(keys->local_csrk.val, buf->data, buf->len - 12);
if (err) {
BT_ERR("Unable to create signature for %s\n",
BT_ERR("Unable to create signature for %s",
bt_addr_le_str(&conn->le.dst));
return -EIO;
};
@ -2434,13 +2434,13 @@ static int aes_test(const char *prefix, const uint8_t *key, const uint8_t *m,
{
uint8_t out[16];
BT_DBG("%s: AES CMAC of message with len %u\n", prefix, len);
BT_DBG("%s: AES CMAC of message with len %u", prefix, len);
bt_smp_aes_cmac(key, m, len, out);
if (!memcmp(out, mac, 16)) {
BT_DBG("%s: Success\n", prefix);
BT_DBG("%s: Success", prefix);
} else {
BT_ERR("%s: Failed\n", prefix);
BT_ERR("%s: Failed", prefix);
return -1;
}
@ -2498,7 +2498,7 @@ static int sign_test(const char *prefix, const uint8_t *key, const uint8_t *m,
uint8_t *out = msg + len;
int err;
BT_DBG("%s: Sign message with len %u\n", prefix, len);
BT_DBG("%s: Sign message with len %u", prefix, len);
memset(msg, 0, sizeof(msg));
memcpy(msg, m, len);
@ -2513,18 +2513,18 @@ static int sign_test(const char *prefix, const uint8_t *key, const uint8_t *m,
/* Check original message */
if (!memcmp(msg, orig, len + sizeof(uint32_t))) {
BT_DBG("%s: Original message intact\n", prefix);
BT_DBG("%s: Original message intact", prefix);
} else {
BT_ERR("%s: Original message modified\n", prefix);
BT_DBG("%s: orig %s\n", prefix, h(orig, sizeof(orig)));
BT_DBG("%s: msg %s\n", prefix, h(msg, sizeof(msg)));
BT_ERR("%s: Original message modified", prefix);
BT_DBG("%s: orig %s", prefix, h(orig, sizeof(orig)));
BT_DBG("%s: msg %s", prefix, h(msg, sizeof(msg)));
return -1;
}
if (!memcmp(out, sig, 12)) {
BT_DBG("%s: Success\n", prefix);
BT_DBG("%s: Success", prefix);
} else {
BT_ERR("%s: Failed\n", prefix);
BT_ERR("%s: Failed", prefix);
return -1;
}
@ -2709,37 +2709,37 @@ static int smp_self_test(void)
err = smp_aes_cmac_test();
if (err) {
BT_ERR("SMP AES-CMAC self tests failed\n");
BT_ERR("SMP AES-CMAC self tests failed");
return err;
}
err = smp_sign_test();
if (err) {
BT_ERR("SMP signing self tests failed\n");
BT_ERR("SMP signing self tests failed");
return err;
}
err = smp_f4_test();
if (err) {
BT_ERR("SMP f4 self test failed\n");
BT_ERR("SMP f4 self test failed");
return err;
}
err = smp_f5_test();
if (err) {
BT_ERR("SMP f5 self test failed\n");
BT_ERR("SMP f5 self test failed");
return err;
}
err = smp_f6_test();
if (err) {
BT_ERR("SMP f6 self test failed\n");
BT_ERR("SMP f6 self test failed");
return err;
}
err = smp_g2_test();
if (err) {
BT_ERR("SMP g2 self test failed\n");
BT_ERR("SMP g2 self test failed");
return err;
}
@ -2923,7 +2923,7 @@ void bt_smp_update_keys(struct bt_conn *conn)
conn->keys = bt_keys_get_addr(&conn->le.dst);
if (!conn->keys) {
BT_ERR("Unable to get keys for %s\n",
BT_ERR("Unable to get keys for %s",
bt_addr_le_str(&conn->le.dst));
return;
}
@ -2988,7 +2988,7 @@ static int bt_smp_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
.recv = bt_smp_recv,
};
BT_DBG("conn %p handle %u\n", conn, conn->handle);
BT_DBG("conn %p handle %u", conn, conn->handle);
for (i = 0; i < ARRAY_SIZE(bt_smp_pool); i++) {
struct bt_smp *smp = &bt_smp_pool[i];
@ -3004,7 +3004,7 @@ static int bt_smp_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
return 0;
}
BT_ERR("No available SMP context for conn %p\n", conn);
BT_ERR("No available SMP context for conn %p", conn);
return -ENOMEM;
}
@ -3042,7 +3042,7 @@ int bt_smp_init(void)
sc_supported = le_sc_supported();
BT_DBG("LE SC %s\n", sc_supported ? "enabled" : "disabled");
BT_DBG("LE SC %s", sc_supported ? "enabled" : "disabled");
return smp_self_test();
}

View file

@ -72,7 +72,7 @@ static int bt_smp_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
.recv = bt_smp_recv,
};
BT_DBG("conn %p handle %u\n", conn, conn->handle);
BT_DBG("conn %p handle %u", conn, conn->handle);
for (i = 0; i < ARRAY_SIZE(bt_smp_pool); i++) {
struct bt_l2cap_chan *smp = &bt_smp_pool[i];
@ -88,7 +88,7 @@ static int bt_smp_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
return 0;
}
BT_ERR("No available SMP context for conn %p\n", conn);
BT_ERR("No available SMP context for conn %p", conn);
return -ENOMEM;
}