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

Commit 9abe5d6b authored by Mallikarjuna GB's avatar Mallikarjuna GB Committed by Andre Eisenbach
Browse files

Initiate SCO after Mode change event

Use case:
1. Connect a headset to AG.
2. Make an outgoing call using headset.

Failure:
SCO connection request is rejected by headset.

Root cause:
AG initiated SCO connection when mode change is pending
on headset. Remote is coming out of sniff and rejected
SCO connection request.

Fix:
AG initiates SCO connection request once AG receives mode
change event. It resolves a corner case where remote failed
to accept SCO connection when initiated in between unsniff
LMP request. Issue is seen with WEP301 headset.

Change-Id: I4ea5d073630320b30f90e6141f4daf25943cca0b
parent 0aee6870
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -583,9 +583,9 @@ tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, BOOLEAN is_orig, UINT16 pkt_types
    tACL_CONN        *p_acl;

#if (BTM_SCO_WAKE_PARKED_LINK == TRUE)
    tBTM_PM_MODE      md;
    tBTM_PM_PWR_MD    pm;
#else  // BTM_SCO_WAKE_PARKED_LINK
    tBTM_PM_STATE     state;
#else
    UINT8             mode;
#endif  // BTM_SCO_WAKE_PARKED_LINK

@@ -632,10 +632,12 @@ tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, BOOLEAN is_orig, UINT16 pkt_types
                {
                    /* can not create SCO link if in park mode */
#if BTM_SCO_WAKE_PARKED_LINK == TRUE
                    if(BTM_ReadPowerMode(remote_bda, &md) == BTM_SUCCESS)
                    if ((btm_read_power_mode_state(p->esco.data.bd_addr, &state) == BTM_SUCCESS))
                    {
                        if (md == BTM_PM_MD_PARK || md == BTM_PM_MD_SNIFF)
                        if (state == BTM_PM_ST_SNIFF || state == BTM_PM_ST_PARK ||
                            state == BTM_PM_ST_PENDING)
                        {
                            BTM_TRACE_DEBUG("%s In sniff, park or pend mode: %d", __func__, state);
                            memset( (void*)&pm, 0, sizeof(pm));
                            pm.mode = BTM_PM_MD_ACTIVE;
                            BTM_SetPowerMode(BTM_PM_SET_ONLY_ID, remote_bda, &pm);