diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 7e3b2a8..9abc0d4 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
#include <stdlib.h>
+#include <glib.h>
+
#include "lib/bluetooth.h"
#include "lib/mgmt.h"
#include "src/shared/mgmt.h"
#include "src/shared/hciemu.h"
+static gboolean option_wait_powered = FALSE;
+
struct test_data {
const void *test_data;
uint8_t expected_version;
tester_print("Controller powered on");
- /* FIXME: Delay here to not get confused by existing kernel bug
- * with missing synchronization of some HCI commands */
- tester_wait(1, powered_delay, NULL);
+ if (option_wait_powered)
+ tester_wait(1, powered_delay, NULL);
+ else
+ tester_setup_complete();
}
static void setup_powered_discoverable(const void *test_data)
test_add_condition(data);
}
+static GOptionEntry options[] = {
+ { "wait-powered", 'P', 0, G_OPTION_ARG_NONE, &option_wait_powered,
+ "Add a delay after powering on" },
+ { NULL },
+};
+
int main(int argc, char *argv[])
{
+ GOptionContext *context;
+ GError *error = NULL;
+
+ context = g_option_context_new(NULL);
+ g_option_context_add_main_entries(context, options, NULL);
+ g_option_context_set_ignore_unknown_options(context, TRUE);
+
+ if (g_option_context_parse(context, &argc, &argv, &error) == FALSE) {
+ if (error != NULL) {
+ g_printerr("%s\n", error->message);
+ g_error_free(error);
+ } else
+ g_printerr("An unknown error occurred\n");
+ exit(1);
+ }
+
+ g_option_context_free(context);
+
tester_init(&argc, &argv);
test_bredrle("Controller setup", NULL, NULL, controller_setup);