From 2e33c936064af00e6ec9a704a01e6b36eb8cd5c8 Mon Sep 17 00:00:00 2001 From: Sreenidhi T Date: Fri, 30 Mar 2012 02:00:55 -0700 Subject: Added the check for incoming pairing consent for JustWorks. Change-Id: I2b2b70068718dbfbbea759bb5cb3f1fe67b645ba --- btif/src/btif_dm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'btif/src') 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); } -- cgit v1.1