Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b032fc39 authored by Mike J. Chen's avatar Mike J. Chen
Browse files

Make auto connect work for multiple known BLE devices



Due to a bug with wl_state not ever setting WL_INIT,
auto connect was not working for more than one known
BLE device after a reboot.  The fix is to set the WL_INIT
flag when in initiator state.

I also added code to set the WL_SCAN flag when in
scanning state.  Not sure if that fixes any bug but
it looks like it should have been done too.

WL_ADV was the only state flag previously being set.

Bug 16404692

Change-Id: Id42907c0d8301e347e603684e2c03e4905bfec49
Signed-off-by: default avatarMike J. Chen <mjchen@google.com>
parent b3ba5c3a
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -671,11 +671,14 @@ tBTM_BLE_CONN_ST btm_ble_get_conn_st(void)
void btm_ble_set_conn_st(tBTM_BLE_CONN_ST new_st)
{
    btm_cb.ble_ctr_cb.conn_state = new_st;
    if (new_st == BLE_BG_CONN || new_st == BLE_DIR_CONN)
    if (new_st == BLE_BG_CONN || new_st == BLE_DIR_CONN) {
        btm_cb.ble_ctr_cb.wl_state |= BTM_BLE_WL_INIT;
        btm_ble_set_topology_mask(BTM_BLE_STATE_INIT_BIT);
    else
    } else {
        btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_INIT;
        btm_ble_clear_topology_mask(BTM_BLE_STATE_INIT_BIT);
    }
}

/*******************************************************************************
**
+6 −1
Original line number Diff line number Diff line
@@ -2576,10 +2576,13 @@ tBTM_STATUS btm_ble_start_scan (UINT8 filter_enable)
    tBTM_STATUS status = BTM_CMD_STARTED;

    /* start scan, disable duplicate filtering */
    if (!btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_ENABLE, filter_enable))
    if (!btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_ENABLE, filter_enable)) {
        status = BTM_NO_RESOURCES;
        btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_SCAN;
    }
    else
    {
        btm_cb.ble_ctr_cb.wl_state |= BTM_BLE_WL_SCAN;
        if (p_inq->scan_type == BTM_BLE_SCAN_MODE_ACTI)
            btm_ble_set_topology_mask(BTM_BLE_STATE_ACTIVE_SCAN_BIT);
        else
@@ -2608,6 +2611,8 @@ void btm_ble_stop_scan(void)
    btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_DISABLE, BTM_BLE_DUPLICATE_ENABLE);

    btm_update_scanner_filter_policy(SP_ADV_ALL);

    btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_SCAN;
}
/*******************************************************************************
**