From c1a754f6654701488150570d8f235e11573db1c8 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Mon, 5 Aug 2019 09:06:39 +0200 Subject: [PATCH] Bluetooth: Host: Print error codes in hex Error codes are listed in header files and in the core spec as hex values. Always print them in hex in debug for easier error code checking. Signed-off-by: Joakim Andersson --- samples/bluetooth/central/src/main.c | 2 +- samples/bluetooth/central_hr/src/main.c | 2 +- samples/bluetooth/eddystone/src/main.c | 4 +- samples/bluetooth/peripheral/src/main.c | 4 +- samples/bluetooth/peripheral_csc/src/main.c | 4 +- samples/bluetooth/peripheral_dis/src/main.c | 4 +- samples/bluetooth/peripheral_esp/src/main.c | 4 +- samples/bluetooth/peripheral_hids/src/main.c | 2 +- samples/bluetooth/peripheral_hr/src/main.c | 4 +- samples/bluetooth/peripheral_ht/src/main.c | 4 +- .../bluetooth/peripheral_sc_only/src/main.c | 2 +- samples/boards/bbc_microbit/pong/src/ble.c | 4 +- samples/subsys/mgmt/mcumgr/smp_svr/src/main.c | 4 +- subsys/bluetooth/host/att.c | 2 +- subsys/bluetooth/host/hci_core.c | 48 +++++++++---------- subsys/bluetooth/shell/bt.c | 2 +- subsys/bluetooth/shell/gatt.c | 4 +- subsys/net/l2/bluetooth/bluetooth.c | 2 +- .../bsim_bt/bsim_test_app/src/test_connect1.c | 2 +- .../bsim_bt/bsim_test_app/src/test_connect2.c | 4 +- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/samples/bluetooth/central/src/main.c b/samples/bluetooth/central/src/main.c index ec5a703ce4d..05d835add00 100644 --- a/samples/bluetooth/central/src/main.c +++ b/samples/bluetooth/central/src/main.c @@ -81,7 +81,7 @@ static void disconnected(struct bt_conn *conn, u8_t reason) bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - printk("Disconnected: %s (reason %u)\n", addr, reason); + printk("Disconnected: %s (reason 0x%02x)\n", addr, reason); bt_conn_unref(default_conn); default_conn = NULL; diff --git a/samples/bluetooth/central_hr/src/main.c b/samples/bluetooth/central_hr/src/main.c index db503167b11..2ac270f2fff 100644 --- a/samples/bluetooth/central_hr/src/main.c +++ b/samples/bluetooth/central_hr/src/main.c @@ -187,7 +187,7 @@ static void disconnected(struct bt_conn *conn, u8_t reason) bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - printk("Disconnected: %s (reason %u)\n", addr, reason); + printk("Disconnected: %s (reason 0x%02x)\n", addr, reason); if (default_conn != conn) { return; diff --git a/samples/bluetooth/eddystone/src/main.c b/samples/bluetooth/eddystone/src/main.c index 47b31bc4b2d..78cfcdbc01b 100644 --- a/samples/bluetooth/eddystone/src/main.c +++ b/samples/bluetooth/eddystone/src/main.c @@ -649,7 +649,7 @@ static void idle_timeout(struct k_work *work) static void connected(struct bt_conn *conn, u8_t err) { if (err) { - printk("Connection failed (err %u)\n", err); + printk("Connection failed (err 0x%02x)\n", err); } else { printk("Connected\n"); k_delayed_work_cancel(&idle_work); @@ -660,7 +660,7 @@ static void disconnected(struct bt_conn *conn, u8_t reason) { struct eds_slot *slot = &eds_slots[eds_active_slot]; - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); if (!slot->connectable) { k_delayed_work_submit(&idle_work, 0); diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index 1b23d1998b9..a1450edcaa1 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -229,7 +229,7 @@ static const struct bt_data ad[] = { static void connected(struct bt_conn *conn, u8_t err) { if (err) { - printk("Connection failed (err %u)\n", err); + printk("Connection failed (err 0x%02x)\n", err); } else { printk("Connected\n"); } @@ -237,7 +237,7 @@ static void connected(struct bt_conn *conn, u8_t err) static void disconnected(struct bt_conn *conn, u8_t reason) { - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); } static struct bt_conn_cb conn_callbacks = { diff --git a/samples/bluetooth/peripheral_csc/src/main.c b/samples/bluetooth/peripheral_csc/src/main.c index 1e47f064a4e..719f8e03dc4 100644 --- a/samples/bluetooth/peripheral_csc/src/main.c +++ b/samples/bluetooth/peripheral_csc/src/main.c @@ -344,7 +344,7 @@ static void csc_simulation(void) static void connected(struct bt_conn *conn, u8_t err) { if (err) { - printk("Connection failed (err %u)\n", err); + printk("Connection failed (err 0x%02x)\n", err); } else { printk("Connected\n"); } @@ -352,7 +352,7 @@ static void connected(struct bt_conn *conn, u8_t err) static void disconnected(struct bt_conn *conn, u8_t reason) { - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); } static struct bt_conn_cb conn_callbacks = { diff --git a/samples/bluetooth/peripheral_dis/src/main.c b/samples/bluetooth/peripheral_dis/src/main.c index b84e985d920..aa51251323e 100644 --- a/samples/bluetooth/peripheral_dis/src/main.c +++ b/samples/bluetooth/peripheral_dis/src/main.c @@ -29,7 +29,7 @@ static const struct bt_data ad[] = { static void connected(struct bt_conn *conn, u8_t err) { if (err) { - printk("Connection failed (err %u)\n", err); + printk("Connection failed (err 0x%02x)\n", err); } else { printk("Connected\n"); } @@ -37,7 +37,7 @@ static void connected(struct bt_conn *conn, u8_t err) static void disconnected(struct bt_conn *conn, u8_t reason) { - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); } static struct bt_conn_cb conn_callbacks = { diff --git a/samples/bluetooth/peripheral_esp/src/main.c b/samples/bluetooth/peripheral_esp/src/main.c index f821007608f..f23b01c15b3 100644 --- a/samples/bluetooth/peripheral_esp/src/main.c +++ b/samples/bluetooth/peripheral_esp/src/main.c @@ -361,7 +361,7 @@ static const struct bt_data ad[] = { static void connected(struct bt_conn *conn, u8_t err) { if (err) { - printk("Connection failed (err %u)\n", err); + printk("Connection failed (err 0x%02x)\n", err); } else { printk("Connected\n"); } @@ -369,7 +369,7 @@ static void connected(struct bt_conn *conn, u8_t err) static void disconnected(struct bt_conn *conn, u8_t reason) { - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); } static struct bt_conn_cb conn_callbacks = { diff --git a/samples/bluetooth/peripheral_hids/src/main.c b/samples/bluetooth/peripheral_hids/src/main.c index 1a9499ec882..2addbef8291 100644 --- a/samples/bluetooth/peripheral_hids/src/main.c +++ b/samples/bluetooth/peripheral_hids/src/main.c @@ -55,7 +55,7 @@ static void disconnected(struct bt_conn *conn, u8_t reason) bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - printk("Disconnected from %s (reason %u)\n", addr, reason); + printk("Disconnected from %s (reason 0x%02x)\n", addr, reason); } static void security_changed(struct bt_conn *conn, bt_security_t level) diff --git a/samples/bluetooth/peripheral_hr/src/main.c b/samples/bluetooth/peripheral_hr/src/main.c index 30fd6c73650..143bb6c640e 100644 --- a/samples/bluetooth/peripheral_hr/src/main.c +++ b/samples/bluetooth/peripheral_hr/src/main.c @@ -32,7 +32,7 @@ static const struct bt_data ad[] = { static void connected(struct bt_conn *conn, u8_t err) { if (err) { - printk("Connection failed (err %u)\n", err); + printk("Connection failed (err 0x%02x)\n", err); } else { default_conn = bt_conn_ref(conn); printk("Connected\n"); @@ -41,7 +41,7 @@ static void connected(struct bt_conn *conn, u8_t err) static void disconnected(struct bt_conn *conn, u8_t reason) { - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); if (default_conn) { bt_conn_unref(default_conn); diff --git a/samples/bluetooth/peripheral_ht/src/main.c b/samples/bluetooth/peripheral_ht/src/main.c index 3310bc50547..2107641823f 100644 --- a/samples/bluetooth/peripheral_ht/src/main.c +++ b/samples/bluetooth/peripheral_ht/src/main.c @@ -36,7 +36,7 @@ static const struct bt_data ad[] = { static void connected(struct bt_conn *conn, u8_t err) { if (err) { - printk("Connection failed (err %u)\n", err); + printk("Connection failed (err 0x%02x)\n", err); } else { default_conn = bt_conn_ref(conn); printk("Connected\n"); @@ -45,7 +45,7 @@ static void connected(struct bt_conn *conn, u8_t err) static void disconnected(struct bt_conn *conn, u8_t reason) { - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); if (default_conn) { bt_conn_unref(default_conn); diff --git a/samples/bluetooth/peripheral_sc_only/src/main.c b/samples/bluetooth/peripheral_sc_only/src/main.c index 2c13b23856a..1e7dbe8e22c 100644 --- a/samples/bluetooth/peripheral_sc_only/src/main.c +++ b/samples/bluetooth/peripheral_sc_only/src/main.c @@ -48,7 +48,7 @@ static void disconnected(struct bt_conn *conn, u8_t reason) bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - printk("Disconnected from %s (reason %u)\n", addr, reason); + printk("Disconnected from %s (reason 0x%02x)\n", addr, reason); } static void identity_resolved(struct bt_conn *conn, const bt_addr_le_t *rpa, diff --git a/samples/boards/bbc_microbit/pong/src/ble.c b/samples/boards/bbc_microbit/pong/src/ble.c index 2f9afcca889..15e9d1cb86d 100644 --- a/samples/boards/bbc_microbit/pong/src/ble.c +++ b/samples/boards/bbc_microbit/pong/src/ble.c @@ -230,7 +230,7 @@ static void connected(struct bt_conn *conn, u8_t err) struct bt_conn_info info; if (err) { - printk("Connection failed (err %u)\n", err); + printk("Connection failed (err 0x%02x)\n", err); return; } @@ -255,7 +255,7 @@ static void connected(struct bt_conn *conn, u8_t err) static void disconnected(struct bt_conn *conn, u8_t reason) { - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); if (default_conn) { bt_conn_unref(default_conn); diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c b/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c index 960582136d8..6f737b018a2 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c +++ b/samples/subsys/mgmt/mcumgr/smp_svr/src/main.c @@ -83,7 +83,7 @@ static void advertise(void) static void connected(struct bt_conn *conn, u8_t err) { if (err) { - printk("Connection failed (err %u)\n", err); + printk("Connection failed (err 0x%02x)\n", err); } else { printk("Connected\n"); } @@ -91,7 +91,7 @@ static void connected(struct bt_conn *conn, u8_t err) static void disconnected(struct bt_conn *conn, u8_t reason) { - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); advertise(); } diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 1a81699b18f..e28bf5fb786 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -349,7 +349,7 @@ static u8_t att_handle_rsp(struct bt_att *att, void *pdu, u16_t len, u8_t err) { bt_att_func_t func; - BT_DBG("err %u len %u: %s", err, len, bt_hex(pdu, len)); + BT_DBG("err 0x%02x len %u: %s", err, len, bt_hex(pdu, len)); /* Cancel timeout if ongoing */ k_delayed_work_cancel(&att->timeout_work); diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 37c4a8853fc..2bdffa61153 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -720,7 +720,7 @@ static void hci_disconn_complete(struct net_buf *buf) u16_t handle = sys_le16_to_cpu(evt->handle); struct bt_conn *conn; - BT_DBG("status %u handle %u reason %u", evt->status, handle, + BT_DBG("status 0x%02x handle %u reason 0x%02x", evt->status, handle, evt->reason); if (evt->status) { @@ -920,7 +920,7 @@ static void enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt) struct bt_conn *conn; int err; - BT_DBG("status %u handle %u role %u %s", evt->status, handle, + BT_DBG("status 0x%02x handle %u role %u %s", evt->status, handle, evt->role, bt_addr_le_str(&evt->peer_addr)); #if defined(CONFIG_BT_SMP) @@ -1115,7 +1115,7 @@ static void le_legacy_conn_complete(struct net_buf *buf) struct bt_hci_evt_le_enh_conn_complete enh; const bt_addr_le_t *id_addr; - BT_DBG("status %u role %u %s", evt->status, evt->role, + BT_DBG("status 0x%02x role %u %s", evt->status, evt->role, bt_addr_le_str(&evt->peer_addr)); enh.status = evt->status; @@ -1234,7 +1234,7 @@ static void le_phy_update_complete(struct net_buf *buf) return; } - BT_DBG("PHY updated: status: 0x%x, tx: %u, rx: %u", + BT_DBG("PHY updated: status: 0x%02x, tx: %u, rx: %u", evt->status, evt->tx_phy, evt->rx_phy); if (!IS_ENABLED(CONFIG_BT_AUTO_PHY_UPDATE) || @@ -1359,7 +1359,7 @@ static void le_conn_update_complete(struct net_buf *buf) handle = sys_le16_to_cpu(evt->handle); - BT_DBG("status %u, handle %u", evt->status, handle); + BT_DBG("status 0x%02x, handle %u", evt->status, handle); conn = bt_conn_lookup_handle(handle); if (!conn) { @@ -2062,7 +2062,7 @@ static void ssp_complete(struct net_buf *buf) struct bt_hci_evt_ssp_complete *evt = (void *)buf->data; struct bt_conn *conn; - BT_DBG("status %u", evt->status); + BT_DBG("status 0x%02x", evt->status); conn = bt_conn_lookup_addr_br(&evt->bdaddr); if (!conn) { @@ -2463,7 +2463,7 @@ static void auth_complete(struct net_buf *buf) struct bt_conn *conn; u16_t handle = sys_le16_to_cpu(evt->handle); - BT_DBG("status %u, handle %u", evt->status, handle); + BT_DBG("status 0x%02x, handle %u", evt->status, handle); conn = bt_conn_lookup_handle(handle); if (!conn) { @@ -2494,7 +2494,7 @@ static void read_remote_features_complete(struct net_buf *buf) struct bt_hci_cp_read_remote_ext_features *cp; struct bt_conn *conn; - BT_DBG("status %u handle %u", evt->status, handle); + BT_DBG("status 0x%02x handle %u", evt->status, handle); conn = bt_conn_lookup_handle(handle); if (!conn) { @@ -2535,7 +2535,7 @@ static void read_remote_ext_features_complete(struct net_buf *buf) u16_t handle = sys_le16_to_cpu(evt->handle); struct bt_conn *conn; - BT_DBG("status %u handle %u", evt->status, handle); + BT_DBG("status 0x%02x handle %u", evt->status, handle); conn = bt_conn_lookup_handle(handle); if (!conn) { @@ -2556,7 +2556,7 @@ static void role_change(struct net_buf *buf) struct bt_hci_evt_role_change *evt = (void *)buf->data; struct bt_conn *conn; - BT_DBG("status %u role %u addr %s", evt->status, evt->role, + BT_DBG("status 0x%02x role %u addr %s", evt->status, evt->role, bt_addr_str(&evt->bdaddr)); if (evt->status) { @@ -2877,7 +2877,7 @@ static void hci_encrypt_change(struct net_buf *buf) u16_t handle = sys_le16_to_cpu(evt->handle); struct bt_conn *conn; - BT_DBG("status %u handle %u encrypt 0x%02x", evt->status, handle, + BT_DBG("status 0x%02x handle %u encrypt 0x%02x", evt->status, handle, evt->encrypt); conn = bt_conn_lookup_handle(handle); @@ -2952,7 +2952,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", evt->status, handle); + BT_DBG("status 0x%02x handle %u", evt->status, handle); conn = bt_conn_lookup_handle(handle); if (!conn) { @@ -3121,7 +3121,7 @@ static void le_pkey_complete(struct net_buf *buf) struct bt_hci_evt_le_p256_public_key_complete *evt = (void *)buf->data; struct bt_pub_key_cb *cb; - BT_DBG("status: 0x%x", evt->status); + BT_DBG("status: 0x%02x", evt->status); atomic_clear_bit(bt_dev.flags, BT_DEV_PUB_KEY_BUSY); @@ -3141,7 +3141,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", evt->status); + BT_DBG("status: 0x%02x", evt->status); if (dh_key_cb) { dh_key_cb(evt->status ? NULL : evt->dhkey); @@ -3155,7 +3155,7 @@ static void hci_reset_complete(struct net_buf *buf) u8_t status = buf->data[0]; atomic_t flags; - BT_DBG("status %u", status); + BT_DBG("status 0x%02x", status); if (status) { return; @@ -3730,7 +3730,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", rp->status); + BT_DBG("status 0x%02x", rp->status); bt_dev.hci_version = rp->hci_version; bt_dev.hci_revision = sys_le16_to_cpu(rp->hci_revision); @@ -3743,7 +3743,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", rp->status); + BT_DBG("status 0x%02x", rp->status); if (!bt_addr_cmp(&rp->bdaddr, BT_ADDR_ANY) || !bt_addr_cmp(&rp->bdaddr, BT_ADDR_NONE)) { @@ -3760,7 +3760,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", rp->status); + BT_DBG("status 0x%02x", rp->status); memcpy(bt_dev.le.features, rp->features, sizeof(bt_dev.le.features)); } @@ -3771,7 +3771,7 @@ static void read_buffer_size_complete(struct net_buf *buf) struct bt_hci_rp_read_buffer_size *rp = (void *)buf->data; u16_t pkts; - BT_DBG("status %u", rp->status); + BT_DBG("status 0x%02x", rp->status); bt_dev.br.mtu = sys_le16_to_cpu(rp->acl_max_len); pkts = sys_le16_to_cpu(rp->acl_max_num); @@ -3786,7 +3786,7 @@ static void read_buffer_size_complete(struct net_buf *buf) struct bt_hci_rp_read_buffer_size *rp = (void *)buf->data; u16_t pkts; - BT_DBG("status %u", rp->status); + BT_DBG("status 0x%02x", rp->status); /* If LE-side has buffers we can ignore the BR/EDR values */ if (bt_dev.le.mtu) { @@ -3810,7 +3810,7 @@ static void le_read_buffer_size_complete(struct net_buf *buf) struct bt_hci_rp_le_read_buffer_size *rp = (void *)buf->data; u8_t le_max_num; - BT_DBG("status %u", rp->status); + BT_DBG("status 0x%02x", rp->status); bt_dev.le.mtu = sys_le16_to_cpu(rp->le_max_len); if (!bt_dev.le.mtu) { @@ -3828,7 +3828,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", rp->status); + BT_DBG("status 0x%02x", rp->status); memcpy(bt_dev.supported_commands, rp->commands, sizeof(bt_dev.supported_commands)); @@ -3847,7 +3847,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", rp->status); + BT_DBG("status 0x%02x", rp->status); memcpy(bt_dev.features[0], rp->features, sizeof(bt_dev.features[0])); } @@ -3856,7 +3856,7 @@ static void le_read_supp_states_complete(struct net_buf *buf) { struct bt_hci_rp_le_read_supp_states *rp = (void *)buf->data; - BT_DBG("status %u", rp->status); + BT_DBG("status 0x%02x", rp->status); bt_dev.le.states = sys_get_le64(rp->le_states); } diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index b82f5f4279d..25e019e1b51 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -172,7 +172,7 @@ static void disconnected(struct bt_conn *conn, u8_t reason) char addr[BT_ADDR_LE_STR_LEN]; conn_addr_str(conn, addr, sizeof(addr)); - shell_print(ctx_shell, "Disconnected: %s (reason %u)", addr, reason); + shell_print(ctx_shell, "Disconnected: %s (reason 0x%02x)", addr, reason); if (default_conn == conn) { bt_conn_unref(default_conn); diff --git a/subsys/bluetooth/shell/gatt.c b/subsys/bluetooth/shell/gatt.c index 41904e88a65..61ee17cde0b 100644 --- a/subsys/bluetooth/shell/gatt.c +++ b/subsys/bluetooth/shell/gatt.c @@ -208,7 +208,7 @@ static u8_t read_func(struct bt_conn *conn, u8_t err, struct bt_gatt_read_params *params, const void *data, u16_t length) { - shell_print(ctx_shell, "Read complete: err %u length %u", err, length); + shell_print(ctx_shell, "Read complete: err 0x%02x length %u", err, length); if (!data) { (void)memset(params, 0, sizeof(*params)); @@ -324,7 +324,7 @@ static u8_t gatt_write_buf[CHAR_SIZE_MAX]; static void write_func(struct bt_conn *conn, u8_t err, struct bt_gatt_write_params *params) { - shell_print(ctx_shell, "Write complete: err %u", err); + shell_print(ctx_shell, "Write complete: err 0x%02x", err); (void)memset(&write_params, 0, sizeof(write_params)); } diff --git a/subsys/net/l2/bluetooth/bluetooth.c b/subsys/net/l2/bluetooth/bluetooth.c index b9c277794fc..1192ce4c64c 100644 --- a/subsys/net/l2/bluetooth/bluetooth.c +++ b/subsys/net/l2/bluetooth/bluetooth.c @@ -586,7 +586,7 @@ static void disconnected(struct bt_conn *conn, u8_t reason) bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - NET_DBG("Disconnected: %s (reason %u)\n", + NET_DBG("Disconnected: %s (reason 0x%02x)\n", log_strdup(addr), reason); } diff --git a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect1.c b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect1.c index f260e914709..9705db1f404 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect1.c +++ b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect1.c @@ -337,7 +337,7 @@ static void disconnected(struct bt_conn *conn, u8_t reason) bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); - printk("Disconnected: %s (reason %u)\n", addr, reason); + printk("Disconnected: %s (reason 0x%02x)\n", addr, reason); if (default_conn != conn) { return; diff --git a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c index 384b20e768c..fff8d593f07 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c +++ b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c @@ -77,7 +77,7 @@ static const struct bt_data ad[] = { static void connected(struct bt_conn *conn, u8_t err) { if (err) { - FAIL("Connection failed (err %u)\n", err); + FAIL("Connection failed (err 0x%02x)\n", err); } else { default_conn = bt_conn_ref(conn); printk("Connected\n"); @@ -86,7 +86,7 @@ static void connected(struct bt_conn *conn, u8_t err) static void disconnected(struct bt_conn *conn, u8_t reason) { - printk("Disconnected (reason %u)\n", reason); + printk("Disconnected (reason 0x%02x)\n", reason); if (default_conn) { bt_conn_unref(default_conn);