]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/bluetooth/mgmt.c
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
[karo-tx-linux.git] / net / bluetooth / mgmt.c
index e435438f95f030ce3703660b9c816d63b8d03ffb..ccaf5a436d8f7a70799729a04ffc17583d11913f 100644 (file)
@@ -3564,9 +3564,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
                 */
                hci_conn_params_add(hdev, &cp->addr.bdaddr, addr_type);
 
-               conn = hci_connect_le(hdev, &cp->addr.bdaddr, addr_type,
-                                     sec_level, HCI_LE_CONN_TIMEOUT,
-                                     HCI_ROLE_MASTER);
+               conn = hci_connect_le_scan(hdev, &cp->addr.bdaddr,
+                                          addr_type, sec_level,
+                                          HCI_LE_CONN_TIMEOUT,
+                                          HCI_ROLE_MASTER);
        }
 
        if (IS_ERR(conn)) {
@@ -4210,7 +4211,7 @@ static bool trigger_le_scan(struct hci_request *req, u16 interval, u8 *status)
                /* Don't let discovery abort an outgoing connection attempt
                 * that's using directed advertising.
                 */
-               if (hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) {
+               if (hci_lookup_le_connect(hdev)) {
                        *status = MGMT_STATUS_REJECTED;
                        return false;
                }
@@ -6107,6 +6108,12 @@ static int hci_conn_params_set(struct hci_request *req, bdaddr_t *addr,
        switch (auto_connect) {
        case HCI_AUTO_CONN_DISABLED:
        case HCI_AUTO_CONN_LINK_LOSS:
+               /* If auto connect is being disabled when we're trying to
+                * connect to device, keep connecting.
+                */
+               if (params->explicit_connect)
+                       list_add(&params->action, &hdev->pend_le_conns);
+
                __hci_update_background_scan(req);
                break;
        case HCI_AUTO_CONN_REPORT: