aboutsummaryrefslogtreecommitdiff
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg2011-11-01 17:06:44 +0200
committerGustavo F. Padovan2011-11-07 17:24:48 -0200
commit164a6e78990f6201dc3105ff88335ca91392a427 (patch)
tree407787a69f45136e05365ba622f2435963f90a9b /net/bluetooth/mgmt.c
parent262038fcb2a50e9b5553243452918fda08cdf83d (diff)
Bluetooth: Fix command complete/status for discovery commands
This patch adds the necessary code to send proper command status or command complete events to the start/stop discovery management commands. Before this patch these events were completely missing. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7809aa979358..38220a2dc31e 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2339,8 +2339,35 @@ int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name)
return mgmt_event(MGMT_EV_REMOTE_NAME, index, &ev, sizeof(ev), NULL);
}
+int mgmt_inquiry_failed(u16 index, u8 status)
+{
+ struct pending_cmd *cmd;
+ int err;
+
+ cmd = mgmt_pending_find(MGMT_OP_START_DISCOVERY, index);
+ if (!cmd)
+ return -ENOENT;
+
+ err = cmd_status(cmd->sk, index, cmd->opcode, status);
+ mgmt_pending_remove(cmd);
+
+ return err;
+}
+
int mgmt_discovering(u16 index, u8 discovering)
{
+ struct pending_cmd *cmd;
+
+ if (discovering)
+ cmd = mgmt_pending_find(MGMT_OP_START_DISCOVERY, index);
+ else
+ cmd = mgmt_pending_find(MGMT_OP_STOP_DISCOVERY, index);
+
+ if (cmd != NULL) {
+ cmd_complete(cmd->sk, index, cmd->opcode, NULL, 0);
+ mgmt_pending_remove(cmd);
+ }
+
return mgmt_event(MGMT_EV_DISCOVERING, index, &discovering,
sizeof(discovering), NULL);
}