@@ -202,7 +202,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;
@@ -18,4 +18,5 @@
*/
void admin_add_submenu(void);
+void admin_enable_submenu(void);
void admin_remove_submenu(void);
@@ -395,7 +395,10 @@ static GDBusClient * client = NULL;
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;
@@ -9,5 +9,6 @@
*/
void assistant_add_submenu(void);
+void assistant_enable_submenu(void);
void assistant_remove_submenu(void);
@@ -3204,9 +3204,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();
client = g_dbus_client_new(dbus_conn, "org.bluez", "/org/bluez");
@@ -6028,7 +6028,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) {
@@ -6036,9 +6042,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);
@@ -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);
@@ -5701,7 +5701,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;
@@ -9,4 +9,5 @@
*/
void player_add_submenu(void);
+void player_enable_submenu(void);
void player_remove_submenu(void);
@@ -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;
}