diff options
author | Arun Kumar Singh <arunkat@gmail.com> | 2011-02-28 15:18:53 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2011-03-01 16:16:40 -0300 |
commit | fc10b2c6f1d0fe6d3164a0361bbdc3685e333dde (patch) | |
tree | c8bd83a745765eee8cec152fc1bd28d506072c4c /tools/hcitool.c | |
parent | d68ff374da47f4a37fd31025fdd448931599614b (diff) | |
download | bluez-fc10b2c6f1d0fe6d3164a0361bbdc3685e333dde.tar.gz |
hcitool: Add command to read size of LE White List
Diffstat (limited to 'tools/hcitool.c')
-rw-r--r-- | tools/hcitool.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c index bf0f25d4f..427edc2be 100644 --- a/tools/hcitool.c +++ b/tools/hcitool.c @@ -2656,6 +2656,52 @@ static void cmd_lewlrm(int dev_id, int argc, char **argv) } } +static struct option lewlsz_options[] = { + { "help", 0, 0, 'h' }, + { 0, 0, 0, 0 } +}; + +static const char *lewlsz_help = + "Usage:\n" + "\tlewlsz\n"; + +static void cmd_lewlsz(int dev_id, int argc, char **argv) +{ + int err, dd, opt; + uint8_t size; + + for_each_opt(opt, lewlsz_options, NULL) { + switch (opt) { + default: + printf("%s", lewlsz_help); + return; + } + } + + helper_arg(0, 0, &argc, &argv, lewlsz_help); + + if (dev_id < 0) + dev_id = hci_get_route(NULL); + + dd = hci_open_dev(dev_id); + if (dd < 0) { + perror("Could not open device"); + exit(1); + } + + err = hci_le_read_white_list_size(dd, &size, 1000); + hci_close_dev(dd); + + if (err < 0) { + err = errno; + fprintf(stderr, "Can't read white list size: %s(%d)\n", + strerror(err), err); + exit(1); + } + + printf("White list size: %d\n", size); +} + static struct option ledc_options[] = { { "help", 0, 0, 'h' }, { 0, 0, 0, 0 } @@ -2819,6 +2865,7 @@ static struct { { "lescan", cmd_lescan, "Start LE scan" }, { "lewladd", cmd_lewladd, "Add device to LE White List" }, { "lewlrm", cmd_lewlrm, "Remove device from LE White List" }, + { "lewlsz", cmd_lewlsz, "Read size of LE White List" }, { "lecc", cmd_lecc, "Create a LE Connection" }, { "ledc", cmd_ledc, "Disconnect a LE Connection" }, { "lecup", cmd_lecup, "LE Connection Update" }, |