}
static const struct option main_options[] = {
- { "local", no_argument, NULL, 'l' },
- { "version", no_argument, NULL, 'v' },
- { "help", no_argument, NULL, 'h' },
+ { "local", optional_argument, NULL, 'l' },
+ { "version", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, 'h' },
{ }
};
struct server *server3;
struct server *server4;
struct server *server5;
- bool enable_vhci = false;
+ int vhci_count = 0;
enum vhci_type vhci_type = VHCI_TYPE_BREDRLE;
sigset_t mask;
+ int i;
mainloop_init();
for (;;) {
int opt;
- opt = getopt_long(argc, argv, "lLBvh", main_options, NULL);
+ opt = getopt_long(argc, argv, "l::LBvh", main_options, NULL);
if (opt < 0)
break;
switch (opt) {
case 'l':
- enable_vhci = true;
+ if (optarg)
+ vhci_count = atoi(optarg);
+ else
+ vhci_count = 1;
break;
case 'L':
vhci_type = VHCI_TYPE_LE;
printf("Bluetooth emulator ver %s\n", VERSION);
- if (enable_vhci) {
+ for (i = 0; i < vhci_count; i++) {
vhci = vhci_open(vhci_type);
if (!vhci)
fprintf(stderr, "Failed to open Virtual HCI device\n");