]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: Make LE scan interval and window a controller option
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 11 Oct 2013 15:23:19 +0000 (08:23 -0700)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 11 Oct 2013 16:18:11 +0000 (18:18 +0200)
The scan interval and window for LE passive scanning and connection
establishment should be configurable on a per controller basis. So
introduce a setting that later on will allow modifying it.

This setting does not affect LE active scanning during device
discovery phase. As long as that phase uses interleaved discovery,
it will continuously scan.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_conn.c
net/bluetooth/hci_core.c

index 0e01dc257880c569391d4fe15fb27b864b0ddf32..690045498420216c542aee2b62e358397e96c4e9 100644 (file)
@@ -164,6 +164,8 @@ struct hci_dev {
        __u16           page_scan_interval;
        __u16           page_scan_window;
        __u8            page_scan_type;
+       __u16           le_scan_interval;
+       __u16           le_scan_window;
 
        __u16           devid_source;
        __u16           devid_vendor;
index 139587159200f86cf1c315d051a061e0961b3d0e..c52bfb7e44fd8cd72c42e02bd7af337edbc82c14 100644 (file)
@@ -562,8 +562,8 @@ static int hci_create_le_conn(struct hci_conn *conn)
        hci_req_init(&req, hdev);
 
        memset(&cp, 0, sizeof(cp));
-       cp.scan_interval = __constant_cpu_to_le16(0x0060);
-       cp.scan_window = __constant_cpu_to_le16(0x0030);
+       cp.scan_interval = cpu_to_le16(hdev->le_scan_interval);
+       cp.scan_window = cpu_to_le16(hdev->le_scan_window);
        bacpy(&cp.peer_addr, &conn->dst);
        cp.peer_addr_type = conn->dst_type;
        if (bacmp(&hdev->bdaddr, BDADDR_ANY))
index a097a623912a60670c5708db7f0efcb599cfe3ee..1910dc2d33cf7037566b06bf280b5747e3650ac2 100644 (file)
@@ -2273,6 +2273,9 @@ struct hci_dev *hci_alloc_dev(void)
        hdev->sniff_max_interval = 800;
        hdev->sniff_min_interval = 80;
 
+       hdev->le_scan_interval = 0x0060;
+       hdev->le_scan_window = 0x0030;
+
        mutex_init(&hdev->lock);
        mutex_init(&hdev->req_lock);