summaryrefslogtreecommitdiffstats
path: root/btif/src/btif_dm.c
diff options
context:
space:
mode:
Diffstat (limited to 'btif/src/btif_dm.c')
-rw-r--r--btif/src/btif_dm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 75a844f..fa0330e 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -321,6 +321,10 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
bt_bdaddr_t bd_addr;
bt_bdname_t bd_name;
UINT32 cod;
+ BOOLEAN incoming_bonding;
+
+ /* if bonding state is BT_BOND_STATE_BONDING, then we initiated it */
+ incoming_bonding = !(pairing_cb.state == BT_BOND_STATE_BONDING);
BTIF_TRACE_DEBUG1("%s", __FUNCTION__);
bdcpy(bd_addr.address, p_ssp_cfm_req->bd_addr);
@@ -336,8 +340,8 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
else
pairing_cb.is_temp = TRUE;
- /* If JustWorks auto-accept */
- if (p_ssp_cfm_req->just_works)
+ /* If JustWorks auto-accept if we initiated bonding */
+ if (p_ssp_cfm_req->just_works && !incoming_bonding)
{
BTIF_TRACE_EVENT1("%s: Auto-accept JustWorks pairing", __FUNCTION__);
btif_dm_ssp_reply(&bd_addr, BT_SSP_VARIANT_CONSENT, TRUE, 0);
@@ -353,7 +357,7 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
/* TODO: pairing variant passkey_entry? */
HAL_CBACK(bt_hal_cbacks, ssp_request_cb, &bd_addr, &bd_name,
- cod, BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+ cod, p_ssp_cfm_req->just_works ? BT_SSP_VARIANT_CONSENT : BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
p_ssp_cfm_req->num_val);
}