Commit bd98b996 authored by Johan Hedberg's avatar Johan Hedberg Committed by Gustavo Padovan

Bluetooth: Fix updating page scan parameters when not necessary

Now that the current page scan parameters are stored in struct hci_dev
we should check against those values before sending new HCI commands to
change them.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent 4a3ee763
...@@ -1002,6 +1002,7 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data, ...@@ -1002,6 +1002,7 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
static void write_fast_connectable(struct hci_request *req, bool enable) static void write_fast_connectable(struct hci_request *req, bool enable)
{ {
struct hci_dev *hdev = req->hdev;
struct hci_cp_write_page_scan_activity acp; struct hci_cp_write_page_scan_activity acp;
u8 type; u8 type;
...@@ -1019,7 +1020,12 @@ static void write_fast_connectable(struct hci_request *req, bool enable) ...@@ -1019,7 +1020,12 @@ static void write_fast_connectable(struct hci_request *req, bool enable)
acp.window = __constant_cpu_to_le16(0x0012); acp.window = __constant_cpu_to_le16(0x0012);
hci_req_add(req, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY, sizeof(acp), &acp); if (__cpu_to_le16(hdev->page_scan_interval) != acp.interval ||
__cpu_to_le16(hdev->page_scan_window) != acp.window)
hci_req_add(req, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY,
sizeof(acp), &acp);
if (hdev->page_scan_type != type)
hci_req_add(req, HCI_OP_WRITE_PAGE_SCAN_TYPE, 1, &type); hci_req_add(req, HCI_OP_WRITE_PAGE_SCAN_TYPE, 1, &type);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment