aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-01-04 06:39:52 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 10:01:20 -0500
commit3175405b906a85ed2bad21e09c444266e4a05a8e (patch)
treecf75dda123120a5a48ee322c3248ea73d37cbdcc /net/bluetooth/hci_event.c
parent561aafbcb2e3f8fee11d3781f866c7b4c4f93a28 (diff)
Bluetooth: Return updated name state with hci_inquiry_cache_update
If user-space has already confirmed the name for a remote device we shouldn't request confirmation again. The simplest way to do this is to return the name state from hci_inquiry_cache_update (if it is anything else than unknown then we do not need confirmation from user-space). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 9302c3c25568..d4d20df9fbbf 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1525,6 +1525,8 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *
1525 hci_dev_lock(hdev); 1525 hci_dev_lock(hdev);
1526 1526
1527 for (; num_rsp; num_rsp--, info++) { 1527 for (; num_rsp; num_rsp--, info++) {
1528 bool name_known;
1529
1528 bacpy(&data.bdaddr, &info->bdaddr); 1530 bacpy(&data.bdaddr, &info->bdaddr);
1529 data.pscan_rep_mode = info->pscan_rep_mode; 1531 data.pscan_rep_mode = info->pscan_rep_mode;
1530 data.pscan_period_mode = info->pscan_period_mode; 1532 data.pscan_period_mode = info->pscan_period_mode;
@@ -1533,9 +1535,10 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *
1533 data.clock_offset = info->clock_offset; 1535 data.clock_offset = info->clock_offset;
1534 data.rssi = 0x00; 1536 data.rssi = 0x00;
1535 data.ssp_mode = 0x00; 1537 data.ssp_mode = 0x00;
1536 hci_inquiry_cache_update(hdev, &data, false); 1538
1539 name_known = hci_inquiry_cache_update(hdev, &data, false);
1537 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, 1540 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
1538 info->dev_class, 0, 1, NULL); 1541 info->dev_class, 0, !name_known, NULL);
1539 } 1542 }
1540 1543
1541 hci_dev_unlock(hdev); 1544 hci_dev_unlock(hdev);
@@ -2551,6 +2554,7 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
2551{ 2554{
2552 struct inquiry_data data; 2555 struct inquiry_data data;
2553 int num_rsp = *((__u8 *) skb->data); 2556 int num_rsp = *((__u8 *) skb->data);
2557 bool name_known;
2554 2558
2555 BT_DBG("%s num_rsp %d", hdev->name, num_rsp); 2559 BT_DBG("%s num_rsp %d", hdev->name, num_rsp);
2556 2560
@@ -2572,10 +2576,12 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
2572 data.clock_offset = info->clock_offset; 2576 data.clock_offset = info->clock_offset;
2573 data.rssi = info->rssi; 2577 data.rssi = info->rssi;
2574 data.ssp_mode = 0x00; 2578 data.ssp_mode = 0x00;
2575 hci_inquiry_cache_update(hdev, &data, false); 2579
2580 name_known = hci_inquiry_cache_update(hdev, &data,
2581 false);
2576 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, 2582 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
2577 info->dev_class, info->rssi, 2583 info->dev_class, info->rssi,
2578 1, NULL); 2584 !name_known, NULL);
2579 } 2585 }
2580 } else { 2586 } else {
2581 struct inquiry_info_with_rssi *info = (void *) (skb->data + 1); 2587 struct inquiry_info_with_rssi *info = (void *) (skb->data + 1);
@@ -2589,10 +2595,11 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
2589 data.clock_offset = info->clock_offset; 2595 data.clock_offset = info->clock_offset;
2590 data.rssi = info->rssi; 2596 data.rssi = info->rssi;
2591 data.ssp_mode = 0x00; 2597 data.ssp_mode = 0x00;
2592 hci_inquiry_cache_update(hdev, &data, false); 2598 name_known = hci_inquiry_cache_update(hdev, &data,
2599 false);
2593 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, 2600 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
2594 info->dev_class, info->rssi, 2601 info->dev_class, info->rssi,
2595 1, NULL); 2602 !name_known, NULL);
2596 } 2603 }
2597 } 2604 }
2598 2605
@@ -2766,7 +2773,7 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
2766 else 2773 else
2767 name_known = true; 2774 name_known = true;
2768 2775
2769 hci_inquiry_cache_update(hdev, &data, name_known); 2776 name_known = hci_inquiry_cache_update(hdev, &data, name_known);
2770 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, 2777 mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
2771 info->dev_class, info->rssi, 2778 info->dev_class, info->rssi,
2772 !name_known, info->data); 2779 !name_known, info->data);