summaryrefslogtreecommitdiff
path: root/net/bluetooth/hci_conn.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-07 16:02:28 +0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-07 17:18:08 +0400
commitcdd6275e510bd86c44d3fc85a78306f514bbac9a (patch)
treec9f4c491100cef5c0a68e79545b3132073e4fd3a /net/bluetooth/hci_conn.c
parentd93375a82da10cb023afc945fa18471bf3c41704 (diff)
downloadlinux-cdd6275e510bd86c44d3fc85a78306f514bbac9a.tar.xz
Bluetooth: Pass desired connection role to hci_connect_le()
If we have both LE scanning and advertising simultaneously enabled we need a way to tell hci_connect_le() in which role to initiate a connection. This patch adds a new parameter to the function to give it the necessary information. For auto-connect and mgmt_pair_device we always use master role, whereas for L2CAP users (in practice sockets) we use slave role whenever HCI_ADVERTISING is set and master role otherwise. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r--net/bluetooth/hci_conn.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 9323044f01cd..16fd55da9c1d 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -700,7 +700,8 @@ static void hci_req_directed_advertising(struct hci_request *req,
}
struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
- u8 dst_type, u8 sec_level, u16 conn_timeout)
+ u8 dst_type, u8 sec_level, u16 conn_timeout,
+ bool master)
{
struct hci_conn_params *params;
struct hci_conn *conn;
@@ -760,7 +761,8 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
hci_req_init(&req, hdev);
- if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) {
+ /* If requested to connect as slave use directed advertising */
+ if (!master) {
hci_req_directed_advertising(&req, conn);
goto create_conn;
}