diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-07-11 12:50:20 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-07-11 12:50:20 +0200 |
commit | 0dc19510430b20b3b2d6d1b9b796fd42fa2af64a (patch) | |
tree | a512cf400d74d72272ce6cf5c4d782538213d433 /net/bluetooth/mgmt.c | |
parent | b52a2c472d7fcf215e31dffdd382651e1b99f138 (diff) | |
parent | bd0a521e88aa7a06ae7aabaed7ae196ed4ad867a (diff) |
Merge tag 'v3.5-rc6' into next/soc
Linux 3.5-rc6
Dependency for imx/soc changes
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r-- | net/bluetooth/mgmt.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 25d22077607..3e5e3362ea0 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -1598,7 +1598,7 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data, else conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr); - if (!conn) { + if (!conn || conn->state == BT_OPEN || conn->state == BT_CLOSED) { err = cmd_status(sk, hdev->id, MGMT_OP_DISCONNECT, MGMT_STATUS_NOT_CONNECTED); goto failed; @@ -1873,6 +1873,22 @@ static void pairing_complete_cb(struct hci_conn *conn, u8 status) pairing_complete(cmd, mgmt_status(status)); } +static void le_connect_complete_cb(struct hci_conn *conn, u8 status) +{ + struct pending_cmd *cmd; + + BT_DBG("status %u", status); + + if (!status) + return; + + cmd = find_pairing(conn); + if (!cmd) + BT_DBG("Unable to find a pending command"); + else + pairing_complete(cmd, mgmt_status(status)); +} + static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) { @@ -1934,6 +1950,8 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data, /* For LE, just connecting isn't a proof that the pairing finished */ if (cp->addr.type == BDADDR_BREDR) conn->connect_cfm_cb = pairing_complete_cb; + else + conn->connect_cfm_cb = le_connect_complete_cb; conn->security_cfm_cb = pairing_complete_cb; conn->disconn_cfm_cb = pairing_complete_cb; |