summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorArun Kumar Singh <arunkat@gmail.com>2011-02-28 15:18:52 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2011-03-01 16:16:38 -0300
commitd68ff374da47f4a37fd31025fdd448931599614b (patch)
treed008b6eae5237b569c90c52fe5ce3e356283b81c /tools
parent7e018c6e02e39faa3b12f144390be4942bd316e6 (diff)
downloadbluez-d68ff374da47f4a37fd31025fdd448931599614b.tar.gz
hcitool: Add command to remove a device from LE white list
Diffstat (limited to 'tools')
-rw-r--r--tools/hcitool.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index 894515695..bf0f25d4f 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2610,6 +2610,52 @@ static void cmd_lewladd(int dev_id, int argc, char **argv)
}
}
+static struct option lewlrm_options[] = {
+ { "help", 0, 0, 'h' },
+ { 0, 0, 0, 0 }
+};
+
+static const char *lewlrm_help =
+ "Usage:\n"
+ "\tlewlrm <bdaddr>\n";
+
+static void cmd_lewlrm(int dev_id, int argc, char **argv)
+{
+ int err, opt, dd;
+ bdaddr_t bdaddr;
+
+ for_each_opt(opt, lewlrm_options, NULL) {
+ switch (opt) {
+ default:
+ printf("%s", lewlrm_help);
+ return;
+ }
+ }
+
+ helper_arg(1, 1, &argc, &argv, lewlrm_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);
+ }
+
+ str2ba(argv[0], &bdaddr);
+
+ err = hci_le_rm_white_list(dd, &bdaddr, LE_PUBLIC_ADDRESS, 1000);
+ hci_close_dev(dd);
+
+ if (err < 0) {
+ err = errno;
+ fprintf(stderr, "Can't remove from white list: %s(%d)\n",
+ strerror(err), err);
+ exit(1);
+ }
+}
+
static struct option ledc_options[] = {
{ "help", 0, 0, 'h' },
{ 0, 0, 0, 0 }
@@ -2772,6 +2818,7 @@ static struct {
{ "clock", cmd_clock, "Read local or remote clock" },
{ "lescan", cmd_lescan, "Start LE scan" },
{ "lewladd", cmd_lewladd, "Add device to LE White List" },
+ { "lewlrm", cmd_lewlrm, "Remove device from LE White List" },
{ "lecc", cmd_lecc, "Create a LE Connection" },
{ "ledc", cmd_ledc, "Disconnect a LE Connection" },
{ "lecup", cmd_lecup, "LE Connection Update" },