Skip to content

Commit a5e7c6c

Browse files
committed
Merge branch 'feat/ble_mesh_micellaneous_fix_v5.3' into 'release/v5.3'
Feat/ble mesh micellaneous fix (v5.3) See merge request espressif/esp-idf!39636
2 parents fed967d + 9b9b5c3 commit a5e7c6c

File tree

5 files changed

+29
-9
lines changed

5 files changed

+29
-9
lines changed

components/bt/esp_ble_mesh/core/bluedroid_host/adapter.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,8 +1599,10 @@ static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
15991599
for (i = 0; i < ARRAY_SIZE(bt_mesh_gattc_info); i++) {
16001600
if (bt_mesh_gattc_info[i].conn.handle == handle) {
16011601
if (bt_mesh_gattc_info[i].wr_desc_done == false) {
1602-
BT_DBG("Receive notification before finishing to write ccc");
1602+
BT_WARN("Receive notification before finishing to write ccc");
1603+
#if !CONFIG_BLE_MESH_BQB_TEST
16031604
return;
1605+
#endif
16041606
}
16051607

16061608
conn = &bt_mesh_gattc_info[i].conn;

components/bt/esp_ble_mesh/core/proxy_client.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -31,7 +31,7 @@
3131

3232
static struct bt_mesh_proxy_server {
3333
struct bt_mesh_conn *conn;
34-
34+
bt_mesh_addr_t addr;
3535
enum __attribute__((packed)) {
3636
CLI_NONE,
3737
CLI_PROV,
@@ -465,6 +465,7 @@ static void proxy_connected(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn, int
465465

466466
server->conn = bt_mesh_conn_ref(conn);
467467
server->conn_type = CLI_NONE;
468+
memcpy(&server->addr, addr, sizeof(bt_mesh_addr_t));
468469
net_buf_simple_reset(&server->buf);
469470

470471
#if CONFIG_BLE_MESH_RPR_SRV && CONFIG_BLE_MESH_PB_GATT
@@ -629,6 +630,12 @@ static ssize_t proxy_write_ccc(bt_mesh_addr_t *addr, struct bt_mesh_conn *conn)
629630
return 0;
630631
}
631632

633+
#if CONFIG_BLE_MESH_BQB_TEST
634+
/* notify maybe received first */
635+
if (server->conn_type == CLI_PROXY) {
636+
return 0;
637+
}
638+
#endif
632639
return -EINVAL;
633640
}
634641

@@ -641,6 +648,16 @@ static ssize_t proxy_recv_ntf(struct bt_mesh_conn *conn, uint8_t *data, uint16_t
641648
return -ENOTCONN;
642649
}
643650

651+
#if CONFIG_BLE_MESH_BQB_TEST
652+
/* update conn type if notify received before write ccc */
653+
if (server->conn_type == CLI_NONE) {
654+
server->conn_type = CLI_PROXY;
655+
if (proxy_client_connect_cb) {
656+
proxy_client_connect_cb(&server->addr, server - servers, server->net_idx);
657+
}
658+
}
659+
#endif
660+
644661
if (server->conn_type == CLI_PROXY) {
645662
return proxy_recv(conn, NULL, data, len, 0, 0);
646663
}

components/bt/esp_ble_mesh/core/proxy_server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ int bt_mesh_proxy_server_segment_send(struct bt_mesh_conn *conn, uint8_t type,
13411341
net_buf_simple_pull(msg, mtu);
13421342

13431343
while (msg->len) {
1344-
if (msg->len + 1 < mtu) {
1344+
if (msg->len + 1 <= mtu) {
13451345
net_buf_simple_push_u8(msg, BLE_MESH_PROXY_PDU_HDR(BLE_MESH_PROXY_SAR_LAST, type));
13461346
proxy_send(conn, msg->data, msg->len);
13471347
break;

components/bt/esp_ble_mesh/core/scan.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*
44
* SPDX-FileCopyrightText: 2017 Intel Corporation
5-
* SPDX-FileContributor: 2020-2024 Espressif Systems (Shanghai) CO LTD
5+
* SPDX-FileContributor: 2020-2025 Espressif Systems (Shanghai) CO LTD
66
*
77
* SPDX-License-Identifier: Apache-2.0
88
*/
@@ -86,13 +86,14 @@ int bt_mesh_unprov_dev_info_query(uint8_t uuid[16], uint8_t addr[6],
8686
{
8787
uint8_t idx = 0;
8888
uint8_t cnt = 0;
89+
uint8_t pair_num = unprov_dev_info_fifo.pair_num;
8990

90-
if (uuid == NULL || addr == NULL) {
91+
if (uuid == NULL && addr == NULL) {
9192
BT_WARN("No available information to query");
9293
return -1;
9394
}
9495

95-
while (cnt < unprov_dev_info_fifo.pair_num) {
96+
while (cnt < pair_num) {
9697
idx = (cnt + unprov_dev_info_fifo.start_idx) % BLE_MESH_STORE_UNPROV_INFO_MAX_NUM;
9798
if (query_type & BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_UUID) {
9899
if (!memcmp(unprov_dev_info_fifo.info[idx].addr, addr, 6)) {
@@ -118,7 +119,7 @@ int bt_mesh_unprov_dev_info_query(uint8_t uuid[16], uint8_t addr[6],
118119
cnt++;
119120
}
120121

121-
if (cnt == unprov_dev_info_fifo.pair_num) {
122+
if (cnt == pair_num) {
122123
return -1;
123124
}
124125

0 commit comments

Comments
 (0)