From b9a6e04cb368ef0d4a1dc34e329afd7a922fbdba Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 22 Dec 2022 15:10:58 +0100 Subject: [PATCH] Bluetooth: Audio: Add AUDIO_ISO debug logging Add a logging module for the audio_iso.c file, to enable logging for that. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/Kconfig.baps | 4 ++++ subsys/bluetooth/audio/audio_iso.c | 18 ++++++++++++++++++ .../bluetooth/bsim_bt/bsim_test_audio/prj.conf | 1 + tests/bluetooth/shell/audio.conf | 1 + 4 files changed, 24 insertions(+) diff --git a/subsys/bluetooth/audio/Kconfig.baps b/subsys/bluetooth/audio/Kconfig.baps index 643ae5188c5..c6013d3f5ae 100644 --- a/subsys/bluetooth/audio/Kconfig.baps +++ b/subsys/bluetooth/audio/Kconfig.baps @@ -378,5 +378,9 @@ config BT_AUDIO_STREAM default y if BT_ASCS || BT_AUDIO_UNICAST_CLIENT || \ BT_AUDIO_BROADCAST_SOURCE || BT_AUDIO_BROADCAST_SINK +module = BT_AUDIO_ISO +module-str = "Bluetooth Audio ISO" +source "subsys/logging/Kconfig.template.log_config" + rsource "Kconfig.pacs" rsource "Kconfig.ascs" diff --git a/subsys/bluetooth/audio/audio_iso.c b/subsys/bluetooth/audio/audio_iso.c index 0fb5c27a389..d9098b85d9a 100644 --- a/subsys/bluetooth/audio/audio_iso.c +++ b/subsys/bluetooth/audio/audio_iso.c @@ -9,6 +9,10 @@ #include "audio_iso.h" #include "endpoint.h" +#include + +LOG_MODULE_REGISTER(bt_audio_iso, CONFIG_BT_AUDIO_ISO_LOG_LEVEL); + /* TODO: Optimize the ISO_POOL_SIZE */ #define ISO_POOL_SIZE CONFIG_BT_ISO_MAX_CHAN @@ -147,6 +151,8 @@ void bt_audio_iso_bind_ep(struct bt_audio_iso *iso, struct bt_audio_ep *ep) __ASSERT(ep->dir == BT_AUDIO_DIR_SINK || ep->dir == BT_AUDIO_DIR_SOURCE, "invalid dir: %u", ep->dir); + LOG_DBG("iso %p ep %p dir %u", iso, ep, ep->dir); + if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_CLIENT) && bt_audio_ep_is_unicast_client(ep)) { /* For the unicast client, the direction and tx/rx is reversed */ @@ -183,6 +189,8 @@ void bt_audio_iso_unbind_ep(struct bt_audio_iso *iso, struct bt_audio_ep *ep) __ASSERT(ep->dir == BT_AUDIO_DIR_SINK || ep->dir == BT_AUDIO_DIR_SOURCE, "Invalid dir: %u", ep->dir); + LOG_DBG("iso %p ep %p dir %u", iso, ep, ep->dir); + if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_CLIENT) && bt_audio_ep_is_unicast_client(ep)) { /* For the unicast client, the direction and tx/rx is reversed */ @@ -218,6 +226,8 @@ struct bt_audio_ep *bt_audio_iso_get_ep(bool unicast_client, __ASSERT(dir == BT_AUDIO_DIR_SINK || dir == BT_AUDIO_DIR_SOURCE, "invalid dir: %u", dir); + LOG_DBG("iso %p dir %u", iso, dir); + /* TODO FIX FOR CLIENT */ if (IS_ENABLED(CONFIG_BT_AUDIO_UNICAST_CLIENT) && unicast_client) { /* For the unicast client, the direction and tx/rx is reversed */ @@ -247,6 +257,9 @@ void bt_audio_iso_bind_stream(struct bt_audio_iso *audio_iso, "stream %p bound with audio_iso %p already", stream, stream->audio_iso); + LOG_DBG("audio_iso %p stream %p dir %u", + audio_iso, stream, stream->dir); + /* For the unicast client, the direction and tx/rx is reversed */ if (stream->dir == BT_AUDIO_DIR_SOURCE) { audio_iso_ep = &audio_iso->rx; @@ -273,6 +286,9 @@ void bt_audio_iso_unbind_stream(struct bt_audio_iso *audio_iso, "stream %p not bound with an audio_iso", stream); + LOG_DBG("audio_iso %p stream %p dir %u", + audio_iso, stream, stream->dir); + /* For the unicast client, the direction and tx/rx is reversed */ if (stream->dir == BT_AUDIO_DIR_SOURCE) { audio_iso_ep = &audio_iso->rx; @@ -295,6 +311,8 @@ struct bt_audio_stream *bt_audio_iso_get_stream(struct bt_audio_iso *iso, __ASSERT(dir == BT_AUDIO_DIR_SINK || dir == BT_AUDIO_DIR_SOURCE, "invalid dir: %u", dir); + LOG_DBG("iso %p dir %u", iso, dir); + /* For the unicast client, the direction and tx/rx is reversed */ if (dir == BT_AUDIO_DIR_SOURCE) { return iso->rx.stream; diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf b/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf index d46a275cd56..d927cd4549f 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf +++ b/tests/bluetooth/bsim_bt/bsim_test_audio/prj.conf @@ -141,6 +141,7 @@ CONFIG_BT_AUDIO_BROADCAST_SOURCE_LOG_LEVEL_DBG=y CONFIG_BT_ASCS_LOG_LEVEL_DBG=y CONFIG_BT_PACS_LOG_LEVEL_DBG=y CONFIG_BT_AUDIO_STREAM_LOG_LEVEL_DBG=y +CONFIG_BT_AUDIO_ISO_LOG_LEVEL_DBG=y CONFIG_BT_BAP_SCAN_DELEGATOR_LOG_LEVEL_DBG=y CONFIG_BT_BAP_BROADCAST_ASSISTANT_LOG_LEVEL_DBG=y CONFIG_BT_HAS_LOG_LEVEL_DBG=y diff --git a/tests/bluetooth/shell/audio.conf b/tests/bluetooth/shell/audio.conf index 847be03b1f8..68c1d45cbd8 100644 --- a/tests/bluetooth/shell/audio.conf +++ b/tests/bluetooth/shell/audio.conf @@ -168,4 +168,5 @@ CONFIG_BT_VOCS_CLIENT_LOG_LEVEL_DBG=y CONFIG_BT_AICS_LOG_LEVEL_DBG=y CONFIG_BT_VOCS_LOG_LEVEL_DBG=y CONFIG_BT_AUDIO_STREAM_LOG_LEVEL_DBG=y +CONFIG_BT_AUDIO_ISO_LOG_LEVEL_DBG=y CONFIG_BT_CSIP_SET_COORDINATOR_LOG_LEVEL_DBG=y