summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bta/dm/bta_dm_act.c2
-rw-r--r--bta/include/bta_api.h2
-rw-r--r--btif/src/btif_dm.c36
-rwxr-xr-xstack/btm/btm_sec.c2
-rw-r--r--stack/include/btm_api.h2
5 files changed, 34 insertions, 10 deletions
diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c
index 347a3f7..5d80891 100644
--- a/bta/dm/bta_dm_act.c
+++ b/bta/dm/bta_dm_act.c
@@ -2827,6 +2827,8 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
bta_dm_cb.just_works = sec_event.cfm_req.just_works = p_data->cfm_req.just_works;
sec_event.cfm_req.loc_auth_req = p_data->cfm_req.loc_auth_req;
sec_event.cfm_req.rmt_auth_req = p_data->cfm_req.rmt_auth_req;
+ sec_event.cfm_req.loc_io_caps = p_data->cfm_req.loc_io_caps;
+ sec_event.cfm_req.rmt_io_caps = p_data->cfm_req.rmt_io_caps;
/* continue to next case */
#if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE)
/* Passkey entry mode, mobile device with output capability is very
diff --git a/bta/include/bta_api.h b/bta/include/bta_api.h
index ebc4f14..b8a4f50 100644
--- a/bta/include/bta_api.h
+++ b/bta/include/bta_api.h
@@ -624,6 +624,8 @@ typedef struct
BOOLEAN just_works; /* TRUE, if "Just Works" association model */
tBTA_AUTH_REQ loc_auth_req; /* Authentication required for local device */
tBTA_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */
+ tBTA_IO_CAP loc_io_caps; /* IO Capabilities of local device */
+ tBTA_AUTH_REQ rmt_io_caps; /* IO Capabilities of remote device */
} tBTA_DM_SP_CFM_REQ;
enum
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index df4998d..65de159 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -533,6 +533,7 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
bt_bdname_t bd_name;
UINT32 cod;
btif_dm_remote_name_t remote_param;
+ BOOLEAN is_incoming = !(pairing_cb.state == BT_BOND_STATE_BONDING);
BTIF_TRACE_DEBUG1("%s", __FUNCTION__);
@@ -546,21 +547,36 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
/* Set the pairing_cb based on the local & remote authentication requirements */
bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_BONDING);
- if ((p_ssp_cfm_req->loc_auth_req >= BTM_AUTH_AP_NO && p_ssp_cfm_req->rmt_auth_req >= BTM_AUTH_AP_NO) ||
- (p_ssp_cfm_req->loc_auth_req == BTM_AUTH_AP_NO || p_ssp_cfm_req->loc_auth_req == BTM_AUTH_AP_YES) ||
- (p_ssp_cfm_req->rmt_auth_req == BTM_AUTH_AP_NO || p_ssp_cfm_req->rmt_auth_req == BTM_AUTH_AP_YES))
- pairing_cb.is_temp = FALSE;
- else
+
+ /* if just_works and bonding bit is not set treat this as temporary */
+ if (p_ssp_cfm_req->just_works && !(p_ssp_cfm_req->loc_auth_req & BTM_AUTH_BONDS) &&
+ !(p_ssp_cfm_req->rmt_auth_req & BTM_AUTH_BONDS))
pairing_cb.is_temp = TRUE;
+ else
+ pairing_cb.is_temp = FALSE;
pairing_cb.is_ssp = TRUE;
/* If JustWorks auto-accept */
if (p_ssp_cfm_req->just_works)
{
- BTIF_TRACE_EVENT1("%s: Auto-accept JustWorks pairing", __FUNCTION__);
- btif_dm_ssp_reply(&bd_addr, BT_SSP_VARIANT_CONSENT, TRUE, 0);
- return;
+ /* Pairing consent for JustWorks needed if:
+ * 1. Incoming pairing is detected AND
+ * 2. local IO capabilities are DisplayYesNo AND
+ * 3. remote IO capabiltiies are DisplayOnly or NoInputNoOutput;
+ */
+ if ((is_incoming) && ((p_ssp_cfm_req->loc_io_caps == 0x01) &&
+ (p_ssp_cfm_req->rmt_io_caps == 0x00 || p_ssp_cfm_req->rmt_io_caps == 0x03)))
+ {
+ BTIF_TRACE_EVENT3("%s: User consent needed for incoming pairing request. loc_io_caps: %d, rmt_io_caps: %d",
+ __FUNCTION__, p_ssp_cfm_req->loc_io_caps, p_ssp_cfm_req->rmt_io_caps);
+ }
+ else
+ {
+ BTIF_TRACE_EVENT1("%s: Auto-accept JustWorks pairing", __FUNCTION__);
+ btif_dm_ssp_reply(&bd_addr, BT_SSP_VARIANT_CONSENT, TRUE, 0);
+ return;
+ }
}
cod = devclass2uint(p_ssp_cfm_req->dev_class);
@@ -570,8 +586,8 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
cod = COD_UNCLASSIFIED;
}
- HAL_CBACK(bt_hal_cbacks, ssp_request_cb, &bd_addr, &bd_name,
- cod, BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+ HAL_CBACK(bt_hal_cbacks, ssp_request_cb, &bd_addr, &bd_name, cod,
+ (p_ssp_cfm_req->just_works ? BT_SSP_VARIANT_CONSENT : BT_SSP_VARIANT_PASSKEY_CONFIRMATION),
p_ssp_cfm_req->num_val);
}
diff --git a/stack/btm/btm_sec.c b/stack/btm/btm_sec.c
index a845acc..80cb99f 100755
--- a/stack/btm/btm_sec.c
+++ b/stack/btm/btm_sec.c
@@ -3305,6 +3305,8 @@ void btm_proc_sp_req_evt (tBTM_SP_EVT event, UINT8 *p)
evt_data.cfm_req.loc_auth_req = btm_cb.devcb.loc_auth_req;
evt_data.cfm_req.rmt_auth_req = p_dev_rec->rmt_auth_req;
+ evt_data.cfm_req.loc_io_caps = btm_cb.devcb.loc_io_caps;
+ evt_data.cfm_req.rmt_io_caps = p_dev_rec->rmt_io_caps;
break;
case BTM_SP_KEY_NOTIF_EVT:
diff --git a/stack/include/btm_api.h b/stack/include/btm_api.h
index e27fcb1..76b6e03 100644
--- a/stack/include/btm_api.h
+++ b/stack/include/btm_api.h
@@ -1412,6 +1412,8 @@ typedef struct
BOOLEAN just_works; /* TRUE, if "Just Works" association model */
tBTM_AUTH_REQ loc_auth_req; /* Authentication required for local device */
tBTM_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */
+ tBTM_IO_CAP loc_io_caps; /* IO Capabilities of the local device */
+ tBTM_IO_CAP rmt_io_caps; /* IO Capabilities of the remot device */
} tBTM_SP_CFM_REQ;
/* data type for BTM_SP_KEY_REQ_EVT */