From 6613e8695b0319c16160d25e2825b69392e619d9 Mon Sep 17 00:00:00 2001 From: Anderson Briglia Date: Fri, 29 Apr 2011 21:27:30 -0300 Subject: [PATCH] Implement mgmt start and stop discovery This patch implements mgmt_start_discovery and mgmt_stop_discovery callbacks for mgmtops. --- plugins/mgmtops.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c index e4eac8117..a7a7d67f6 100644 --- a/plugins/mgmtops.c +++ b/plugins/mgmtops.c @@ -1587,14 +1587,34 @@ static int mgmt_set_limited_discoverable(int index, gboolean limited) 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) -- 2.47.3