From 8386929944fcee760418e503b879dd0e086b3b05 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 5 Nov 2024 14:20:45 +0100 Subject: [PATCH] tests: Bluetooth: Tester: Log conn changes Log the address and the err/reason values in the connected and disconnect callbacks. Since these values are not part of the BTP events it is difficult to follow the order and reason why disconnects happen when debugging. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/btp_gap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index f08269570e5..029e15f1768 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -6,6 +6,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include @@ -103,8 +104,12 @@ static uint8_t read_car_cb(struct bt_conn *conn, uint8_t err, static void le_connected(struct bt_conn *conn, uint8_t err) { struct btp_gap_device_connected_ev ev; + char addr_str[BT_ADDR_LE_STR_LEN]; struct bt_conn_info info; + (void)bt_addr_le_to_str(bt_conn_get_dst(conn), addr_str, sizeof(addr_str)); + LOG_DBG("%s: 0x%02x", addr_str, err); + if (err) { return; } @@ -131,6 +136,10 @@ static void le_disconnected(struct bt_conn *conn, uint8_t reason) { struct btp_gap_device_disconnected_ev ev; const bt_addr_le_t *addr = bt_conn_get_dst(conn); + char addr_str[BT_ADDR_LE_STR_LEN]; + + (void)bt_addr_le_to_str(bt_conn_get_dst(conn), addr_str, sizeof(addr_str)); + LOG_DBG("%s: 0x%02x", addr_str, reason); bt_addr_le_copy(&ev.address, addr);