tools/btmgmt: Fix --index option for non-interactive mode
In non-interactive mode the --index option does not work because the
call to mgmt_set_index() is made after bt_shell_attach().
Fixes: https://github.com/bluez/bluez/issues/893
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 9b7f851..436c2bb 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -51,8 +51,8 @@
return EXIT_FAILURE;
}
- bt_shell_attach(fileno(stdin));
mgmt_set_index(index_option);
+ bt_shell_attach(fileno(stdin));
status = bt_shell_run();
mgmt_remove_submenu();