diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-01-13 15:12:34 -0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2013-01-13 15:12:34 -0800 |
commit | 26038ae7def36a135f35ce3c968e10c504af213b (patch) | |
tree | 582a30fed4620f9d9ea4fd1c98d2e8c858b8026f /emulator/main.c | |
parent | 58ac0d24a0ed2d57c3ead078517ba178988b55ea (diff) | |
download | bluez-26038ae7def36a135f35ce3c968e10c504af213b.tar.gz |
emulator: Add command line switch for local HCI virtual device
Diffstat (limited to 'emulator/main.c')
-rw-r--r-- | emulator/main.c | 16 |
1 files 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 <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <getopt.h> #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) |