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

Commit 3c7bb20d authored by Priti Aghera's avatar Priti Aghera Committed by Prerepa Viswanadham
Browse files

host cannot recover when connection exceed controller capability

Host can not initiate new connection when exceed controller capability
and connection then drop back to lower than the max. Controller will not
generate connection complete event when initaite LE ll connection request
failed, and host is dead loop waiting for the connection complete
then can not recover. Included a connection complete callback with failure
status when controller capability is exceeded.

bug 17326529
Change-Id: I9b863578dc868456e092f1d060e50d2c9fdcb441
parent 659c626a
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -1640,7 +1640,7 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len)
#endif
    UINT8       role, status, bda_type;
    UINT16      handle;
    BD_ADDR     bda;
    BD_ADDR     bda = {0};
    UINT16      conn_interval, conn_latency, conn_timeout;
    BOOLEAN     match = FALSE;
    UNUSED(evt_len);
@@ -1706,9 +1706,23 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len)
        }
    }
    btm_ble_set_conn_st(BLE_CONN_IDLE);
    btm_ble_update_mode_operation(role, bda, TRUE);
    btm_ble_update_mode_operation(role, bda, status);
}

/*****************************************************************************
** Function btm_ble_create_ll_conn_complete
**
** Description LE connection complete.
**
******************************************************************************/
void btm_ble_create_ll_conn_complete (UINT8 status)
{
    if (status != 0)
    {
        btm_ble_set_conn_st(BLE_CONN_IDLE);
        btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, NULL, status);
    }
}
/*****************************************************************************
**  Function        btm_proc_smp_cback
**
+2 −3
Original line number Diff line number Diff line
@@ -2844,14 +2844,13 @@ BOOLEAN btm_ble_clear_topology_mask (tBTM_BLE_STATE_MASK request_state_mask)
** Returns          void
**
*******************************************************************************/
void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, BOOLEAN conn_cancel)
void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 status)
{
    tACL_CONN   *pa = &btm_cb.acl_db[0];
    UINT16       xx;
    UINT16       mask = BTM_BLE_STATE_ALL_CONN_MASK;

    UNUSED(bd_addr);
    UNUSED (conn_cancel);

    if (link_role == HCI_ROLE_SLAVE)
    {
@@ -2880,7 +2879,7 @@ void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, BOOLEAN con
        btm_ble_set_connectability ( btm_cb.ble_ctr_cb.inq_var.connectable_mode );
    }

    if (btm_ble_get_conn_st() == BLE_CONN_IDLE)
    if (btm_ble_get_conn_st() == BLE_CONN_IDLE && status != HCI_ERR_HOST_REJECT_RESOURCES)
    {
        if (!btm_send_pending_direct_conn())
        {
+2 −2
Original line number Diff line number Diff line
@@ -334,7 +334,7 @@ extern UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_ds
extern tBTM_STATUS btm_ble_start_adv(void);
extern tBTM_STATUS btm_ble_stop_adv(void);
extern tBTM_STATUS btm_ble_start_scan (UINT8 filter_enb);

extern void btm_ble_create_ll_conn_complete (UINT8 status);

/* LE security function from btm_sec.c */
#if SMP_INCLUDED == TRUE
@@ -378,7 +378,7 @@ extern BOOLEAN btm_ble_start_select_conn(BOOLEAN start,tBTM_BLE_SEL_CBACK *p_s
extern BOOLEAN btm_ble_renew_bg_conn_params(BOOLEAN add, BD_ADDR bd_addr);
extern UINT8 btm_ble_count_unconn_dev_in_whitelist(void);
extern void btm_write_dir_conn_wl(BD_ADDR target_addr);
extern void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bda, BOOLEAN conn_ccancel);
extern void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bda, UINT8 status);
extern BOOLEAN btm_execute_wl_dev_operation(void);

/* direct connection utility */
+1 −1
Original line number Diff line number Diff line
@@ -4743,7 +4743,7 @@ void btm_sec_disconnected (UINT16 handle, UINT8 reason)

#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
    p_dev_rec->enc_key_size = 0;
    btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, p_dev_rec->bd_addr, FALSE);
    btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, p_dev_rec->bd_addr, HCI_SUCCESS);
    /* see sec_flags processing in btm_acl_removed */

    if (transport == BT_TRANSPORT_LE)
+11 −1
Original line number Diff line number Diff line
@@ -1106,7 +1106,7 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
            break;

#if (BLE_INCLUDED == TRUE)
/* BLE Commands */
/* BLE Commands sComplete*/
        case HCI_BLE_READ_WHITE_LIST_SIZE :
            btm_read_white_list_size_complete(p, evt_len);
            break;
@@ -1148,6 +1148,10 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
            btm_read_ble_local_supported_states_complete(p, evt_len);
            break;

        case HCI_BLE_CREATE_LL_CONN:
            btm_ble_create_ll_conn_complete(*p);
            break;

        case HCI_BLE_TRANSMITTER_TEST:
        case HCI_BLE_RECEIVER_TEST:
        case HCI_BLE_TEST_END:
@@ -1385,6 +1389,12 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
                        btm_sec_encrypt_change (BTM_INVALID_HCI_HANDLE, status, FALSE);
                        break;

#if BLE_INCLUDED == TRUE
                    case HCI_BLE_CREATE_LL_CONN:
                        btm_ble_create_ll_conn_complete(status);
                        break;
#endif

#if BTM_SCO_INCLUDED == TRUE
                    case HCI_SETUP_ESCO_CONNECTION:
                        /* read handle out of stored command */