All of lore.kernel.org
 help / color / mirror / Atom feed
* [BlueZ v2 0/7] Fix bluetoothctl --help hanging if daemon isn't running
@ 2024-10-22 11:58 Bastien Nocera
  2024-10-22 11:58 ` [BlueZ v2 1/7] configure.ac: Update requirement to glib 2.34 Bastien Nocera
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Bastien Nocera @ 2024-10-22 11:58 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bastien Nocera

v2, this one can print all the submenus without requiring bluetoothd
to be running.

Bastien Nocera (7):
  configure.ac: Update requirement to glib 2.34
  client: Use g_clear_pointer() to clean up menus
  client: Split installing submenu and doing I/O
  client: Install submenus before contacting bluez daemon
  shell: Document "mode" variable
  shared/shell: Add function to handle early help calls
  client: Fix --help hanging if bluetoothd is not running

 acinclude.m4       |  4 ++--
 client/admin.c     |  8 +++++---
 client/admin.h     |  1 +
 client/assistant.c |  8 +++++---
 client/assistant.h |  1 +
 client/main.c      | 14 ++++++++++----
 client/mgmt.c      | 11 +++++++----
 client/mgmt.h      |  3 ++-
 client/player.c    |  7 +++++--
 client/player.h    |  1 +
 configure.ac       |  2 +-
 src/shared/shell.c | 12 +++++++++++-
 src/shared/shell.h |  2 ++
 tools/btmgmt.c     |  3 ++-
 14 files changed, 55 insertions(+), 22 deletions(-)

-- 
2.47.0


^ permalink raw reply	[flat|nested] 15+ messages in thread
* [BlueZ v3 1/7] configure.ac: Update requirement to glib 2.34
@ 2024-10-22 14:10 Bastien Nocera
  2024-10-22 18:29 ` Fix bluetoothctl --help hanging if daemon isn't running bluez.test.bot
  0 siblings, 1 reply; 15+ messages in thread
From: Bastien Nocera @ 2024-10-22 14:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bastien Nocera

Update build requirements from 2011's glib 2.28 all the way up to 2012's
glib 2.34. This will allow us to use g_clear_pointer().
---
 acinclude.m4 | 4 ++--
 configure.ac | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 4b73a5bfc38f..d0bfe6ccb2fa 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -62,8 +62,8 @@ AC_DEFUN([COMPILER_FLAGS], [
 		with_cflags="$with_cflags -Wswitch-enum"
 		with_cflags="$with_cflags -Wformat -Wformat-security"
 		with_cflags="$with_cflags -DG_DISABLE_DEPRECATED"
-		with_cflags="$with_cflags -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28"
-		with_cflags="$with_cflags -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
+		with_cflags="$with_cflags -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_34"
+		with_cflags="$with_cflags -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_34"
 	fi
 	AC_SUBST([WARNING_CFLAGS], $with_cflags)
 ])
diff --git a/configure.ac b/configure.ac
index 7093e41ff714..14bd15293918 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,7 +81,7 @@ AC_CHECK_DECLS([basename], [],
 				 ])
 
 
-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28)
+PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.34)
 
 if (test "${enable_threads}" = "yes"); then
 	AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [BlueZ v4 1/9] client: Split installing submenu and doing I/O
