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

Commit 033b47d2 authored by Satya Calloji's avatar Satya Calloji Committed by Andre Eisenbach
Browse files

Fix SMP pairing request issue on LE

The cause of the failure:
- the master device sent the three keys to slave, but slave only receive
two and got the link drop before the third key is received.
- the slave device treats it as pairing failure due to the key missing.
SMP should wait for all keys been sent to controller before dropping the link.

Implement L2CAP fix channel tx_complete callback for this reason,
and it has been applied on the channel 6 (SMP).
Channel 7 (BR_SMP channel) was not keeping track of total_tx_unacked
number and closed the link too early. Added check in the
smp_br_key_distribution() and the ACL data tracking there before
posting SMP_BR_AUTH_CMPL_EVT.

Original author: Chaojing Sun <cjsun@broadcom.com>

Change-Id: If48a4c5e28b1d177f14ff089e8dfa3ace41eba83
parent 9be22322
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -907,8 +907,13 @@ void smp_br_select_next_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
    if (!p_cb->local_i_key && !p_cb->local_r_key)
    {
        /* state check to prevent re-entrance */
        if (p_cb->smp_over_br)
        if (smp_get_br_state() == SMP_BR_STATE_BOND_PENDING)
        {
            if (p_cb->total_tx_unacked == 0)
                smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &reason);
            else
                p_cb->wait_for_authorization_complete = TRUE;
        }
    }
}

@@ -2077,8 +2082,12 @@ void smp_key_distribution_by_transport(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
void smp_br_pairing_complete(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
    SMP_TRACE_DEBUG("%s", __func__);

    if (p_cb->total_tx_unacked == 0)
    {
        /* process the pairing complete */
        smp_proc_pairing_cmpl(p_cb);
    }
}

#endif
+7 −2
Original line number Diff line number Diff line
@@ -216,11 +216,16 @@ static void smp_tx_complete_callback (UINT16 cid, UINT16 num_pkt)
    if (p_cb->total_tx_unacked >= num_pkt)
        p_cb->total_tx_unacked -= num_pkt;
    else
        SMP_TRACE_ERROR("Unexpected %s: num_pkt = %d", __FUNCTION__,num_pkt);
        SMP_TRACE_ERROR("Unexpected %s: num_pkt = %d", __func__,num_pkt);

    UINT8 reason = SMP_SUCCESS;
    if (p_cb->total_tx_unacked == 0 && p_cb->wait_for_authorization_complete)
    {
        if (cid == L2CAP_SMP_CID)
            smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
        else
            smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &reason);
    }
}

/*******************************************************************************