diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-22 17:38:59 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-23 06:07:01 -0500 |
commit | 388fc8faf200f80159353eb86cde4ab75d0a0bbd (patch) | |
tree | e6cfe71be84ad9a14c534ef01b2c4fb0be8f1118 /net | |
parent | 9a395a80dc6a2004787539dcc0c7d167ba87e89a (diff) |
Bluetooth: mgmt: Add legacy pairing info to dev_found events
This patch makes sure that legacy pairing vs SSP infomation gets
properly propageted to the device_found events in the form of the legacy
pairing flag.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_core.c | 8 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 26 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 4 |
3 files changed, 24 insertions, 14 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 2ab78bfc108e..e6cbb8a1f47d 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -466,15 +466,21 @@ void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, | |||
466 | } | 466 | } |
467 | 467 | ||
468 | bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, | 468 | bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, |
469 | bool name_known) | 469 | bool name_known, bool *ssp) |
470 | { | 470 | { |
471 | struct discovery_state *cache = &hdev->discovery; | 471 | struct discovery_state *cache = &hdev->discovery; |
472 | struct inquiry_entry *ie; | 472 | struct inquiry_entry *ie; |
473 | 473 | ||
474 | BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr)); | 474 | BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr)); |
475 | 475 | ||
476 | if (ssp) | ||
477 | *ssp = data->ssp_mode; | ||
478 | |||
476 | ie = hci_inquiry_cache_lookup(hdev, &data->bdaddr); | 479 | ie = hci_inquiry_cache_lookup(hdev, &data->bdaddr); |
477 | if (ie) { | 480 | if (ie) { |
481 | if (ie->data.ssp_mode && ssp) | ||
482 | *ssp = true; | ||
483 | |||
478 | if (ie->name_state == NAME_NEEDED && | 484 | if (ie->name_state == NAME_NEEDED && |
479 | data->rssi != ie->data.rssi) { | 485 | data->rssi != ie->data.rssi) { |
480 | ie->data.rssi = data->rssi; | 486 | ie->data.rssi = data->rssi; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 9b30587c0de6..276f3ac06089 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1696,7 +1696,7 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff * | |||
1696 | hci_dev_lock(hdev); | 1696 | hci_dev_lock(hdev); |
1697 | 1697 | ||
1698 | for (; num_rsp; num_rsp--, info++) { | 1698 | for (; num_rsp; num_rsp--, info++) { |
1699 | bool name_known; | 1699 | bool name_known, ssp; |
1700 | 1700 | ||
1701 | bacpy(&data.bdaddr, &info->bdaddr); | 1701 | bacpy(&data.bdaddr, &info->bdaddr); |
1702 | data.pscan_rep_mode = info->pscan_rep_mode; | 1702 | data.pscan_rep_mode = info->pscan_rep_mode; |
@@ -1707,9 +1707,9 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff * | |||
1707 | data.rssi = 0x00; | 1707 | data.rssi = 0x00; |
1708 | data.ssp_mode = 0x00; | 1708 | data.ssp_mode = 0x00; |
1709 | 1709 | ||
1710 | name_known = hci_inquiry_cache_update(hdev, &data, false); | 1710 | name_known = hci_inquiry_cache_update(hdev, &data, false, &ssp); |
1711 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, | 1711 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, |
1712 | info->dev_class, 0, !name_known, | 1712 | info->dev_class, 0, !name_known, ssp, |
1713 | NULL, 0); | 1713 | NULL, 0); |
1714 | } | 1714 | } |
1715 | 1715 | ||
@@ -2783,7 +2783,7 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct | |||
2783 | { | 2783 | { |
2784 | struct inquiry_data data; | 2784 | struct inquiry_data data; |
2785 | int num_rsp = *((__u8 *) skb->data); | 2785 | int num_rsp = *((__u8 *) skb->data); |
2786 | bool name_known; | 2786 | bool name_known, ssp; |
2787 | 2787 | ||
2788 | BT_DBG("%s num_rsp %d", hdev->name, num_rsp); | 2788 | BT_DBG("%s num_rsp %d", hdev->name, num_rsp); |
2789 | 2789 | ||
@@ -2807,10 +2807,10 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct | |||
2807 | data.ssp_mode = 0x00; | 2807 | data.ssp_mode = 0x00; |
2808 | 2808 | ||
2809 | name_known = hci_inquiry_cache_update(hdev, &data, | 2809 | name_known = hci_inquiry_cache_update(hdev, &data, |
2810 | false); | 2810 | false, &ssp); |
2811 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, | 2811 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, |
2812 | info->dev_class, info->rssi, | 2812 | info->dev_class, info->rssi, |
2813 | !name_known, NULL, 0); | 2813 | !name_known, ssp, NULL, 0); |
2814 | } | 2814 | } |
2815 | } else { | 2815 | } else { |
2816 | struct inquiry_info_with_rssi *info = (void *) (skb->data + 1); | 2816 | struct inquiry_info_with_rssi *info = (void *) (skb->data + 1); |
@@ -2825,10 +2825,10 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct | |||
2825 | data.rssi = info->rssi; | 2825 | data.rssi = info->rssi; |
2826 | data.ssp_mode = 0x00; | 2826 | data.ssp_mode = 0x00; |
2827 | name_known = hci_inquiry_cache_update(hdev, &data, | 2827 | name_known = hci_inquiry_cache_update(hdev, &data, |
2828 | false); | 2828 | false, &ssp); |
2829 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, | 2829 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, |
2830 | info->dev_class, info->rssi, | 2830 | info->dev_class, info->rssi, |
2831 | !name_known, NULL, 0); | 2831 | !name_known, ssp, NULL, 0); |
2832 | } | 2832 | } |
2833 | } | 2833 | } |
2834 | 2834 | ||
@@ -2964,7 +2964,7 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct | |||
2964 | hci_dev_lock(hdev); | 2964 | hci_dev_lock(hdev); |
2965 | 2965 | ||
2966 | for (; num_rsp; num_rsp--, info++) { | 2966 | for (; num_rsp; num_rsp--, info++) { |
2967 | bool name_known; | 2967 | bool name_known, ssp; |
2968 | 2968 | ||
2969 | bacpy(&data.bdaddr, &info->bdaddr); | 2969 | bacpy(&data.bdaddr, &info->bdaddr); |
2970 | data.pscan_rep_mode = info->pscan_rep_mode; | 2970 | data.pscan_rep_mode = info->pscan_rep_mode; |
@@ -2982,10 +2982,11 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct | |||
2982 | else | 2982 | else |
2983 | name_known = true; | 2983 | name_known = true; |
2984 | 2984 | ||
2985 | name_known = hci_inquiry_cache_update(hdev, &data, name_known); | 2985 | name_known = hci_inquiry_cache_update(hdev, &data, name_known, |
2986 | &ssp); | ||
2986 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, | 2987 | mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, |
2987 | info->dev_class, info->rssi, | 2988 | info->dev_class, info->rssi, |
2988 | !name_known, info->data, | 2989 | !name_known, ssp, info->data, |
2989 | sizeof(info->data)); | 2990 | sizeof(info->data)); |
2990 | } | 2991 | } |
2991 | 2992 | ||
@@ -3310,7 +3311,8 @@ static inline void hci_le_adv_report_evt(struct hci_dev *hdev, | |||
3310 | 3311 | ||
3311 | rssi = ev->data[ev->length]; | 3312 | rssi = ev->data[ev->length]; |
3312 | mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type, | 3313 | mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type, |
3313 | NULL, rssi, 0, ev->data, ev->length); | 3314 | NULL, rssi, 0, 1, ev->data, |
3315 | ev->length); | ||
3314 | 3316 | ||
3315 | ptr += sizeof(*ev) + ev->length + 1; | 3317 | ptr += sizeof(*ev) + ev->length + 1; |
3316 | } | 3318 | } |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index b7b10ca297d5..42d665bdc01f 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -3730,7 +3730,7 @@ int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status) | |||
3730 | 3730 | ||
3731 | int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 3731 | int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
3732 | u8 addr_type, u8 *dev_class, s8 rssi, | 3732 | u8 addr_type, u8 *dev_class, s8 rssi, |
3733 | u8 cfm_name, u8 *eir, u16 eir_len) | 3733 | u8 cfm_name, u8 ssp, u8 *eir, u16 eir_len) |
3734 | { | 3734 | { |
3735 | char buf[512]; | 3735 | char buf[512]; |
3736 | struct mgmt_ev_device_found *ev = (void *) buf; | 3736 | struct mgmt_ev_device_found *ev = (void *) buf; |
@@ -3747,6 +3747,8 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | |||
3747 | ev->rssi = rssi; | 3747 | ev->rssi = rssi; |
3748 | if (cfm_name) | 3748 | if (cfm_name) |
3749 | ev->flags[0] |= MGMT_DEV_FOUND_CONFIRM_NAME; | 3749 | ev->flags[0] |= MGMT_DEV_FOUND_CONFIRM_NAME; |
3750 | if (!ssp) | ||
3751 | ev->flags[0] |= MGMT_DEV_FOUND_LEGACY_PAIRING; | ||
3750 | 3752 | ||
3751 | if (eir_len > 0) | 3753 | if (eir_len > 0) |
3752 | memcpy(ev->eir, eir, eir_len); | 3754 | memcpy(ev->eir, eir, eir_len); |