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

Commit 1426ba1d authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

Revert "Unable to connect to a Motorola s705 until Bluetooth was toggled of and back on"

This reverts commit 05736f53.

This patch caused various headset audio break issues and slow
reconnections on headsets like the Bose AE2W.

Based on the original bug under which this patch was merged
(b/10648781) it is unlikely that this bug even fixed the
issue it was meant to address.

Bug: 17520043
Change-Id: I39bb9abbf5735abff25b5257425c34972287dc27
parent 7b10d07e
Loading
Loading
Loading
Loading
+1 −49
Original line number Diff line number Diff line
@@ -48,52 +48,6 @@ static void btm_process_remote_ext_features (tACL_CONN *p_acl_cb, UINT8 num_read

#define BTM_DEV_REPLY_TIMEOUT   3       /* 3 second timeout waiting for responses */

/*******************************************************************************
**
** Function         btm_save_remote_device_role
**
** Description      This function is to save remote device role
**
** Returns          void
**
*******************************************************************************/
static void btm_save_remote_device_role(BD_ADDR bd_addr, UINT8 role)
{
    UINT8 i, j;
    if (role == BTM_ROLE_UNDEFINED) return;

    for (i = 0; i < BTM_ROLE_DEVICE_NUM; i++) {
        if ((btm_cb.previous_connected_role[i] != BTM_ROLE_UNDEFINED) &&
            (!bdcmp(bd_addr, btm_cb.previous_connected_remote_addr[i]))) {
            break;
        }
    }

    if (i < BTM_ROLE_DEVICE_NUM) {
        UINT8 end;
        if (i < btm_cb.front) {
            for (j = i; j > 0; j--) {
                bdcpy(btm_cb.previous_connected_remote_addr[j],
                    btm_cb.previous_connected_remote_addr[j-1]);
            }
            bdcpy(btm_cb.previous_connected_remote_addr[0],
                btm_cb.previous_connected_remote_addr[BTM_ROLE_DEVICE_NUM-1]);
            end = BTM_ROLE_DEVICE_NUM-1;
        } else {
            end = i;
        }

        for (j = end; j > btm_cb.front; j--) {
            bdcpy(btm_cb.previous_connected_remote_addr[j],
                btm_cb.previous_connected_remote_addr[j-1]);
        }
    }

    bdcpy(btm_cb.previous_connected_remote_addr[btm_cb.front], bd_addr);
    btm_cb.previous_connected_role[btm_cb.front] = role;
    btm_cb.front = (btm_cb.front + 1) % BTM_ROLE_DEVICE_NUM;
}

/*******************************************************************************
**
** Function         btm_acl_init
@@ -268,7 +222,6 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
    {
        p->hci_handle = hci_handle;
        p->link_role  = link_role;
        btm_save_remote_device_role(bda, link_role);
#if BLE_INCLUDED == TRUE
        p->transport = transport;
#endif
@@ -286,7 +239,6 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
            p->in_use            = TRUE;
            p->hci_handle        = hci_handle;
            p->link_role         = link_role;
            btm_save_remote_device_role(bda, link_role);
            p->link_up_issued    = FALSE;

#if BLE_INCLUDED == TRUE
@@ -2372,7 +2324,7 @@ void btm_acl_role_changed (UINT8 hci_status, BD_ADDR bd_addr, UINT8 new_role)

        /* Update cached value */
        p->link_role = new_role;
        btm_save_remote_device_role(p_bda, new_role);

        /* Reload LSTO: link supervision timeout is reset in the LM after a role switch */
        if (new_role == BTM_ROLE_MASTER)
        {
+0 −7
Original line number Diff line number Diff line
@@ -52,10 +52,6 @@ typedef char tBTM_LOC_BD_NAME[BTM_MAX_LOC_BD_NAME_LEN + 1];
*/
#define BTM_MAX_SCN      PORT_MAX_RFC_PORTS

/* Definition for number of the remote device role saved
*/
#define BTM_ROLE_DEVICE_NUM      4

/* Define masks for supported and exception 2.0 ACL packet types
*/
#define BTM_ACL_SUPPORTED_PKTS_MASK      (HCI_PKT_TYPES_MASK_DM1        | \
@@ -940,9 +936,6 @@ typedef struct
    tBTM_PCM2_ACTION        pcm2_action;
#endif

    BD_ADDR previous_connected_remote_addr[BTM_ROLE_DEVICE_NUM];
    UINT8   previous_connected_role[BTM_ROLE_DEVICE_NUM];
    UINT8   front; /* front index of the role table */
} tBTM_CB;


+0 −4
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ tBTM_CB btm_cb;
*******************************************************************************/
void btm_init (void)
{
    UINT8 i;
    /* All fields are cleared; nonzero fields are reinitialized in appropriate function */
    memset(&btm_cb, 0, sizeof(tBTM_CB));

@@ -57,9 +56,6 @@ void btm_init (void)
#else
    btm_cb.trace_level = BT_TRACE_LEVEL_NONE;    /* No traces */
#endif
    for (i = 0; i < BTM_ROLE_DEVICE_NUM; i++) {
        btm_cb.previous_connected_role[i] = BTM_ROLE_UNDEFINED;
    }
    /* Initialize BTM component structures */
    btm_inq_db_init();                  /* Inquiry Database and Structures */
    btm_acl_init();                     /* ACL Database and Structures */
+0 −9
Original line number Diff line number Diff line
@@ -297,15 +297,6 @@ tL2C_LCB *l2cu_find_lcb_by_bd_addr (BD_ADDR p_bd_addr, tBT_TRANSPORT transport)
*******************************************************************************/
UINT8 l2cu_get_conn_role (tL2C_LCB *p_this_lcb)
{
    UINT8 i;
    for (i = 0; i < BTM_ROLE_DEVICE_NUM; i++) {
        if ((btm_cb.previous_connected_role[i] != BTM_ROLE_UNDEFINED) &&
            (!bdcmp(p_this_lcb->remote_bd_addr, btm_cb.previous_connected_remote_addr[i]))) {
            L2CAP_TRACE_WARNING ("l2cu_get_conn_role %d",
                                  btm_cb.previous_connected_role[i]);
            return btm_cb.previous_connected_role[i];
        }
    }
    return l2cb.desire_role;
}