public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] shared/shell: Fix bt_shell_printf in non-interactive mode
@ 2026-02-17 22:29 Lars Christensen
  2026-02-17 23:24 ` [BlueZ] " bluez.test.bot
  2026-02-18 13:30 ` Arkadiusz Bokowy
  0 siblings, 2 replies; 4+ messages in thread
From: Lars Christensen @ 2026-02-17 22:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lars Christensen

Commit e73bf582d ("shared/shell: Don't init input for
non-interactive shells") stopped creating input objects for
non-interactive shells to avoid reading from stdin. However, this
caused bt_shell_printf to stop working because it checks if the
inputs queue is empty and returns early without printing anything.

Fix this by moving the empty inputs check to after the
non-interactive mode check, so that non-interactive mode can print
using vprintf even when no inputs are registered.

This fixes command-line invocations like 'bluetoothctl devices
Paired' which would execute but produce no output.

Fixes: https://github.com/bluez/bluez/issues/1896
---
 src/shared/shell.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index f014d8f7c..61b003819 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -711,9 +711,6 @@ void bt_shell_printf(const char *fmt, ...)
 	char *saved_line;
 	int saved_point;
 
-	if (queue_isempty(data.inputs))
-		return;
-
 	if (data.mode == MODE_NON_INTERACTIVE) {
 		va_start(args, fmt);
 		vprintf(fmt, args);
@@ -721,6 +718,9 @@ void bt_shell_printf(const char *fmt, ...)
 		return;
 	}
 
+	if (queue_isempty(data.inputs))
+		return;
+
 	save_input = !RL_ISSTATE(RL_STATE_DONE);
 
 	if (save_input) {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-18 14:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-17 22:29 [PATCH BlueZ] shared/shell: Fix bt_shell_printf in non-interactive mode Lars Christensen
2026-02-17 23:24 ` [BlueZ] " bluez.test.bot
2026-02-18 13:30 ` Arkadiusz Bokowy
2026-02-18 14:46   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox