diff --git a/components/bt/bluedroid/stack/btm/btm_acl.c b/components/bt/bluedroid/stack/btm/btm_acl.c index 61dddcb61..c128510d2 100644 --- a/components/bt/bluedroid/stack/btm/btm_acl.c +++ b/components/bt/bluedroid/stack/btm/btm_acl.c @@ -230,7 +230,10 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn, p->link_role = link_role; p->link_up_issued = FALSE; memcpy (p->remote_addr, bda, BD_ADDR_LEN); - + /* Set the default version of the peer device to version4.0 before exchange the version with it. + If the peer device act as a master and don't exchange the version with us, then it can only use the + legacy connect instead of secure connection in the pairing step. */ + p->lmp_version = HCI_PROTO_VERSION_4_0; #if BLE_INCLUDED == TRUE p->transport = transport; #if BLE_PRIVACY_SPT == TRUE @@ -308,11 +311,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn, btsnd_hcic_ble_read_remote_feat(p->hci_handle); } else if (HCI_LE_SLAVE_INIT_FEAT_EXC_SUPPORTED(controller_get_interface()->get_features_ble()->as_array) && link_role == HCI_ROLE_SLAVE) { - /* In the original Bluedroid version, slave need to send LL_SLAVE_FEATURE_REQ(call btsnd_hcic_ble_read_remote_feat) - * to remote device if it has not received ll_feature_req. - * Delete it to resolve Android 7.0 incompatible problem. But it may cause that slave - * can't get remote device's feature if it doesn't receive ll_feature_req.*/ - l2cble_notify_le_connection(bda); + btsnd_hcic_ble_read_remote_feat(p->hci_handle); } else { btm_establish_continue(p); } diff --git a/components/bt/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/bluedroid/stack/btm/btm_ble_gap.c index 0c1dc29a9..523137aa0 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_gap.c @@ -3315,7 +3315,21 @@ void btm_ble_read_remote_features_complete(UINT8 *p) for (xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_acl_cb++) { if ((p_acl_cb->in_use) && (p_acl_cb->hci_handle == handle)) { STREAM_TO_ARRAY(p_acl_cb->peer_le_features, p, BD_FEATURES_LEN); - btsnd_hcic_rmt_ver_req (p_acl_cb->hci_handle); +#if BLE_INCLUDED == TRUE + /* In the original Bluedroid version, slave need to send LL_VERSION_IND(call btsnd_hcic_rmt_ver_req) + * to remote device if it has not received ll_version_ind. + * Delete it to resolve Android 7.0 incompatible problem. But it may cause that slave host + * can't get remote device's version.*/ + if (p_acl_cb->link_role == HCI_ROLE_MASTER){ + btsnd_hcic_rmt_ver_req (p_acl_cb->hci_handle); + } + + else{ + if (p_acl_cb->transport == BT_TRANSPORT_LE) { + l2cble_notify_le_connection (p_acl_cb->remote_addr); + } + } +#endif break; } } diff --git a/components/bt/bluedroid/stack/btu/btu_task.c b/components/bt/bluedroid/stack/btu/btu_task.c index d41e7bfd2..5d7b1ec60 100644 --- a/components/bt/bluedroid/stack/btu/btu_task.c +++ b/components/bt/bluedroid/stack/btu/btu_task.c @@ -473,6 +473,7 @@ static void btu_general_alarm_process(TIMER_LIST_ENT *p_tle) case BTU_TTYPE_ATT_WAIT_FOR_IND_ACK: gatt_ind_ack_timeout(p_tle); break; + #if (defined(SMP_INCLUDED) && SMP_INCLUDED == TRUE) case BTU_TTYPE_SMP_PAIRING_CMD: smp_rsp_timeout(p_tle); @@ -547,6 +548,7 @@ void btu_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_sec) osi_alarm_set(alarm, (period_ms_t)(timeout_sec * 1000)); } + /******************************************************************************* ** ** Function btu_stop_timer diff --git a/components/bt/bluedroid/stack/include/btu.h b/components/bt/bluedroid/stack/include/btu.h index 2427dd2f5..b2d723646 100644 --- a/components/bt/bluedroid/stack/include/btu.h +++ b/components/bt/bluedroid/stack/include/btu.h @@ -163,6 +163,8 @@ typedef void (*tBTU_EVENT_CALLBACK)(BT_HDR *p_hdr); #define BTU_TTYPE_UCD_TO 108 + + /* This is the inquiry response information held by BTU, and available ** to applications. */ diff --git a/examples/bluetooth/gatt_security_server/main/example_ble_sec_gatts_demo.c b/examples/bluetooth/gatt_security_server/main/example_ble_sec_gatts_demo.c index 52eff69f2..3bdbb5142 100644 --- a/examples/bluetooth/gatt_security_server/main/example_ble_sec_gatts_demo.c +++ b/examples/bluetooth/gatt_security_server/main/example_ble_sec_gatts_demo.c @@ -396,7 +396,7 @@ void app_main() /* set the security iocap & auth_req & key size & init key response key parameters to the stack*/ esp_ble_auth_req_t auth_req = ESP_LE_AUTH_BOND; //bonding with peer device after authentication - esp_ble_io_cap_t iocap = ESP_IO_CAP_OUT; //set the IO capability to Output only + esp_ble_io_cap_t iocap = ESP_IO_CAP_NONE; //set the IO capability to No output No input uint8_t key_size = 16; //the key size should be 7~16 bytes uint8_t init_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK; uint8_t rsp_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;