tools/bluetooth-player: Only enable attach input when connected
diff --git a/tools/bluetooth-player.c b/tools/bluetooth-player.c
index 709ef56..32ae4f6 100644
--- a/tools/bluetooth-player.c
+++ b/tools/bluetooth-player.c
@@ -57,11 +57,13 @@
static void connect_handler(DBusConnection *connection, void *user_data)
{
+ bt_shell_attach(fileno(stdin));
bt_shell_set_prompt(PROMPT_ON);
}
static void disconnect_handler(DBusConnection *connection, void *user_data)
{
+ bt_shell_detach();
bt_shell_set_prompt(PROMPT_OFF);
}
@@ -1124,7 +1126,6 @@
bt_shell_init(argc, argv, NULL);
bt_shell_set_menu(&main_menu);
bt_shell_set_prompt(PROMPT_OFF);
- bt_shell_attach(fileno(stdin));
dbus_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);