diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-11-10 14:54:39 +0100 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-11-10 21:05:41 +0100 |
commit | 37d9ef76c26092098e8fbd3fd540b7ac2181e6bf (patch) | |
tree | f46e360fc4d8b9d0a3e07b5fcf111d2be297fd8d /net/bluetooth/mgmt.c | |
parent | Bluetooth: Add proper response to mgmt_remove_keys command (diff) | |
download | linux-37d9ef76c26092098e8fbd3fd540b7ac2181e6bf.tar.xz linux-37d9ef76c26092098e8fbd3fd540b7ac2181e6bf.zip |
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 '')
-rw-r--r-- | net/bluetooth/mgmt.c | 15 |
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) struct mgmt_rp_disconnect rp; bacpy(&rp.bdaddr, &cp->bdaddr); + rp.status = 0; cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT, &rp, sizeof(rp)); @@ -2176,7 +2177,7 @@ int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, return err; } -int mgmt_disconnect_failed(struct hci_dev *hdev) +int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status) { struct pending_cmd *cmd; int err; @@ -2185,7 +2186,17 @@ int mgmt_disconnect_failed(struct hci_dev *hdev) if (!cmd) return -ENOENT; - err = cmd_status(cmd->sk, hdev->id, MGMT_OP_DISCONNECT, EIO); + if (bdaddr) { + struct mgmt_rp_disconnect rp; + + bacpy(&rp.bdaddr, bdaddr); + rp.status = status; + + err = cmd_complete(cmd->sk, cmd->index, MGMT_OP_DISCONNECT, + &rp, sizeof(rp)); + } else + err = cmd_status(cmd->sk, hdev->id, MGMT_OP_DISCONNECT, + status); mgmt_pending_remove(cmd); |