Skip to content

Commit

Permalink
Merge branch 'bugfix/add_dummy_cb_during_deinit_v5.3' into 'release/v…
Browse files Browse the repository at this point in the history
…5.3'

fix(nimble): De-register host cb in stack deinit (v5.3)

See merge request espressif/esp-idf!33373
  • Loading branch information
rahult-github committed Sep 16, 2024
2 parents 42fc277 + 62d9ebf commit d97d579
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ static void controller_rcv_pkt_ready(void)
}
}

static void dummy_controller_rcv_pkt_ready(void)
{
/* Dummy function */
}

void bt_record_hci_data(uint8_t *data, uint16_t len)
{
#if (BT_HCI_LOG_INCLUDED == TRUE)
Expand All @@ -203,6 +208,12 @@ void bt_record_hci_data(uint8_t *data, uint16_t len)
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
}

static int dummy_host_rcv_pkt(uint8_t *data, uint16_t len)
{
/* Dummy function */
return 0;
}

/*
* @brief: BT controller callback function, to transfer data packet to the host
*/
Expand Down Expand Up @@ -264,6 +275,11 @@ static const esp_vhci_host_callback_t vhci_host_cb = {
.notify_host_recv = host_rcv_pkt,
};

static const esp_vhci_host_callback_t dummy_vhci_host_cb = {
.notify_host_send_available = dummy_controller_rcv_pkt_ready,
.notify_host_recv = dummy_host_rcv_pkt,
};


extern void ble_transport_init(void);
extern esp_err_t ble_buf_alloc(void);
Expand Down Expand Up @@ -313,6 +329,8 @@ esp_err_t esp_nimble_hci_deinit(void)
}
ble_transport_deinit();

esp_vhci_host_register_callback(&dummy_vhci_host_cb);

ble_buf_free();

#if MYNEWT_VAL(BLE_QUEUE_CONG_CHECK)
Expand Down

0 comments on commit d97d579

Please sign in to comment.