From 58b2cb3e0c7b2c7790fdd54433b5c8439098ff56 Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Thu, 26 Apr 2018 17:03:11 +0800 Subject: [PATCH] Component/bt: update con params is rejected in smp when reconnection --- components/bt/bluedroid/bta/gatt/bta_gattc_co.c | 4 +++- components/bt/bluedroid/stack/btm/btm_sec.c | 6 ++++++ components/bt/lib | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/bt/bluedroid/bta/gatt/bta_gattc_co.c b/components/bt/bluedroid/bta/gatt/bta_gattc_co.c index e6b49cb38..6c6fc460d 100644 --- a/components/bt/bluedroid/bta/gatt/bta_gattc_co.c +++ b/components/bt/bluedroid/bta/gatt/bta_gattc_co.c @@ -331,7 +331,9 @@ void bta_gattc_co_cache_addr_init(void) cache_env.addr_fp = fp; // Read previously saved blob if available if ((err_code = nvs_get_blob(fp, cache_key, p_buf, &length)) != ESP_OK) { - APPL_TRACE_ERROR("%s, Line = %d, nvs flash get blob data fail, err_code = %x", __func__, __LINE__, err_code); + if(err_code != ESP_ERR_NVS_NOT_FOUND) { + APPL_TRACE_ERROR("%s, Line = %d, nvs flash get blob data fail, err_code = 0x%x", __func__, __LINE__, err_code); + } osi_free(p_buf); return; } diff --git a/components/bt/bluedroid/stack/btm/btm_sec.c b/components/bt/bluedroid/stack/btm/btm_sec.c index 00923e9f8..c238051e7 100644 --- a/components/bt/bluedroid/stack/btm/btm_sec.c +++ b/components/bt/bluedroid/stack/btm/btm_sec.c @@ -4018,6 +4018,7 @@ void btm_sec_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable) #if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE tACL_CONN *p_acl = NULL; UINT8 acl_idx = btm_handle_to_acl_index(handle); + tGATT_TCB *p_tcb = NULL; #endif BTM_TRACE_EVENT ("Security Manager: encrypt_change status:%d State:%d, encr_enable = %d\n", status, (p_dev_rec) ? p_dev_rec->sec_state : 0, encr_enable); @@ -4045,6 +4046,11 @@ void btm_sec_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable) p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED; } } else { +#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE + if ((p_tcb = gatt_find_tcb_by_addr(p_dev_rec->ble.pseudo_addr, BT_TRANSPORT_LE)) == NULL) { + //do nothing + } else +#endif p_dev_rec->sec_flags |= (BTM_SEC_LE_AUTHENTICATED | BTM_SEC_LE_ENCRYPTED); } } diff --git a/components/bt/lib b/components/bt/lib index 34b64038d..a3e98f831 160000 --- a/components/bt/lib +++ b/components/bt/lib @@ -1 +1 @@ -Subproject commit 34b64038d090fa172d9757e2fce293ff26e0a08c +Subproject commit a3e98f83144ee46c6ec9b53b1c838bcefdf26e97