Skip to content

Commit 250267d

Browse files
committed
Improve logging
1 parent ac2a882 commit 250267d

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

bt-embedded/backends/wii.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,6 @@ static s32 hci_send_command_cb(s32 result, void *userdata)
310310

311311
static int wii_hci_send_command(BteBuffer *buf)
312312
{
313-
BTE_DEBUG("fd = %d, buf %p, data %p, size=%d", s_bt_fd, buf,
314-
buf->data, buf->size);
315313
if (UNLIKELY(s_bt_fd < 0)) return -EBADF;
316314

317315
int rc;

bt-embedded/hci_dev.c

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,21 @@ static void handle_host_control(uint16_t ocf, const uint8_t *data, uint8_t len)
150150
int _bte_hci_send_command(BteBuffer *buffer)
151151
{
152152
if (UNLIKELY(!buffer)) return -ENOMEM;
153+
#if DEBUG
154+
{
155+
int len = buffer->size;
156+
if (len > 26) len = 26;
157+
158+
char hex[80];
159+
int offset = 0;
160+
161+
162+
for (int i = 0; i < len; i++) {
163+
offset += sprintf(hex + offset, " %02x", buffer->data[i]);
164+
}
165+
BTE_DEBUG("Cmd, size %d:%s", buffer->size, hex);
166+
}
167+
#endif
153168
int rc = _bte_backend.hci_send_command(buffer);
154169
/* The backend, if needed, will increase the reference count. But we
155170
* ourselves don't need this buffer anymore */
@@ -173,6 +188,21 @@ int _bte_hci_send_queued_data()
173188
if (rc < 0) {
174189
num_errors++;
175190
} else {
191+
#if DEBUG
192+
{
193+
int len = b->size;
194+
if (len > 31) len = 31;
195+
196+
char buffer[100];
197+
int offset = 0;
198+
199+
200+
for (int i = 0; i < len; i++) {
201+
offset += sprintf(buffer + offset, " %02x", b->data[i]);
202+
}
203+
BTE_DEBUG("size %d: %s", b->size, buffer);
204+
}
205+
#endif
176206
num_sent_packets++;
177207
}
178208

@@ -267,9 +297,9 @@ int _bte_hci_dev_handle_data(BteBuffer *buf)
267297
#if DEBUG
268298
{
269299
int len = buf->size;
270-
if (len > 22) len = 22;
300+
if (len > 32) len = 32;
271301

272-
char buffer[80];
302+
char buffer[100];
273303
int offset = 0;
274304

275305

0 commit comments

Comments
 (0)