]> granicus.if.org Git - esp-idf/commitdiff
Component/bt: fix can not remove boned device if it is connected
authorzhiweijian <zhiweijian@espressif.com>
Mon, 8 Jan 2018 07:37:36 +0000 (15:37 +0800)
committerzhiweijian <zhiweijian@espressif.com>
Mon, 8 Jan 2018 09:55:00 +0000 (17:55 +0800)
components/bt/bluedroid/bta/dm/bta_dm_act.c
components/bt/bluedroid/bta/include/bta_api.h
components/bt/bluedroid/stack/btm/btm_ble.c

index cb531d625cd59c787597291519a24dc802696940..e0b1595a9e06e0497bb598dfb9b6bb85ca7cd69d 100644 (file)
@@ -3278,7 +3278,7 @@ void bta_dm_acl_change(tBTA_DM_MSG *p_data)
         }
 
         bdcpy(conn.link_down.bd_addr, p_bda);
-        conn.link_down.status = (UINT8) btm_get_acl_disc_reason_code();
+        conn.link_down.reason = (UINT8) btm_get_acl_disc_reason_code();
         if ( bta_dm_cb.p_sec_cback ) {
             bta_dm_cb.p_sec_cback(BTA_DM_LINK_DOWN_EVT, &conn);
             if ( issue_unpair_cb ) {
index 7f57f5650fd48a71ce686e94f1fd280d222a85b9..a5a7edd269f233c36db549c0ded322e05a85d3d9 100644 (file)
@@ -785,6 +785,7 @@ typedef struct {
 typedef struct {
     BD_ADDR         bd_addr;            /* BD address peer device. */
     UINT8           status;             /* connection open/closed */
+    UINT8           reason;             /* link down reason */
     BOOLEAN         is_removed;         /* TRUE if device is removed when link is down */
 #if BLE_INCLUDED == TRUE
     tBTA_TRANSPORT  link_type;
index baa69d53f0e22a233c13885dd5fdc0341859bc1a..da32791bbda14075e10af29bde13fcd77b58e0ab 100644 (file)
@@ -665,6 +665,7 @@ BOOLEAN BTM_ReadConnectedTransportAddress(BD_ADDR remote_bda, tBT_TRANSPORT tran
 
     /* if no device can be located, return */
     if (p_dev_rec == NULL) {
+        memset(remote_bda, 0, BD_ADDR_LEN);
         return FALSE;
     }