summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJakub Pawlowski <jpawlowski@google.com>2014-12-05 10:55:55 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2014-12-05 11:37:33 +0100
commit37eab042be2196751ff108e6892951338b9a0969 (patch)
tree57ad7718aa5ed5bfb7cb0e39c5bc76291861fc56 /net
parentBluetooth: Add definitions for MGMT_OP_START_SERVICE_DISCOVERY (diff)
downloadlinux-37eab042be2196751ff108e6892951338b9a0969.tar.xz
linux-37eab042be2196751ff108e6892951338b9a0969.zip
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')
-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)
case DISCOVERY_STOPPED:
hci_update_background_scan(hdev);
+ /* Reset RSSI and UUID filters to ensure Start Discovery
+ * and Start Service Discovery operate properly no matter
+ * which one started the previous discovery.
+ *
+ * While the Start Discovery and Start Service Discovery
+ * operations will set proper values for RSSI and UUID
+ * count, it is important to actually free the allocated
+ * list of UUIDs here.
+ */
+ hdev->discovery.rssi = HCI_RSSI_INVALID;
+ hdev->discovery.uuid_count = 0;
+ kfree(hdev->discovery.uuids);
+ hdev->discovery.uuids = NULL;
+
if (old_state != DISCOVERY_STARTING)
mgmt_discovering(hdev, 0);
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,
}
hdev->discovery.type = cp->type;
+ hdev->discovery.rssi = HCI_RSSI_INVALID;
+ hdev->discovery.uuid_count = 0;
hci_req_init(&req, hdev);