diff --git a/components/bt/bluedroid/stack/btm/btm_ble.c b/components/bt/bluedroid/stack/btm/btm_ble.c index 9dc9191f4..8f41df892 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble.c +++ b/components/bt/bluedroid/stack/btm/btm_ble.c @@ -1942,14 +1942,6 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced) handle = HCID_GET_HANDLE (handle); btm_ble_connected(bda, handle, HCI_ENCRYPT_MODE_DISABLED, role, bda_type, match); - if(role == HCI_ROLE_SLAVE) { - //clear p_cb->state, controller will stop adv when ble connected. - tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var; - if(p_cb) { - p_cb->adv_mode = BTM_BLE_ADV_DISABLE; - p_cb->state = BTM_BLE_STOP_ADV; - } - } l2cble_conn_comp (handle, role, bda, bda_type, conn_interval, conn_latency, conn_timeout); diff --git a/components/bt/bluedroid/stack/l2cap/l2c_ble.c b/components/bt/bluedroid/stack/l2cap/l2c_ble.c index 67ecae85f..b6f5cb870 100644 --- a/components/bt/bluedroid/stack/l2cap/l2c_ble.c +++ b/components/bt/bluedroid/stack/l2cap/l2c_ble.c @@ -261,6 +261,15 @@ void l2cble_notify_le_connection (BD_ADDR bda) tACL_CONN *p_acl = btm_bda_to_acl(bda, BT_TRANSPORT_LE) ; if (p_lcb != NULL && p_acl != NULL && p_lcb->link_state != LST_CONNECTED) { + + if(p_acl->link_role == HCI_ROLE_SLAVE) { + //clear p_cb->state, controller will stop adv when ble connected. + tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var; + if(p_cb) { + p_cb->adv_mode = BTM_BLE_ADV_DISABLE; + p_cb->state = BTM_BLE_STOP_ADV; + } + } /* update link status */ btm_establish_continue(p_acl); /* update l2cap link status and send callback */