Skip to contentSkip to conversation

Bluetooth: Add le_scan_restart

PATCH Superseded Jakub Pawlowski 1 participant 2 messages Jan 16, 2015

Subsystems (2)

v9 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v9 1/2 Bluetooth: Add le_scan_restart

Currently there is no way to restart le scan, and it's needed in service scan method. The way it work: it disable, and then enable le scan on controller.

---
 include/net/bluetooth/hci_core.h |  3 +++
 net/bluetooth/hci_core.c         | 55 ++++++++++++++++++++++++++++++++++++++++
 net/bluetooth/mgmt.c             |  7 ++++-
 3 files changed, 64 insertions(+), 1 deletion(-)
include/net/bluetooth/hci_core.h +3 -0
index 7777124..1d172bf 100644
@@ -79,6 +79,7 @@ struct discovery_state {
 	s8			rssi;
 	u16			uuid_count;
 	u8			(*uuids)[16];
+	long			scan_end;
 };
 
 struct hci_conn_hash {
@@ -351,6 +352,7 @@ struct hci_dev {
 	unsigned long		dev_flags;
 
 	struct delayed_work	le_scan_disable;
+	struct delayed_work	le_scan_restart;
 
 	__s8			adv_tx_power;
 	__u8			adv_data[HCI_MAX_AD_LENGTH];
@@ -527,6 +529,7 @@ static inline void hci_discovery_filter_clear(struct hci_dev *hdev)
 	hdev->discovery.uuid_count = 0;
 	kfree(hdev->discovery.uuids);
 	hdev->discovery.uuids = NULL;
+	hdev->discovery.scan_end = 0;
 }
 
 bool hci_discovery_active(struct hci_dev *hdev);
net/bluetooth/hci_core.c +55 -0

91 lines not on this page · raw message

net/bluetooth/mgmt.c +6 -1
index f5c4d2e..c2b5f8a 100644
@@ -3878,9 +3878,14 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status,
 		break;
 	}
 
-	if (timeout)
+	if (timeout) {
+		if (hdev->discovery.uuid_count > 0 &&
+		    test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks))
+			hdev->discovery.scan_end = jiffies + timeout;
+
 		queue_delayed_work(hdev->workqueue,
 				   &hdev->le_scan_disable, timeout);
+	}
 
 unlock:
 	hci_dev_unlock(hdev);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH v9 2/2 Bluetooth: Add restarting to service discovery

When using LE_SCAN_FILTER_DUP_ENABLE, some controllers would send advertising report from each LE device only once. That means that we don't get any updates on RSSI value, and makes Service Discovery very slow. This patch adds restarting scan when in Service Discovery, and device with filtered uuid is found, but it's not in RSSI range to send event yet. This way if device moves into range, we will quickly get RSSI update.

---
 include/net/bluetooth/hci_core.h |  1 +
 net/bluetooth/mgmt.c             | 48 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 45 insertions(+), 4 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
index 1d172bf..6d03e8ee 100644
@@ -1328,6 +1328,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
 #define DISCOV_INTERLEAVED_TIMEOUT	5120	/* msec */
 #define DISCOV_INTERLEAVED_INQUIRY_LEN	0x04
 #define DISCOV_BREDR_INQUIRY_LEN	0x08
+#define DISCOV_LE_RESTART_DELAY		200	/* msec */
 
 int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
 int mgmt_new_settings(struct hci_dev *hdev);
net/bluetooth/mgmt.c +44 -4

82 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c