summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorArun Kumar Singh <arunkat@gmail.com>2011-02-28 15:18:54 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2011-03-01 16:16:42 -0300
commit52921124202f96d6ab8e5ec93eace4c41bc06776 (patch)
treeb1b6b63c47627fcf0b046312d62ea7af3b563634 /tools
parentfc10b2c6f1d0fe6d3164a0361bbdc3685e333dde (diff)
downloadbluez-52921124202f96d6ab8e5ec93eace4c41bc06776.tar.gz
hcitool: Add command to clear LE White List
Diffstat (limited to 'tools')
-rw-r--r--tools/hcitool.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 427edc2be..e79d76b4f 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2702,6 +2702,49 @@ static void cmd_lewlsz(int dev_id, int argc, char **argv)
printf("White list size: %d\n", size);
}
+static struct option lewlclr_options[] = {
+ { "help", 0, 0, 'h' },
+ { 0, 0, 0, 0 }
+};
+
+static const char *lewlclr_help =
+ "Usage:\n"
+ "\tlewlclr\n";
+
+static void cmd_lewlclr(int dev_id, int argc, char **argv)
+{
+ int err, dd, opt;
+
+ for_each_opt(opt, lewlclr_options, NULL) {
+ switch (opt) {
+ default:
+ printf("%s", lewlclr_help);
+ return;
+ }
+ }
+
+ helper_arg(0, 0, &argc, &argv, lewlclr_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_clear_white_list(dd, 1000);
+ hci_close_dev(dd);
+
+ if (err < 0) {
+ err = errno;
+ fprintf(stderr, "Can't clear white list: %s(%d)\n",
+ strerror(err), err);
+ exit(1);
+ }
+}
+
static struct option ledc_options[] = {
{ "help", 0, 0, 'h' },
{ 0, 0, 0, 0 }
@@ -2866,6 +2909,7 @@ static struct {
{ "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" },
+ { "lewlclr", cmd_lewlclr, "Clear LE White list" },
{ "lecc", cmd_lecc, "Create a LE Connection" },
{ "ledc", cmd_ledc, "Disconnect a LE Connection" },
{ "lecup", cmd_lecup, "LE Connection Update" },