aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJakub Pawlowski <jpawlowski@google.com>2014-12-05 04:55:55 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2014-12-05 05:37:33 -0500
commit37eab042be2196751ff108e6892951338b9a0969 (patch)
tree57ad7718aa5ed5bfb7cb0e39c5bc76291861fc56 /net/bluetooth
parent7e61df5423fe88a3e92bce59fb47686e52fb1d84 (diff)
Bluetooth: Add extra discovery fields for storing filter information
With the upcoming addition of support for Start Service Discovery, the discovery handling needs to filter on RSSI and UUID values. For that they need to be stored in the discovery handling. This patch adds the appropiate fields and also make sure they are reset when discovery has been stopped. Signed-off-by: Jakub Pawlowski <jpawlowski@google.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c14
-rw-r--r--net/bluetooth/mgmt.c2
2 files changed, 16 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index f0018562b028..42f86dc3fb40 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2052,6 +2052,20 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
2052 case DISCOVERY_STOPPED: 2052 case DISCOVERY_STOPPED:
2053 hci_update_background_scan(hdev); 2053 hci_update_background_scan(hdev);
2054 2054
2055 /* Reset RSSI and UUID filters to ensure Start Discovery
2056 * and Start Service Discovery operate properly no matter
2057 * which one started the previous discovery.
2058 *
2059 * While the Start Discovery and Start Service Discovery
2060 * operations will set proper values for RSSI and UUID
2061 * count, it is important to actually free the allocated
2062 * list of UUIDs here.
2063 */
2064 hdev->discovery.rssi = HCI_RSSI_INVALID;
2065 hdev->discovery.uuid_count = 0;
2066 kfree(hdev->discovery.uuids);
2067 hdev->discovery.uuids = NULL;
2068
2055 if (old_state != DISCOVERY_STARTING) 2069 if (old_state != DISCOVERY_STARTING)
2056 mgmt_discovering(hdev, 0); 2070 mgmt_discovering(hdev, 0);
2057 break; 2071 break;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 415ba4179326..b6a0f3e6b719 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3867,6 +3867,8 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev,
3867 } 3867 }
3868 3868
3869 hdev->discovery.type = cp->type; 3869 hdev->discovery.type = cp->type;
3870 hdev->discovery.rssi = HCI_RSSI_INVALID;
3871 hdev->discovery.uuid_count = 0;
3870 3872
3871 hci_req_init(&req, hdev); 3873 hci_req_init(&req, hdev);
3872 3874