Bluetooth: Shell: Remove use of ctx_shell and improve shell prints #70945
Labels
area: Bluetooth
area: Shell
Shell subsystem
Enhancement
Changes/Updates/Additions to existing features
Is your enhancement proposal related to a problem? Please describe.
The
ctx_shell
in the Bluetooth shell is a global pointer to some shell instance. This is generally a poor design. The design have the following (and probably additional) issues:CONFIG_LOG_MODE_IMMEDIATE
, nor do they have any timestamps like the logging system. These things may mess up the order of what is being logged by the stack, and what is printed by the shell.Describe the solution you'd like
The
ctx_shell
needs to be removed completely. When a command is issued in a shell instance, whatever callbacks there may be called should appear in that shell, e.g. if you start scan on shell A then the scan reports shall be printed on shell A, while other commands could be done on other shell instances in the meanwhile.Additionally shell prints (or at least the ones in callbacks) should ideally be handled as background tasks (asynchronous printing) where they can be properly interleaved with the logging system and be timestamped similarly.
Describe alternatives you've considered
While still removing the
ctx_shell
, we could alternatively print to all shell instances in the callbacks by introducing something like ashell_wall_print
that does not require a specific pointer, but rather prints to all shell instances.Additional context
Additional points and discussing can be found in #69736. In this PR an attempt to replace the shell prints in callbacks with the logging system was suggested, but the logging system and the shell may be on different transports, so that is not ideal.
The text was updated successfully, but these errors were encountered: