This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3fa56e033ef6432ac89b19b109766e76d5b45b39
Author: xuxingliang <[email protected]>
AuthorDate: Mon Feb 9 18:00:14 2026 +0800

    syslog: switch default channel disable from compile-time to runtime
    
    Remove the compile-time static disable of the default syslog channel
    (sc_state = true) since DFX now handles disabling dynamically at
    runtime via SYSLOGIOC_SETFILTER ioctl. Fix the panic notifier to use
    proper bitmask operation instead of clearing all state bits. Update
    Kconfig help text to reflect the new runtime behavior.
    
    Assisted-by: Claude
    Signed-off-by: xuxingliang <[email protected]>
---
 drivers/syslog/Kconfig          | 7 +++++--
 drivers/syslog/syslog_channel.c | 6 +-----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/syslog/Kconfig b/drivers/syslog/Kconfig
index 4ff808c1ace..4d805a1382d 100644
--- a/drivers/syslog/Kconfig
+++ b/drivers/syslog/Kconfig
@@ -451,8 +451,11 @@ config SYSLOG_DEFAULT_PANIC_ONLY
        default n
        depends on SYSLOG_IOCTL
        ---help---
-               If enabled, the default SYSLOG device will be used only
-               when panic() is called. It is disabled by default.
+               If enabled, a panic notifier will be registered to
+               re-enable the default SYSLOG channel when panic() is
+               called. This is useful when the default channel is
+               disabled at runtime (e.g. by DFX via SYSLOGIOC_SETFILTER),
+               ensuring serial output is restored during a panic.
 
 endif # SYSLOG_DEFAULT
 
diff --git a/drivers/syslog/syslog_channel.c b/drivers/syslog/syslog_channel.c
index aadd775da1d..aefea0b0dc4 100644
--- a/drivers/syslog/syslog_channel.c
+++ b/drivers/syslog/syslog_channel.c
@@ -189,10 +189,6 @@ static syslog_channel_t g_default_channel =
 #  ifdef CONFIG_SYSLOG_IOCTL
   , "default"
 #  endif
-
-#  ifdef CONFIG_SYSLOG_DEFAULT_PANIC_ONLY
-  , true
-#  endif
 #  ifdef CONFIG_SYSLOG_CONSOLE_LEVEL
   , .sc_dropmask = SYSLOG_CONSOLE_DROPMASK
 #  endif
@@ -276,7 +272,7 @@ g_syslog_channel[CONFIG_SYSLOG_MAX_CHANNELS] =
 static int syslog_default_panic_notifier(FAR struct notifier_block *nb,
                                          unsigned long event, FAR void *data)
 {
-  g_default_channel.sc_state = false;
+  g_default_channel.sc_state &= ~SYSLOG_CHANNEL_DISABLE;
   return OK;
 }
 #endif

Reply via email to