You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/11/22 07:50:52 UTC

[mynewt-nimble] branch master updated: transport/usb: Drop events when not mounted

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new 57eb423  transport/usb: Drop events when not mounted
57eb423 is described below

commit 57eb4237aed7f2345eb970a9a5278ea2ee2f3280
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Nov 19 08:41:08 2021 +0100

    transport/usb: Drop events when not mounted
    
    If controller sends events before USB transport is ready
    event will be added to events queue but later interface
    initialization will clear queue without sending notification
    that event was sent to host.
    
    This change drops events generated by controller (most likely first NOP)
    if host is not connected yet.
---
 nimble/transport/usb/src/ble_hci_usb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/nimble/transport/usb/src/ble_hci_usb.c b/nimble/transport/usb/src/ble_hci_usb.c
index 3f87856..8160536 100644
--- a/nimble/transport/usb/src/ble_hci_usb.c
+++ b/nimble/transport/usb/src/ble_hci_usb.c
@@ -285,6 +285,11 @@ ble_hci_trans_ll_evt_tx(uint8_t *hci_ev)
 
     assert(hci_ev != NULL);
 
+    if (!tud_ready()) {
+        ble_hci_trans_buf_free(hci_ev);
+        return 0;
+    }
+
     pkt = os_memblock_get(&ble_hci_pkt_pool);
     if (pkt == NULL) {
         ble_hci_trans_buf_free(hci_ev);