* [PATCH v2] Bluetooth: Fix LE pairing completion on connection failure
@ 2012-06-07 14:57 Vishal Agarwal
2012-06-08 5:46 ` Johan Hedberg
2012-06-08 6:10 ` Gustavo Padovan
0 siblings, 2 replies; 3+ messages in thread
From: Vishal Agarwal @ 2012-06-07 14:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: naresh.gupta, Vishal Agarwal
For BR/EDR pairing is assumed to be finished when connection is
done. For LE if connection is successful it did not necessarily
mean that pairing is also done but if the connection is unsuccessful
it should be assumed that pairing procedure is also finished.
This patch registers a new function with connect_cfm_cb callback for
LE link which sends the pairing complete signal to user space if
connection is unsuccessful.
Signed-off-by: Vishal Agarwal <vishal.agarwal@stericsson.com>
---
net/bluetooth/mgmt.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 958f764..ce97c37 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -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)
{
@@ -1941,6 +1957,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;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] Bluetooth: Fix LE pairing completion on connection failure
2012-06-07 14:57 [PATCH v2] Bluetooth: Fix LE pairing completion on connection failure Vishal Agarwal
@ 2012-06-08 5:46 ` Johan Hedberg
2012-06-08 6:10 ` Gustavo Padovan
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-06-08 5:46 UTC (permalink / raw)
To: Vishal Agarwal; +Cc: linux-bluetooth, naresh.gupta
On Thu, Jun 07, 2012, Vishal Agarwal wrote:
> For BR/EDR pairing is assumed to be finished when connection is
> done. For LE if connection is successful it did not necessarily
> mean that pairing is also done but if the connection is unsuccessful
> it should be assumed that pairing procedure is also finished.
> This patch registers a new function with connect_cfm_cb callback for
> LE link which sends the pairing complete signal to user space if
> connection is unsuccessful.
>
> Signed-off-by: Vishal Agarwal <vishal.agarwal@stericsson.com>
> ---
> net/bluetooth/mgmt.c | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Note to Gustavo: this is one of the patches that should go to
bluetooth.git as it's important that any known LE bugs get fixed for
3.5.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Bluetooth: Fix LE pairing completion on connection failure
2012-06-07 14:57 [PATCH v2] Bluetooth: Fix LE pairing completion on connection failure Vishal Agarwal
2012-06-08 5:46 ` Johan Hedberg
@ 2012-06-08 6:10 ` Gustavo Padovan
1 sibling, 0 replies; 3+ messages in thread
From: Gustavo Padovan @ 2012-06-08 6:10 UTC (permalink / raw)
To: Vishal Agarwal; +Cc: linux-bluetooth, naresh.gupta
Hi Vishal,
* Vishal Agarwal <vishal.agarwal@stericsson.com> [2012-06-07 20:27:35 +0530]:
> For BR/EDR pairing is assumed to be finished when connection is
> done. For LE if connection is successful it did not necessarily
> mean that pairing is also done but if the connection is unsuccessful
> it should be assumed that pairing procedure is also finished.
> This patch registers a new function with connect_cfm_cb callback for
> LE link which sends the pairing complete signal to user space if
> connection is unsuccessful.
>
> Signed-off-by: Vishal Agarwal <vishal.agarwal@stericsson.com>
> ---
> net/bluetooth/mgmt.c | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
Patch has been applied to bluetooth.git. Thanks.
Gustavo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-08 6:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-07 14:57 [PATCH v2] Bluetooth: Fix LE pairing completion on connection failure Vishal Agarwal
2012-06-08 5:46 ` Johan Hedberg
2012-06-08 6:10 ` Gustavo Padovan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).