diff --git a/components/bt/controller/lib_esp32c3_family b/components/bt/controller/lib_esp32c3_family index 30725989d4..83020b58a1 160000 --- a/components/bt/controller/lib_esp32c3_family +++ b/components/bt/controller/lib_esp32c3_family @@ -1 +1 @@ -Subproject commit 30725989d4ba6393363d3310b945c2b8518c7c8e +Subproject commit 83020b58a19cae4ebf3d231755027100952d2fa5 diff --git a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h index ce30993585..a842f11def 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h @@ -765,6 +765,9 @@ typedef uint8_t esp_ble_gap_sync_t; #define ESP_BLE_LEGACY_ADV_TYPE_SCAN_RSP_TO_ADV_SCAN_IND (0x1a) typedef uint8_t esp_ble_gap_adv_type_t; +/// Extend advertising tx power, range: [-127, +126] dBm +#define EXT_ADV_TX_PWR_NO_PREFERENCE (127) /*!< host has no preference for tx power */ + /** * @brief ext adv parameters */ diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c index acf93b585d..5507839f6f 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c @@ -2820,6 +2820,7 @@ void BTA_DmBleGapExtAdvSetRemove(UINT8 instance) if ((p_msg = (tBTA_DM_API_BLE_EXT_ADV_SET_REMOVE *) osi_malloc(sizeof(tBTA_DM_API_BLE_EXT_ADV_SET_REMOVE))) != NULL) { memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_EXT_ADV_SET_REMOVE)); p_msg->hdr.event = BTA_DM_API_EXT_ADV_SET_REMOVE_EVT; + p_msg->instance = instance; //start sent the msg to the bta system control moudle bta_sys_sendmsg(p_msg); } else { diff --git a/components/bt/host/bluedroid/bta/include/bta/bta_api.h b/components/bt/host/bluedroid/bta/include/bta/bta_api.h index 32e59d27e2..67ad7d6686 100644 --- a/components/bt/host/bluedroid/bta/include/bta/bta_api.h +++ b/components/bt/host/bluedroid/bta/include/bta/bta_api.h @@ -1466,7 +1466,7 @@ typedef struct { tBLE_ADDR_TYPE peer_addr_type; BD_ADDR peer_addr; tBTA_BLE_AFP filter_policy; - UINT8 tx_power; + INT8 tx_power; tBTA_DM_BLE_GAP_PHY primary_phy; UINT8 max_skip; tBTA_DM_BLE_GAP_PHY secondary_phy; diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble.c b/components/bt/host/bluedroid/stack/btm/btm_ble.c index a207fad77c..fb0d3f6a8c 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble.c @@ -1990,7 +1990,7 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced) } #if (BLE_PRIVACY_SPT == TRUE ) peer_addr_type = bda_type; - match = btm_identity_addr_to_random_pseudo (bda, &bda_type, TRUE); + match = btm_identity_addr_to_random_pseudo (bda, &bda_type, FALSE); /* possiblly receive connection complete with resolvable random on slave role while the device has been paired */ diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c index 6976996e75..ef332e836c 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c @@ -4250,10 +4250,11 @@ void btm_ble_read_remote_features_complete(UINT8 *p) btsnd_hcic_rmt_ver_req (p_acl_cb->hci_handle); } else{ + uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length(); + uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime(); if (p_acl_cb->transport == BT_TRANSPORT_LE) { - if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features)) { - uint16_t data_length = controller_get_interface()->get_ble_default_data_packet_length(); - uint16_t data_txtime = controller_get_interface()->get_ble_default_data_packet_txtime(); + if (HCI_LE_DATA_LEN_EXT_SUPPORTED(p_acl_cb->peer_le_features) && + (p_acl_cb->data_length_params.tx_len != data_length)) { p_acl_cb->data_len_updating = true; btsnd_hcic_ble_set_data_length(p_acl_cb->hci_handle, data_length, data_txtime); } diff --git a/components/bt/host/bluedroid/stack/hcic/hciblecmds.c b/components/bt/host/bluedroid/stack/hcic/hciblecmds.c index 4369ecc2c8..8aaab5ea2a 100644 --- a/components/bt/host/bluedroid/stack/hcic/hciblecmds.c +++ b/components/bt/host/bluedroid/stack/hcic/hciblecmds.c @@ -1214,7 +1214,7 @@ UINT8 btsnd_hcic_ble_set_extend_rand_address(UINT8 adv_handle, BD_ADDR rand_addr UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UINT32 interval_min, UINT32 interval_max, UINT8 channel_map, UINT8 own_addr_type, UINT8 peer_addr_type, BD_ADDR peer_addr, - UINT8 adv_filter_policy, UINT8 adv_tx_power, + UINT8 adv_filter_policy, INT8 adv_tx_power, UINT8 primary_adv_phy, UINT8 secondary_adv_max_skip, UINT8 secondary_adv_phy, UINT8 adv_sid, UINT8 scan_req_ntf_enable) @@ -1244,7 +1244,7 @@ UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UIN UINT8_TO_STREAM(pp, peer_addr_type); BDADDR_TO_STREAM (pp, peer_addr); UINT8_TO_STREAM(pp, adv_filter_policy); - UINT8_TO_STREAM(pp, adv_tx_power); + INT8_TO_STREAM(pp, adv_tx_power); UINT8_TO_STREAM(pp, primary_adv_phy); UINT8_TO_STREAM(pp, secondary_adv_max_skip); UINT8_TO_STREAM(pp, secondary_adv_phy); diff --git a/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h b/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h index f7cac0ecd8..b20b861a28 100644 --- a/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h +++ b/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h @@ -767,7 +767,7 @@ typedef struct { tBLE_ADDR_TYPE peer_addr_type; BD_ADDR peer_addr; tBTM_BLE_AFP filter_policy; - UINT8 tx_power; + INT8 tx_power; tBTM_BLE_GAP_PHY primary_phy; UINT8 max_skip; tBTM_BLE_GAP_PHY secondary_phy; diff --git a/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h b/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h index 44aa840945..ebdacff27a 100644 --- a/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h +++ b/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h @@ -962,7 +962,7 @@ UINT8 btsnd_hcic_ble_set_extend_rand_address(UINT8 adv_handle, BD_ADDR rand_addr UINT8 btsnd_hcic_ble_set_ext_adv_params(UINT8 adv_handle, UINT16 properties, UINT32 interval_min, UINT32 interval_max, UINT8 channel_map, UINT8 own_addr_type, UINT8 peer_addr_type, BD_ADDR peer_addr, - UINT8 adv_filter_policy, UINT8 adv_tx_power, + UINT8 adv_filter_policy, INT8 adv_tx_power, UINT8 primary_adv_phy, UINT8 secondary_adv_max_skip, UINT8 secondary_adv_phy, UINT8 adv_sid, UINT8 scan_req_ntf_enable); diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_api.c b/components/bt/host/bluedroid/stack/l2cap/l2c_api.c index 0c64eedc27..2db8fd539d 100644 --- a/components/bt/host/bluedroid/stack/l2cap/l2c_api.c +++ b/components/bt/host/bluedroid/stack/l2cap/l2c_api.c @@ -2342,7 +2342,15 @@ void l2ble_update_att_acl_pkt_num(UINT8 type, tl2c_buff_param_t *param) xSemaphoreGive(buff_semaphore); break; } - fixed_queue_t * queue = p_lcb->p_fixed_ccbs[L2CAP_ATT_CID - L2CAP_FIRST_FIXED_CHNL]->xmit_hold_q; + + tL2C_CCB *p_ccb = p_lcb->p_fixed_ccbs[L2CAP_ATT_CID - L2CAP_FIRST_FIXED_CHNL]; + if(p_ccb == NULL) { + L2CAP_TRACE_ERROR("%s not found p_ccb", __func__); + xSemaphoreGive(buff_semaphore); + break; + } + + fixed_queue_t * queue = p_ccb->xmit_hold_q; att_max_num = MIN(p_lcb->link_xmit_quota, L2CAP_CACHE_ATT_ACL_NUM); if (queue == NULL){ L2CAP_TRACE_ERROR("%s not found queue", __func__); diff --git a/examples/bluetooth/bluedroid/ble_50/ble50_security_server/main/ble50_sec_gatts_demo.c b/examples/bluetooth/bluedroid/ble_50/ble50_security_server/main/ble50_sec_gatts_demo.c index 744acce676..d56abe5483 100644 --- a/examples/bluetooth/bluedroid/ble_50/ble50_security_server/main/ble50_sec_gatts_demo.c +++ b/examples/bluetooth/bluedroid/ble_50/ble50_security_server/main/ble50_sec_gatts_demo.c @@ -57,6 +57,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_2M = { .sid = 0, .scan_req_notif = false, .own_addr_type = BLE_ADDR_TYPE_PUBLIC, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, }; struct gatts_profile_inst { diff --git a/examples/bluetooth/bluedroid/ble_50/multi-adv/main/multi_adv_demo.c b/examples/bluetooth/bluedroid/ble_50/multi-adv/main/multi_adv_demo.c index 92eb86ebcd..b3fb958afa 100644 --- a/examples/bluetooth/bluedroid/ble_50/multi-adv/main/multi_adv_demo.c +++ b/examples/bluetooth/bluedroid/ble_50/multi-adv/main/multi_adv_demo.c @@ -6,6 +6,7 @@ CONDITIONS OF ANY KIND, either express or implied. */ + /**************************************************************************** * * This demo showcases BLE GATT server. It can send adv data, be connected by client. @@ -66,6 +67,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_1M = { .sid = 0, .scan_req_notif = false, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, }; esp_ble_gap_ext_adv_params_t ext_adv_params_2M = { @@ -80,6 +82,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_2M = { .sid = 1, .scan_req_notif = false, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, }; esp_ble_gap_ext_adv_params_t legacy_adv_params = { @@ -94,6 +97,7 @@ esp_ble_gap_ext_adv_params_t legacy_adv_params = { .sid = 2, .scan_req_notif = false, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, }; esp_ble_gap_ext_adv_params_t ext_adv_params_coded = { @@ -108,6 +112,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_coded = { .sid = 3, .scan_req_notif = false, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, }; static uint8_t raw_adv_data_1m[] = { diff --git a/examples/bluetooth/bluedroid/ble_50/peroidic_adv/main/periodic_adv_demo.c b/examples/bluetooth/bluedroid/ble_50/peroidic_adv/main/periodic_adv_demo.c index 9a2d032fbf..c97bfe029c 100644 --- a/examples/bluetooth/bluedroid/ble_50/peroidic_adv/main/periodic_adv_demo.c +++ b/examples/bluetooth/bluedroid/ble_50/peroidic_adv/main/periodic_adv_demo.c @@ -67,6 +67,7 @@ esp_ble_gap_ext_adv_params_t ext_adv_params_2M = { .sid = 0, .scan_req_notif = false, .own_addr_type = BLE_ADDR_TYPE_RANDOM, + .tx_power = EXT_ADV_TX_PWR_NO_PREFERENCE, }; static esp_ble_gap_periodic_adv_params_t periodic_adv_params = {