Skip to content

Commit 2512588

Browse files
committed
fix(nimble): De-register host cb in stack deinit
1 parent 5a5c004 commit 2512588

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ static void controller_rcv_pkt_ready(void)
190190
}
191191
}
192192

193+
static void dummy_controller_rcv_pkt_ready(void)
194+
{
195+
/* Dummy function */
196+
}
197+
193198
void bt_record_hci_data(uint8_t *data, uint16_t len)
194199
{
195200
#if (BT_HCI_LOG_INCLUDED == TRUE)
@@ -203,6 +208,12 @@ void bt_record_hci_data(uint8_t *data, uint16_t len)
203208
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
204209
}
205210

211+
static int dummy_host_rcv_pkt(uint8_t *data, uint16_t len)
212+
{
213+
/* Dummy function */
214+
return 0;
215+
}
216+
206217
/*
207218
* @brief: BT controller callback function, to transfer data packet to the host
208219
*/
@@ -264,6 +275,11 @@ static const esp_vhci_host_callback_t vhci_host_cb = {
264275
.notify_host_recv = host_rcv_pkt,
265276
};
266277

278+
static const esp_vhci_host_callback_t dummy_vhci_host_cb = {
279+
.notify_host_send_available = dummy_controller_rcv_pkt_ready,
280+
.notify_host_recv = dummy_host_rcv_pkt,
281+
};
282+
267283

268284
extern void ble_transport_init(void);
269285
extern esp_err_t ble_buf_alloc(void);
@@ -313,6 +329,8 @@ esp_err_t esp_nimble_hci_deinit(void)
313329
}
314330
ble_transport_deinit();
315331

332+
esp_vhci_host_register_callback(&dummy_vhci_host_cb);
333+
316334
ble_buf_free();
317335

318336
#if MYNEWT_VAL(BLE_QUEUE_CONG_CHECK)

examples/bluetooth/nimble/bleprph_host_only/main/uart_driver.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ ble_transport_ll_init(void)
177177

178178
}
179179

180+
void
181+
ble_transport_ll_deinit(void)
182+
{
183+
184+
}
185+
180186
int
181187
ble_transport_to_ll_acl_impl(struct os_mbuf *om)
182188
{

0 commit comments

Comments
 (0)