diff options
author | Andre Guedes <andre.guedes@openbossa.org> | 2012-04-24 20:02:54 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo@padovan.org> | 2012-05-09 00:40:45 -0400 |
commit | b12f62cfd9f46ac70013ce661640174b489efd39 (patch) | |
tree | 5ad852475d40051fa86fe613d2b9990cd816656b /net/bluetooth/hci_conn.c | |
parent | 31f7956c6648fbae9c9550e91d1c348d28276309 (diff) |
Bluetooth: Add dst_type parameter to hci_connect
This patch adds the dst_type parameter to hci_connect function.
Instead of searching the address type in advertising cache, we
use the dst_type parameter to establish LE connections.
The dst_type is ignored for BR/EDR connection establishment.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-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.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 8f352cd1745a..a3ee1a929a6c 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -513,7 +513,8 @@ EXPORT_SYMBOL(hci_get_route); | |||
513 | 513 | ||
514 | /* Create SCO, ACL or LE connection. | 514 | /* Create SCO, ACL or LE connection. |
515 | * Device _must_ be locked */ | 515 | * Device _must_ be locked */ |
516 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type) | 516 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, |
517 | __u8 dst_type, __u8 sec_level, __u8 auth_type) | ||
517 | { | 518 | { |
518 | struct hci_conn *acl; | 519 | struct hci_conn *acl; |
519 | struct hci_conn *sco; | 520 | struct hci_conn *sco; |
@@ -522,19 +523,13 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 | |||
522 | BT_DBG("%s dst %s", hdev->name, batostr(dst)); | 523 | BT_DBG("%s dst %s", hdev->name, batostr(dst)); |
523 | 524 | ||
524 | if (type == LE_LINK) { | 525 | if (type == LE_LINK) { |
525 | struct adv_entry *entry = NULL; | ||
526 | |||
527 | le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst); | 526 | le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst); |
528 | if (!le) { | 527 | if (!le) { |
529 | entry = hci_find_adv_entry(hdev, dst); | ||
530 | if (!entry) | ||
531 | return ERR_PTR(-EHOSTUNREACH); | ||
532 | |||
533 | le = hci_conn_add(hdev, LE_LINK, dst); | 528 | le = hci_conn_add(hdev, LE_LINK, dst); |
534 | if (!le) | 529 | if (!le) |
535 | return ERR_PTR(-ENOMEM); | 530 | return ERR_PTR(-ENOMEM); |
536 | 531 | ||
537 | le->dst_type = entry->bdaddr_type; | 532 | le->dst_type = bdaddr_to_le(dst_type); |
538 | hci_le_connect(le); | 533 | hci_le_connect(le); |
539 | } | 534 | } |
540 | 535 | ||