@ 2025-05-13  9:38 Bastien Nocera
  2025-05-13 11:03 ` Fix bluetoothctl --help hanging if daemon isn't running bluez.test.bot
  0 siblings, 1 reply; 15+ messages in thread
From: Bastien Nocera @ 2025-05-13  9:38 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bastien Nocera

Split off installing the command's submenu and contacting the management
socket or the bluez daemon.
---
 client/admin.c     |  3 +++
 client/admin.h     |  1 +
 client/assistant.c |  3 +++
 client/assistant.h |  1 +
 client/main.c      |  4 ++++
 client/mgmt.c      | 11 +++++++----
 client/mgmt.h      |  3 ++-
 client/player.c    |  3 +++
 client/player.h    |  1 +
 tools/btmgmt.c     |  3 ++-
 10 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/client/admin.c b/client/admin.c
index 4d645d9469bb..614a492f1f5f 100644
--- a/client/admin.c
+++ b/client/admin.c
@@ -193,7 +193,10 @@ static void disconnect_handler(DBusConnection *connection, void *user_data)
 void admin_add_submenu(void)
 {
 	bt_shell_add_submenu(&admin_menu);
+}
 
+void admin_enable_submenu(void)
+{
 	dbus_conn = bt_shell_get_env("DBUS_CONNECTION");
 	if (!dbus_conn || client)
 		return;
diff --git a/client/admin.h b/client/admin.h
index 0047770dc737..08cca585d466 100644
--- a/client/admin.h
+++ b/client/admin.h
@@ -9,4 +9,5 @@
  */
 
 void admin_add_submenu(void);
+void admin_enable_submenu(void);
 void admin_remove_submenu(void);
diff --git a/client/assistant.c b/client/assistant.c
index 16e94664a5c3..555ac6feb048 100644
--- a/client/assistant.c
+++ b/client/assistant.c
@@ -395,7 +395,10 @@ static GDBusClient * client;
 void assistant_add_submenu(void)
 {
 	bt_shell_add_submenu(&assistant_menu);
+}
 
+void assistant_enable_submenu(void)
+{
 	dbus_conn = bt_shell_get_env("DBUS_CONNECTION");
 	if (!dbus_conn || client)
 		return;
diff --git a/client/assistant.h b/client/assistant.h
index 418b0b84031f..c304abea0515 100644
--- a/client/assistant.h
+++ b/client/assistant.h
@@ -9,5 +9,6 @@
  */
 
 void assistant_add_submenu(void);
+void assistant_enable_submenu(void);
 void assistant_remove_submenu(void);
 
diff --git a/client/main.c b/client/main.c
index a2d9d88bff43..e35e89dd2362 100644
--- a/client/main.c
+++ b/client/main.c
@@ -3420,9 +3420,13 @@ int main(int argc, char *argv[])
 					(void *)endpoint_option);
 
 	admin_add_submenu();
+	admin_enable_submenu();
 	player_add_submenu();
+	player_enable_submenu();
 	mgmt_add_submenu();
+	mgmt_enable_submenu();
 	assistant_add_submenu();
+	assistant_enable_submenu();
 	hci_add_submenu();
 
 	client = g_dbus_client_new(dbus_conn, "org.bluez", "/org/bluez");
diff --git a/client/mgmt.c b/client/mgmt.c
index faa97a159e3c..6c6d62f4bba1 100644
--- a/client/mgmt.c
+++ b/client/mgmt.c
@@ -6169,7 +6169,13 @@ static void mgmt_debug(const char *str, void *user_data)
 	print("%s%s", prefix, str);
 }
 
-bool mgmt_add_submenu(void)
+void mgmt_add_submenu(void)
+{
+	bt_shell_add_submenu(&mgmt_menu);
+	bt_shell_add_submenu(&monitor_menu);
+}
+
+bool mgmt_enable_submenu(void)
 {
 	mgmt = mgmt_new_default();
 	if (!mgmt) {
@@ -6177,9 +6183,6 @@ bool mgmt_add_submenu(void)
 		return false;
 	}
 
-	bt_shell_add_submenu(&mgmt_menu);
-	bt_shell_add_submenu(&monitor_menu);
-
 	if (getenv("MGMT_DEBUG"))
 		mgmt_set_debug(mgmt, mgmt_debug, "mgmt: ", NULL);
 
diff --git a/client/mgmt.h b/client/mgmt.h
index 5a2026eab6a2..b0f3cafd0777 100644
--- a/client/mgmt.h
+++ b/client/mgmt.h
@@ -8,6 +8,7 @@
  *
  */
 
-bool mgmt_add_submenu(void);
+void mgmt_add_submenu(void);
+bool mgmt_enable_submenu(void);
 void mgmt_remove_submenu(void);
 void mgmt_set_index(const char *arg);
diff --git a/client/player.c b/client/player.c
index 647e9bed70e6..7aab4af6d861 100644
--- a/client/player.c
+++ b/client/player.c
@@ -5876,7 +5876,10 @@ void player_add_submenu(void)
 	bt_shell_add_submenu(&player_menu);
 	bt_shell_add_submenu(&endpoint_menu);
 	bt_shell_add_submenu(&transport_menu);
+}
 
+void player_enable_submenu(void)
+{
 	dbus_conn = bt_shell_get_env("DBUS_CONNECTION");
 	if (!dbus_conn || client)
 		return;
diff --git a/client/player.h b/client/player.h
index e7778cb1efd9..c09ffa94cbff 100644
--- a/client/player.h
+++ b/client/player.h
@@ -9,4 +9,5 @@
  */
 
 void player_add_submenu(void);
+void player_enable_submenu(void);
 void player_remove_submenu(void);
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 436c2bb21f10..0f6051d5befe 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -46,7 +46,8 @@ int main(int argc, char *argv[])
 
 	bt_shell_init(argc, argv, &opt);
 
-	if (!mgmt_add_submenu()) {
+	mgmt_add_submenu();
+	if (!mgmt_enable_submenu()) {
 		fprintf(stderr, "Unable to open mgmt_socket\n");
 		return EXIT_FAILURE;
 	}
-- 
2.49.0


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

end of thread, other threads:[~2025-05-13 11:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22 11:58 [BlueZ v2 0/7] Fix bluetoothctl --help hanging if daemon isn't running Bastien Nocera
2024-10-22 11:58 ` [BlueZ v2 1/7] configure.ac: Update requirement to glib 2.34 Bastien Nocera
2024-10-22 12:31   ` Fix bluetoothctl --help hanging if daemon isn't running bluez.test.bot
2024-10-22 12:40     ` Bastien Nocera
2024-10-22 14:43       ` Bastien Nocera
2024-10-22 11:58 ` [BlueZ v2 2/7] client: Use g_clear_pointer() to clean up menus Bastien Nocera
2024-10-22 14:59   ` Luiz Augusto von Dentz
2024-10-22 15:55     ` Bastien Nocera
2024-10-22 11:58 ` [BlueZ v2 3/7] client: Split installing submenu and doing I/O Bastien Nocera
2024-10-22 11:58 ` [BlueZ v2 4/7] client: Install submenus before contacting bluez daemon Bastien Nocera
2024-10-22 11:58 ` [BlueZ v2 5/7] shell: Document "mode" variable Bastien Nocera
2024-10-22 11:58 ` [BlueZ v2 6/7] shared/shell: Add function to handle early help calls Bastien Nocera
2024-10-22 11:58 ` [BlueZ v2 7/7] client: Fix --help hanging if bluetoothd is not running Bastien Nocera
  -- strict thread matches above, loose matches on Subject: below --
2024-10-22 14:10 [BlueZ v3 1/7] configure.ac: Update requirement to glib 2.34 Bastien Nocera
2024-10-22 18:29 ` Fix bluetoothctl --help hanging if daemon isn't running bluez.test.bot
2025-05-13  9:38 [BlueZ v4 1/9] client: Split installing submenu and doing I/O Bastien Nocera
2025-05-13 11:03 ` Fix bluetoothctl --help hanging if daemon isn't running bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.