]> granicus.if.org Git - esp-idf/commitdiff
component/bt: Fix can't get remote's feature bug
authorisland <island@espressif.com>
Wed, 14 Jun 2017 10:08:03 +0000 (18:08 +0800)
committerisland <island@espressif.com>
Wed, 14 Jun 2017 13:56:59 +0000 (21:56 +0800)
- Slave send version_ind cause some Android 7.0 devices can't encrypt correctly

components/bt/bluedroid/stack/btm/btm_acl.c
components/bt/bluedroid/stack/btm/btm_ble_gap.c
components/bt/bluedroid/stack/btu/btu_task.c
components/bt/bluedroid/stack/include/btu.h
examples/bluetooth/gatt_security_server/main/example_ble_sec_gatts_demo.c

index 61dddcb61cc86cbd29e1071fc4c4d9ce99bb88fc..4ed5f1936251086198a1a89580786ee06e3839a1 100644 (file)
@@ -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);
                 }
index 0c1dc29a932578e00d9bca5d096608ed56e76151..523137aa0bd81f997fc6534563511fee19d5cc38 100644 (file)
@@ -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;
             }
         }
index d41e7bfd25153bd76349475a2a30921b74116706..5d7b1ec60b1899d167e8ffcd3dda8b759fe3531e 100644 (file)
@@ -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
index 2427dd2f5179b116fe3f597e08e4927b568f1e97..b2d723646af20b3a8df0b26f978fa6a239212edd 100644 (file)
@@ -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.
 */
index 52eff69f2f5f6482a5c43d1b88d013f43b112221..3bdbb514288ceb13aa377a73948fb7590a8fdf0e 100644 (file)
@@ -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;