summaryrefslogtreecommitdiff
path: root/net/bluetooth/hci_conn.c
diff options
context:
space:
mode:
authorJakub Pawlowski <jpawlowski@google.com>2015-10-16 10:07:49 +0300
committerMarcel Holtmann <marcel@holtmann.org>2015-10-16 09:24:41 +0200
commit168b8a25c0ac30f427bfe6ad547779c4c363d042 (patch)
treeb9a0234a48615d388821a9760d3c29914e16fddd /net/bluetooth/hci_conn.c
parent53ca376eec4eb635e2249c8e89093f499e180731 (diff)
Bluetooth: Fix double scan updates
When disable/enable scan command is issued twice, some controllers will return an error for the second request, i.e. requests with this command will fail on some controllers, and succeed on others. This patch makes sure that unnecessary scan disable/enable commands are not issued. When adding device to the auto connect whitelist when there is pending connect attempt, there is no need to update scan. hci_connect_le_scan_cleanup is conditionally executing hci_conn_params_del, that is calling hci_update_background_scan. Make the other case also update scan, and remove reduntand call from hci_connect_le_scan_remove. When stopping interleaved discovery the state should be set to stopped only when both LE scanning and discovery has stopped. Signed-off-by: Jakub Pawlowski <jpawlowski@google.com> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r--net/bluetooth/hci_conn.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index b4548c739a64..2ebcaaa6b855 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -91,10 +91,12 @@ static void hci_connect_le_scan_cleanup(struct hci_conn *conn)
* autoconnect action, remove them completely. If they are, just unmark
* them as waiting for connection, by clearing explicit_connect field.
*/
- if (params->auto_connect == HCI_AUTO_CONN_EXPLICIT)
+ if (params->auto_connect == HCI_AUTO_CONN_EXPLICIT) {
hci_conn_params_del(conn->hdev, bdaddr, bdaddr_type);
- else
+ } else {
params->explicit_connect = false;
+ hci_update_background_scan(conn->hdev);
+ }
}
/* This function requires the caller holds hdev->lock */
@@ -103,7 +105,6 @@ static void hci_connect_le_scan_remove(struct hci_conn *conn)
hci_connect_le_scan_cleanup(conn);
hci_conn_hash_del(conn->hdev, conn);
- hci_update_background_scan(conn->hdev);
}
static void hci_acl_create_connection(struct hci_conn *conn)