Implement mgmt start and stop discovery
This patch implements mgmt_start_discovery and mgmt_stop_discovery
callbacks for mgmtops.
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index e4eac81..a7a7d67 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1587,14 +1587,34 @@
static int mgmt_start_discovery(int index)
{
+ struct mgmt_hdr hdr;
+
DBG("index %d", index);
- return -ENOSYS;
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.opcode = htobs(MGMT_OP_START_DISCOVERY);
+ hdr.index = htobs(index);
+
+ if (write(mgmt_sock, &hdr, sizeof(hdr)) < 0)
+ return -errno;
+
+ return 0;
}
static int mgmt_stop_discovery(int index)
{
+ struct mgmt_hdr hdr;
+
DBG("index %d", index);
- return -ENOSYS;
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.opcode = htobs(MGMT_OP_STOP_DISCOVERY);
+ hdr.index = htobs(index);
+
+ if (write(mgmt_sock, &hdr, sizeof(hdr)) < 0)
+ return -errno;
+
+ return 0;
}
static int mgmt_start_inquiry(int index, uint8_t length, gboolean periodic)