aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2011-11-10 08:54:39 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-11-10 15:05:41 -0500
commit37d9ef76c26092098e8fbd3fd540b7ac2181e6bf (patch)
treef46e360fc4d8b9d0a3e07b5fcf111d2be297fd8d /net/bluetooth/mgmt.c
parenta8a1d19e9d00e2ec6f28b89133137390b1d293bd (diff)
Bluetooth: Add status parameter to mgmt_disconnect response
Since disconnecting may fail the status needs to be communicated to user space. This also updates the implementation to match the latest mgmt API specification. 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.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index dddb19057d11..5562c2106eb5 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2128,6 +2128,7 @@ static void disconnect_rsp(struct pending_cmd *cmd, void *data)
2128 struct mgmt_rp_disconnect rp; 2128 struct mgmt_rp_disconnect rp;
2129 2129
2130 bacpy(&rp.bdaddr, &cp->bdaddr); 2130 bacpy(&rp.bdaddr, &cp->bdaddr);
2131 rp.status = 0;
2131 2132
2132 cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT, &rp, sizeof(rp)); 2133 cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT, &rp, sizeof(rp));
2133 2134
@@ -2176,7 +2177,7 @@ int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
2176 return err; 2177 return err;
2177} 2178}
2178 2179
2179int mgmt_disconnect_failed(struct hci_dev *hdev) 2180int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status)
2180{ 2181{
2181 struct pending_cmd *cmd; 2182 struct pending_cmd *cmd;
2182 int err; 2183 int err;
@@ -2185,7 +2186,17 @@ int mgmt_disconnect_failed(struct hci_dev *hdev)
2185 if (!cmd) 2186 if (!cmd)
2186 return -ENOENT; 2187 return -ENOENT;
2187 2188
2188 err = cmd_status(cmd->sk, hdev->id, MGMT_OP_DISCONNECT, EIO); 2189 if (bdaddr) {
2190 struct mgmt_rp_disconnect rp;
2191
2192 bacpy(&rp.bdaddr, bdaddr);
2193 rp.status = status;
2194
2195 err = cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT,
2196 &rp, sizeof(rp));
2197 } else
2198 err = cmd_status(cmd->sk, hdev->id, MGMT_OP_DISCONNECT,
2199 status);
2189 2200
2190 mgmt_pending_remove(cmd); 2201 mgmt_pending_remove(cmd);
2191 2202