فهرست منبع

component/bt: Fix can't get remote's feature bug

- Slave send version_ind cause some Android 7.0 devices can't encrypt correctly
island 8 سال پیش
والد
کامیت
e2e5f4caae

+ 1 - 5
components/bt/bluedroid/stack/btm/btm_acl.c

@@ -308,11 +308,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);
                 }

+ 15 - 1
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;
             }
         }

+ 2 - 0
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

+ 2 - 0
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.
 */

+ 1 - 1
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;