Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bluetooth: honor log panic mode in monitor #76589

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions subsys/bluetooth/host/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ static void drop_add(uint16_t opcode)
#if defined(CONFIG_BT_DEBUG_MONITOR_RTT)
#include <SEGGER_RTT.h>

static bool panic_mode;

#define RTT_BUFFER_NAME CONFIG_BT_DEBUG_MONITOR_RTT_BUFFER_NAME
#define RTT_BUF_SIZE CONFIG_BT_DEBUG_MONITOR_RTT_BUFFER_SIZE

Expand All @@ -123,10 +125,14 @@ static void monitor_send(const void *data, size_t len)
}

if (!drop) {
SEGGER_RTT_LOCK();
if (!panic_mode) {
SEGGER_RTT_LOCK();
}
cnt = SEGGER_RTT_WriteNoLock(CONFIG_BT_DEBUG_MONITOR_RTT_BUFFER,
rtt_buf, rtt_buf_offset);
SEGGER_RTT_UNLOCK();
if (!panic_mode) {
SEGGER_RTT_UNLOCK();
}
}

if (!cnt) {
Expand Down Expand Up @@ -350,6 +356,9 @@ static void monitor_log_process(const struct log_backend *const backend,

static void monitor_log_panic(const struct log_backend *const backend)
{
#if defined(CONFIG_BT_DEBUG_MONITOR_RTT)
panic_mode = true;
Thalley marked this conversation as resolved.
Show resolved Hide resolved
#endif
}

static void monitor_log_init(const struct log_backend *const backend)
Expand Down
Loading