Skip to content

Commit 210adaf

Browse files
Thalleykartben
authored andcommitted
drivers: Bluetooth: ipc: Add additional logging info
Add logging of the values that cause LOG_ERR statements. This makes it easier to debug any issues that occur. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 775cc35 commit 210adaf

File tree

1 file changed

+9
-6
lines changed
  • drivers/bluetooth/hci

1 file changed

+9
-6
lines changed

drivers/bluetooth/hci/ipc.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <zephyr/bluetooth/bluetooth.h>
1111
#include <zephyr/bluetooth/hci.h>
12+
#include <zephyr/bluetooth/hci_types.h>
1213
#include <zephyr/drivers/bluetooth.h>
1314

1415
#include <zephyr/device.h>
@@ -74,7 +75,7 @@ static struct net_buf *bt_ipc_evt_recv(const uint8_t *data, size_t remaining)
7475
size_t buf_tailroom;
7576

7677
if (remaining < sizeof(hdr)) {
77-
LOG_ERR("Not enough data for event header");
78+
LOG_ERR("Not enough data (%u) for event header (%zu)", remaining, sizeof(hdr));
7879
return NULL;
7980
}
8081

@@ -85,7 +86,7 @@ static struct net_buf *bt_ipc_evt_recv(const uint8_t *data, size_t remaining)
8586
remaining -= sizeof(hdr);
8687

8788
if (remaining != hdr.len) {
88-
LOG_ERR("Event payload length is not correct");
89+
LOG_ERR("Event payload length is not correct (%u != %u)", remaining, hdr.len);
8990
return NULL;
9091
}
9192
LOG_DBG("len %u", hdr.len);
@@ -122,7 +123,7 @@ static struct net_buf *bt_ipc_acl_recv(const uint8_t *data, size_t remaining)
122123
size_t buf_tailroom;
123124

124125
if (remaining < sizeof(hdr)) {
125-
LOG_ERR("Not enough data for ACL header");
126+
LOG_ERR("Not enough data (%u) for ACL header (%zu)", remaining, sizeof(hdr));
126127
return NULL;
127128
}
128129

@@ -139,7 +140,8 @@ static struct net_buf *bt_ipc_acl_recv(const uint8_t *data, size_t remaining)
139140
}
140141

141142
if (remaining != sys_le16_to_cpu(hdr.len)) {
142-
LOG_ERR("ACL payload length is not correct");
143+
LOG_ERR("ACL payload length is not correct (%u != %u)", remaining,
144+
sys_le16_to_cpu(hdr.len));
143145
net_buf_unref(buf);
144146
return NULL;
145147
}
@@ -165,7 +167,7 @@ static struct net_buf *bt_ipc_iso_recv(const uint8_t *data, size_t remaining)
165167
size_t buf_tailroom;
166168

167169
if (remaining < sizeof(hdr)) {
168-
LOG_ERR("Not enough data for ISO header");
170+
LOG_ERR("Not enough data (%u) for ISO header (%zu)", remaining, sizeof(hdr));
169171
return NULL;
170172
}
171173

@@ -189,7 +191,8 @@ static struct net_buf *bt_ipc_iso_recv(const uint8_t *data, size_t remaining)
189191
}
190192

191193
if (remaining != bt_iso_hdr_len(sys_le16_to_cpu(hdr.len))) {
192-
LOG_ERR("ISO payload length is not correct");
194+
LOG_ERR("ISO payload length is not correct (%u != %lu)", remaining,
195+
bt_iso_hdr_len(sys_le16_to_cpu(hdr.len)));
193196
net_buf_unref(buf);
194197
return NULL;
195198
}

0 commit comments

Comments
 (0)