diff --git a/mgmt/main.c b/mgmt/main.c
index ecb922d..af0a302 100644
--- a/mgmt/main.c
+++ b/mgmt/main.c
discovery = true;
}
+static void find_usage(void)
+{
+ printf("Usage: btmgmt find [-l|-b]>\n");
+}
+
+static struct option find_options[] = {
+ { "help", 0, 0, 'h' },
+ { "le-only", 1, 0, 'l' },
+ { "bredr-only", 1, 0, 'b' },
+ { 0, 0, 0, 0 }
+};
+
static void cmd_find(int mgmt_sk, uint16_t index, int argc, char **argv)
{
struct mgmt_cp_start_discovery cp;
uint8_t type;
+ int opt;
if (index == MGMT_INDEX_NONE)
index = 0;
hci_set_bit(MGMT_ADDR_LE_PUBLIC, &type);
hci_set_bit(MGMT_ADDR_LE_RANDOM, &type);
+ while ((opt = getopt_long(argc, argv, "+lbh", find_options,
+ NULL)) != -1) {
+ switch (opt) {
+ case 'l':
+ hci_clear_bit(MGMT_ADDR_BREDR, &type);
+ hci_set_bit(MGMT_ADDR_LE_PUBLIC, &type);
+ hci_set_bit(MGMT_ADDR_LE_RANDOM, &type);
+ break;
+ case 'b':
+ hci_set_bit(MGMT_ADDR_BREDR, &type);
+ hci_clear_bit(MGMT_ADDR_LE_PUBLIC, &type);
+ hci_clear_bit(MGMT_ADDR_LE_RANDOM, &type);
+ break;
+ case 'h':
+ default:
+ find_usage();
+ exit(EXIT_SUCCESS);
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+ optind = 0;
+
memset(&cp, 0, sizeof(cp));
cp.type = type;