From 6dc7d9b63f1769f07aa3b08644cb8a97538362bc Mon Sep 17 00:00:00 2001 From: Geng Yuchao Date: Thu, 15 Jun 2023 17:12:22 +0800 Subject: [PATCH 1/8] feat(ble): Add duplicate filter feature enable on ble for c6. --- components/bt/controller/esp32c6/Kconfig.in | 56 +++++++++++++++++ components/bt/controller/esp32c6/bt.c | 62 +++++++++++++++++++ .../bt/include/esp32c6/include/esp_bt.h | 2 +- 3 files changed, 119 insertions(+), 1 deletion(-) diff --git a/components/bt/controller/esp32c6/Kconfig.in b/components/bt/controller/esp32c6/Kconfig.in index db991124dd..9f77ea8520 100644 --- a/components/bt/controller/esp32c6/Kconfig.in +++ b/components/bt/controller/esp32c6/Kconfig.in @@ -422,3 +422,59 @@ config BT_LE_USE_ESP_TIMER help Set this option to use Esp Timer which has higher priority timer instead of FreeRTOS timer + +config BT_LE_SCAN_DUPL + bool "BLE Scan Duplicate Options" + default y + help + This select enables parameters setting of BLE scan duplicate. + +choice BT_LE_SCAN_DUPL_TYPE + prompt "Scan Duplicate Type" + default BT_LE_SCAN_DUPL_TYPE_DEVICE + depends on BT_LE_SCAN_DUPL + help + Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use + advertiser address filtering. The adv packet of the same address is only allowed to be reported once. + Another way is "Scan Duplicate By Device Address And Advertising Data". This way is to use advertising + data and device address filtering. All different adv packets with the same address are allowed to be + reported. The last way is "Scan Duplicate By Advertising Data". This way is to use advertising data + filtering. All same advertising data only allow to be reported once even though they are from + different devices. + + config BT_LE_SCAN_DUPL_TYPE_DEVICE + bool "Scan Duplicate By Device Address" + help + This way is to use advertiser address filtering. The adv packet of the same address is only + allowed to be reported once + + config BT_LE_SCAN_DUPL_TYPE_DATA + bool "Scan Duplicate By Advertising Data" + help + This way is to use advertising data filtering. All same advertising data only allow to be reported + once even though they are from different devices. + + config BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE + bool "Scan Duplicate By Device Address And Advertising Data" + help + This way is to use advertising data and device address filtering. All different adv packets with + the same address are allowed to be reported. +endchoice + +config BT_LE_SCAN_DUPL_TYPE + int + depends on BT_LE_SCAN_DUPL + default 0 if BT_LE_SCAN_DUPL_TYPE_DEVICE + default 1 if BT_LE_SCAN_DUPL_TYPE_DATA + default 2 if BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE + default 0 + + +config BT_LE_SCAN_DUPL_CACHE_SIZE + int "Maximum number of devices in scan duplicate filter" + depends on BT_LE_SCAN_DUPL + range 10 1000 + default 100 + help + Maximum number of devices which can be recorded in scan duplicate filter. + When the maximum amount of device in the filter is reached, the cache will be refreshed. diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 4cd73dbc78..f903b3497d 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -617,6 +617,66 @@ void controller_sleep_deinit(void) #endif //CONFIG_PM_ENABLE } +typedef enum { + FILTER_DUPLICATE_PDUTYPE = BIT(0), + FILTER_DUPLICATE_LENGTH = BIT(1), + FILTER_DUPLICATE_ADDRESS = BIT(2), + FILTER_DUPLICATE_ADVDATA = BIT(3), + FILTER_DUPLICATE_DEFAULT = FILTER_DUPLICATE_PDUTYPE | FILTER_DUPLICATE_ADDRESS, + FILTER_DUPLICATE_PDU_ALL = 0xF, + FILTER_DUPLICATE_EXCEPTION_FOR_MESH = BIT(4), + FILTER_DUPLICATE_AD_TYPE = BIT(5), +}disc_duplicate_mode_t; + + +extern void filter_duplicate_mode_enable(disc_duplicate_mode_t mode); +extern void filter_duplicate_mode_disable(disc_duplicate_mode_t mode); +extern void filter_duplicate_set_ring_list_max_num(uint32_t max_num); + +int +ble_vhci_disc_duplicate_mode_enable(int mode) +{ + // TODO: use vendor hci to update + filter_duplicate_mode_enable(mode); + return true; +} + +int +ble_vhci_disc_duplicate_mode_disable(int mode) +{ + // TODO: use vendor hci to update + filter_duplicate_mode_disable(mode); + return true; +} + +int ble_vhci_disc_duplicate_set_max_cache_size(int max_cache_size){ + // TODO: use vendor hci to update + filter_duplicate_set_ring_list_max_num(max_cache_size); + return true; +} + +/** + * @brief Config scan duplicate option mode from menuconfig (Adapt to the old configuration method.) + */ +void ble_controller_scan_duplicate_config() +{ + uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT; + uint32_t cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE; + if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 0) { + duplicate_mode = FILTER_DUPLICATE_ADDRESS; + } else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 1) { + duplicate_mode = FILTER_DUPLICATE_ADVDATA; + } else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 2) { + duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_ADVDATA; + } + + duplicate_mode |= FILTER_DUPLICATE_EXCEPTION_FOR_MESH; + + ble_vhci_disc_duplicate_mode_disable(0xFF); + ble_vhci_disc_duplicate_mode_enable(duplicate_mode); + ble_vhci_disc_duplicate_set_max_cache_size(cache_size); +} + esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) { uint8_t mac[6]; @@ -730,6 +790,8 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) goto free_controller; } + ble_controller_scan_duplicate_config(); + ret = controller_sleep_init(); if (ret != ESP_OK) { ESP_LOGW(NIMBLE_PORT_LOG_TAG, "controller_sleep_init failed %d", ret); diff --git a/components/bt/include/esp32c6/include/esp_bt.h b/components/bt/include/esp32c6/include/esp_bt.h index f8eb6a2af9..929d73c4bc 100644 --- a/components/bt/include/esp32c6/include/esp_bt.h +++ b/components/bt/include/esp32c6/include/esp_bt.h @@ -256,7 +256,7 @@ typedef struct { .sleep_en = NIMBLE_SLEEP_ENABLE, \ .coex_phy_coded_tx_rx_time_limit = DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF, \ .dis_scan_backoff = NIMBLE_DISABLE_SCAN_BACKOFF, \ - .ble_scan_classify_filter_enable = 0, \ + .ble_scan_classify_filter_enable = 1, \ .main_xtal_freq = CONFIG_XTAL_FREQ, \ .version_num = efuse_hal_chip_revision(), \ .cpu_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ, \ From a357fd17c29fb6932df19a29440201e674fb3e19 Mon Sep 17 00:00:00 2001 From: Geng Yuchao Date: Thu, 15 Jun 2023 17:13:48 +0800 Subject: [PATCH 2/8] feat(ble): Add duplicate filter feature enable on ble for h2. --- components/bt/controller/esp32h2/Kconfig.in | 56 +++++++++++++++++ components/bt/controller/esp32h2/bt.c | 63 +++++++++++++++++++ .../bt/include/esp32h2/include/esp_bt.h | 2 +- 3 files changed, 120 insertions(+), 1 deletion(-) diff --git a/components/bt/controller/esp32h2/Kconfig.in b/components/bt/controller/esp32h2/Kconfig.in index 13395fd30f..ef3904edba 100644 --- a/components/bt/controller/esp32h2/Kconfig.in +++ b/components/bt/controller/esp32h2/Kconfig.in @@ -402,3 +402,59 @@ config BT_LE_USE_ESP_TIMER help Set this option to use Esp Timer which has higher priority timer instead of FreeRTOS timer + +config BT_LE_SCAN_DUPL + bool "BLE Scan Duplicate Options" + default y + help + This select enables parameters setting of BLE scan duplicate. + +choice BT_LE_SCAN_DUPL_TYPE + prompt "Scan Duplicate Type" + default BT_LE_SCAN_DUPL_TYPE_DEVICE + depends on BT_LE_SCAN_DUPL + help + Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use + advertiser address filtering. The adv packet of the same address is only allowed to be reported once. + Another way is "Scan Duplicate By Device Address And Advertising Data". This way is to use advertising + data and device address filtering. All different adv packets with the same address are allowed to be + reported. The last way is "Scan Duplicate By Advertising Data". This way is to use advertising data + filtering. All same advertising data only allow to be reported once even though they are from + different devices. + + config BT_LE_SCAN_DUPL_TYPE_DEVICE + bool "Scan Duplicate By Device Address" + help + This way is to use advertiser address filtering. The adv packet of the same address is only + allowed to be reported once + + config BT_LE_SCAN_DUPL_TYPE_DATA + bool "Scan Duplicate By Advertising Data" + help + This way is to use advertising data filtering. All same advertising data only allow to be reported + once even though they are from different devices. + + config BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE + bool "Scan Duplicate By Device Address And Advertising Data" + help + This way is to use advertising data and device address filtering. All different adv packets with + the same address are allowed to be reported. +endchoice + +config BT_LE_SCAN_DUPL_TYPE + int + depends on BT_LE_SCAN_DUPL + default 0 if BT_LE_SCAN_DUPL_TYPE_DEVICE + default 1 if BT_LE_SCAN_DUPL_TYPE_DATA + default 2 if BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE + default 0 + + +config BT_LE_SCAN_DUPL_CACHE_SIZE + int "Maximum number of devices in scan duplicate filter" + depends on BT_LE_SCAN_DUPL + range 10 1000 + default 100 + help + Maximum number of devices which can be recorded in scan duplicate filter. + When the maximum amount of device in the filter is reached, the cache will be refreshed. diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index 9d7fcc6a30..bdf3b6a24a 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -583,6 +583,67 @@ void controller_sleep_deinit(void) #endif //CONFIG_PM_ENABLE } +typedef enum { + FILTER_DUPLICATE_PDUTYPE = BIT(0), + FILTER_DUPLICATE_LENGTH = BIT(1), + FILTER_DUPLICATE_ADDRESS = BIT(2), + FILTER_DUPLICATE_ADVDATA = BIT(3), + FILTER_DUPLICATE_DEFAULT = FILTER_DUPLICATE_PDUTYPE | FILTER_DUPLICATE_ADDRESS, + FILTER_DUPLICATE_PDU_ALL = 0xF, + FILTER_DUPLICATE_EXCEPTION_FOR_MESH = BIT(4), + FILTER_DUPLICATE_AD_TYPE = BIT(5), +}disc_duplicate_mode_t; + + +extern void filter_duplicate_mode_enable(disc_duplicate_mode_t mode); +extern void filter_duplicate_mode_disable(disc_duplicate_mode_t mode); +extern void filter_duplicate_set_ring_list_max_num(uint32_t max_num); + +int +ble_vhci_disc_duplicate_mode_enable(int mode) +{ + // TODO: use vendor hci to update + filter_duplicate_mode_enable(mode); + return true; +} + +int +ble_vhci_disc_duplicate_mode_disable(int mode) +{ + // TODO: use vendor hci to update + filter_duplicate_mode_disable(mode); + return true; +} + +int ble_vhci_disc_duplicate_set_max_cache_size(int max_cache_size){ + // TODO: use vendor hci to update + filter_duplicate_set_ring_list_max_num(max_cache_size); + return true; +} + + +/** + * @brief Config scan duplicate option mode from menuconfig (Adapt to the old configuration method.) + */ +void ble_controller_scan_duplicate_config() +{ + uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT; + uint32_t cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE; + if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 0) { + duplicate_mode = FILTER_DUPLICATE_ADDRESS; + } else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 1) { + duplicate_mode = FILTER_DUPLICATE_ADVDATA; + } else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 2) { + duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_ADVDATA; + } + + duplicate_mode |= FILTER_DUPLICATE_EXCEPTION_FOR_MESH; + + ble_vhci_disc_duplicate_mode_disable(0xFF); + ble_vhci_disc_duplicate_mode_enable(duplicate_mode); + ble_vhci_disc_duplicate_set_max_cache_size(cache_size); +} + esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) { uint8_t mac[6]; @@ -668,6 +729,8 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) goto free_controller; } + ble_controller_scan_duplicate_config(); + ret = controller_sleep_init(); if (ret != ESP_OK) { ESP_LOGW(NIMBLE_PORT_LOG_TAG, "controller_sleep_init failed %d", ret); diff --git a/components/bt/include/esp32h2/include/esp_bt.h b/components/bt/include/esp32h2/include/esp_bt.h index 316a24627c..4b3c4af323 100644 --- a/components/bt/include/esp32h2/include/esp_bt.h +++ b/components/bt/include/esp32h2/include/esp_bt.h @@ -258,7 +258,7 @@ typedef struct { .sleep_en = NIMBLE_SLEEP_ENABLE, \ .coex_phy_coded_tx_rx_time_limit = DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF, \ .dis_scan_backoff = NIMBLE_DISABLE_SCAN_BACKOFF, \ - .ble_scan_classify_filter_enable = 0, \ + .ble_scan_classify_filter_enable = 1, \ .main_xtal_freq = CONFIG_XTAL_FREQ, \ .cpu_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ, \ .ignore_wl_for_direct_adv = 0, \ From 2b195191b3bc1b6326c6590be948b04bebce056f Mon Sep 17 00:00:00 2001 From: Geng Yuchao Date: Thu, 15 Jun 2023 21:16:29 +0800 Subject: [PATCH 3/8] feat(ble): Add support to scan period refresh duplicate cache list --- components/bt/controller/esp32c6/Kconfig.in | 17 ++++++++++++++++- components/bt/controller/esp32c6/bt.c | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/components/bt/controller/esp32c6/Kconfig.in b/components/bt/controller/esp32c6/Kconfig.in index 9f77ea8520..dde650827c 100644 --- a/components/bt/controller/esp32c6/Kconfig.in +++ b/components/bt/controller/esp32c6/Kconfig.in @@ -469,7 +469,6 @@ config BT_LE_SCAN_DUPL_TYPE default 2 if BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE default 0 - config BT_LE_SCAN_DUPL_CACHE_SIZE int "Maximum number of devices in scan duplicate filter" depends on BT_LE_SCAN_DUPL @@ -478,3 +477,19 @@ config BT_LE_SCAN_DUPL_CACHE_SIZE help Maximum number of devices which can be recorded in scan duplicate filter. When the maximum amount of device in the filter is reached, the cache will be refreshed. + +config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD + int "Duplicate scan list refresh period (seconds)" + depends on BT_LE_SCAN_DUPL + range 0 1000 + default 0 + help + If the period value is non-zero, the controller will periodically clear the device information + stored in the scan duuplicate filter. If it is 0, the scan duuplicate filter will not be cleared + until the scanning is disabled. Duplicate advertisements for this period should not be sent to the + Host in advertising report events. + There are two scenarios where the ADV packet will be repeatedly reported: + 1. The duplicate scan cache is full, the controller will delete the oldest device information and + add new device information. + 2. When the refresh period is up, the controller will clear all device information and start filtering + again. diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index f903b3497d..332b61a0df 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -632,6 +632,7 @@ typedef enum { extern void filter_duplicate_mode_enable(disc_duplicate_mode_t mode); extern void filter_duplicate_mode_disable(disc_duplicate_mode_t mode); extern void filter_duplicate_set_ring_list_max_num(uint32_t max_num); +extern void scan_duplicate_cache_refresh_set_time(uint32_t period_time); int ble_vhci_disc_duplicate_mode_enable(int mode) @@ -655,6 +656,12 @@ int ble_vhci_disc_duplicate_set_max_cache_size(int max_cache_size){ return true; } +int ble_vhci_disc_duplicate_set_period_refresh_time(int refresh_period_time){ + // TODO: use vendor hci to update + scan_duplicate_cache_refresh_set_time(refresh_period_time); + return true; +} + /** * @brief Config scan duplicate option mode from menuconfig (Adapt to the old configuration method.) */ @@ -675,6 +682,7 @@ void ble_controller_scan_duplicate_config() ble_vhci_disc_duplicate_mode_disable(0xFF); ble_vhci_disc_duplicate_mode_enable(duplicate_mode); ble_vhci_disc_duplicate_set_max_cache_size(cache_size); + ble_vhci_disc_duplicate_set_period_refresh_time(CONFIG_BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD); } esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) From a5f127ec886d32df6569da54e8725beb611ec27a Mon Sep 17 00:00:00 2001 From: Geng Yuchao Date: Sun, 25 Jun 2023 17:41:16 +0800 Subject: [PATCH 4/8] feat(ble): Add duplicate refersh function support for esp32h2 --- components/bt/controller/esp32h2/Kconfig.in | 16 ++++++++++++++++ components/bt/controller/esp32h2/bt.c | 9 ++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/components/bt/controller/esp32h2/Kconfig.in b/components/bt/controller/esp32h2/Kconfig.in index ef3904edba..22b10c2c83 100644 --- a/components/bt/controller/esp32h2/Kconfig.in +++ b/components/bt/controller/esp32h2/Kconfig.in @@ -458,3 +458,19 @@ config BT_LE_SCAN_DUPL_CACHE_SIZE help Maximum number of devices which can be recorded in scan duplicate filter. When the maximum amount of device in the filter is reached, the cache will be refreshed. + +config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD + int "Duplicate scan list refresh period (seconds)" + depends on BT_LE_SCAN_DUPL + range 0 1000 + default 0 + help + If the period value is non-zero, the controller will periodically clear the device information + stored in the scan duuplicate filter. If it is 0, the scan duuplicate filter will not be cleared + until the scanning is disabled. Duplicate advertisements for this period should not be sent to the + Host in advertising report events. + There are two scenarios where the ADV packet will be repeatedly reported: + 1. The duplicate scan cache is full, the controller will delete the oldest device information and + add new device information. + 2. When the refresh period is up, the controller will clear all device information and start filtering + again. diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index bdf3b6a24a..abf6965784 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -598,6 +598,7 @@ typedef enum { extern void filter_duplicate_mode_enable(disc_duplicate_mode_t mode); extern void filter_duplicate_mode_disable(disc_duplicate_mode_t mode); extern void filter_duplicate_set_ring_list_max_num(uint32_t max_num); +extern void scan_duplicate_cache_refresh_set_time(uint32_t period_time); int ble_vhci_disc_duplicate_mode_enable(int mode) @@ -621,6 +622,11 @@ int ble_vhci_disc_duplicate_set_max_cache_size(int max_cache_size){ return true; } +int ble_vhci_disc_duplicate_set_period_refresh_time(int refresh_period_time){ + // TODO: use vendor hci to update + scan_duplicate_cache_refresh_set_time(refresh_period_time); + return true; +} /** * @brief Config scan duplicate option mode from menuconfig (Adapt to the old configuration method.) @@ -642,6 +648,7 @@ void ble_controller_scan_duplicate_config() ble_vhci_disc_duplicate_mode_disable(0xFF); ble_vhci_disc_duplicate_mode_enable(duplicate_mode); ble_vhci_disc_duplicate_set_max_cache_size(cache_size); + ble_vhci_disc_duplicate_set_period_refresh_time(CONFIG_BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD); } esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) @@ -730,7 +737,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) } ble_controller_scan_duplicate_config(); - + ret = controller_sleep_init(); if (ret != ESP_OK) { ESP_LOGW(NIMBLE_PORT_LOG_TAG, "controller_sleep_init failed %d", ret); From eea7df273c35cc894a12dd040311523cbf53d17f Mon Sep 17 00:00:00 2001 From: Geng Yuchao Date: Sun, 25 Jun 2023 22:18:28 +0800 Subject: [PATCH 5/8] change(ble): Enable pdu type trig in duplicate in default mode as before --- components/bt/controller/esp32c6/bt.c | 2 +- components/bt/controller/esp32h2/bt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 332b61a0df..25594c3ec5 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -670,7 +670,7 @@ void ble_controller_scan_duplicate_config() uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT; uint32_t cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE; if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 0) { - duplicate_mode = FILTER_DUPLICATE_ADDRESS; + duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_PDUTYPE; } else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 1) { duplicate_mode = FILTER_DUPLICATE_ADVDATA; } else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 2) { diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index abf6965784..1135aac175 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -636,7 +636,7 @@ void ble_controller_scan_duplicate_config() uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT; uint32_t cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE; if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 0) { - duplicate_mode = FILTER_DUPLICATE_ADDRESS; + duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_PDUTYPE; } else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 1) { duplicate_mode = FILTER_DUPLICATE_ADVDATA; } else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 2) { From 0359d0df5d2d2d0dc8dcef563dc61b8871faea7e Mon Sep 17 00:00:00 2001 From: Geng Yuchao Date: Fri, 30 Jun 2023 15:35:35 +0800 Subject: [PATCH 6/8] feat(ble): Update ble lib to 6f9ef119 --- components/bt/controller/lib_esp32c6/esp32c6-bt-lib | 2 +- components/bt/controller/lib_esp32h2/esp32h2-bt-lib | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib index 0d0361ea8d..ddd61e9a27 160000 --- a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib +++ b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib @@ -1 +1 @@ -Subproject commit 0d0361ea8de61566575d7a8a97f2d7fd81538981 +Subproject commit ddd61e9a276926496437665dd217cba2850db6b9 diff --git a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib index f54d378894..b207a7da7a 160000 --- a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib +++ b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib @@ -1 +1 @@ -Subproject commit f54d3788941a701aca151a66654c812e080e876c +Subproject commit b207a7da7a9758dbccea0dba1023fd36c47b3e65 From 1398605873cba87692a71463d84d71d68ee073ac Mon Sep 17 00:00:00 2001 From: Geng Yuchao Date: Mon, 3 Jul 2023 14:21:02 +0800 Subject: [PATCH 7/8] fix(ci): Fix declaration isn't a prototype issue --- components/bt/controller/esp32c6/bt.c | 2 +- components/bt/controller/esp32h2/bt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 25594c3ec5..7418749901 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -665,7 +665,7 @@ int ble_vhci_disc_duplicate_set_period_refresh_time(int refresh_period_time){ /** * @brief Config scan duplicate option mode from menuconfig (Adapt to the old configuration method.) */ -void ble_controller_scan_duplicate_config() +void ble_controller_scan_duplicate_config(void) { uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT; uint32_t cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE; diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index 1135aac175..6b17763338 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -631,7 +631,7 @@ int ble_vhci_disc_duplicate_set_period_refresh_time(int refresh_period_time){ /** * @brief Config scan duplicate option mode from menuconfig (Adapt to the old configuration method.) */ -void ble_controller_scan_duplicate_config() +void ble_controller_scan_duplicate_config(void) { uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT; uint32_t cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE; From 730d8e18d8fc836bc38c0a8c126e56f242d179e8 Mon Sep 17 00:00:00 2001 From: Geng Yuchao Date: Mon, 3 Jul 2023 17:56:51 +0800 Subject: [PATCH 8/8] fix(ble): Fix duplicate var length issue --- components/bt/controller/esp32c6/bt.c | 2 +- components/bt/controller/esp32h2/bt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 7418749901..3881045da1 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -679,7 +679,7 @@ void ble_controller_scan_duplicate_config(void) duplicate_mode |= FILTER_DUPLICATE_EXCEPTION_FOR_MESH; - ble_vhci_disc_duplicate_mode_disable(0xFF); + ble_vhci_disc_duplicate_mode_disable(0xFFFFFFFF); ble_vhci_disc_duplicate_mode_enable(duplicate_mode); ble_vhci_disc_duplicate_set_max_cache_size(cache_size); ble_vhci_disc_duplicate_set_period_refresh_time(CONFIG_BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD); diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index 6b17763338..3d5c66a8ca 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -645,7 +645,7 @@ void ble_controller_scan_duplicate_config(void) duplicate_mode |= FILTER_DUPLICATE_EXCEPTION_FOR_MESH; - ble_vhci_disc_duplicate_mode_disable(0xFF); + ble_vhci_disc_duplicate_mode_disable(0xFFFFFFFF); ble_vhci_disc_duplicate_mode_enable(duplicate_mode); ble_vhci_disc_duplicate_set_max_cache_size(cache_size); ble_vhci_disc_duplicate_set_period_refresh_time(CONFIG_BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD);