From 26038ae7def36a135f35ce3c968e10c504af213b Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 13 Jan 2013 15:12:34 -0800 Subject: [PATCH] emulator: Add command line switch for local HCI virtual device --- emulator/main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/emulator/main.c b/emulator/main.c index 807c66396..c68b7381c 100644 --- a/emulator/main.c +++ b/emulator/main.c @@ -28,6 +28,7 @@ #include #include +#include #include #include "monitor/mainloop.h" @@ -54,6 +55,7 @@ static void usage(void) } static const struct option main_options[] = { + { "local", no_argument, NULL, 'l' }, { "version", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { } @@ -66,6 +68,7 @@ int main(int argc, char *argv[]) struct server *server2; struct server *server3; struct server *server4; + bool enable_vhci = false; sigset_t mask; mainloop_init(); @@ -73,11 +76,14 @@ int main(int argc, char *argv[]) for (;;) { int opt; - opt = getopt_long(argc, argv, "vh", main_options, NULL); + opt = getopt_long(argc, argv, "lvh", main_options, NULL); if (opt < 0) break; switch (opt) { + case 'l': + enable_vhci = true; + break; case 'v': printf("%s\n", VERSION); return EXIT_SUCCESS; @@ -97,9 +103,11 @@ int main(int argc, char *argv[]) printf("Bluetooth emulator ver %s\n", VERSION); - vhci = vhci_open(VHCI_TYPE_BREDR); - if (!vhci) - fprintf(stderr, "Failed to open Virtual HCI device\n"); + if (enable_vhci) { + vhci = vhci_open(VHCI_TYPE_BREDR); + if (!vhci) + fprintf(stderr, "Failed to open Virtual HCI device\n"); + } server1 = server_open_unix(SERVER_TYPE_BREDR, "/tmp/bt-server-bredr"); if (!server1) -- 2.47.3