From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> BT_HCI_EVT_LE_BIG_SYNC_LOST must be sent with the BIG handle used by the remote peer which may be different than the one use with BT_HCI_CMD_LE_TERM_BIG. --- emulator/btdev.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 5dd7d099432c..6833d4d51920 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -6561,6 +6561,14 @@ done: return 0; } +static bool match_bis(const void *data, const void *match_data) +{ + const struct le_big *big = data; + const struct btdev_conn *conn = match_data; + + return queue_find(big->bis, NULL, conn); +} + static int cmd_term_big_complete(struct btdev *dev, const void *data, uint8_t len) { @@ -6593,13 +6601,17 @@ static int cmd_term_big_complete(struct btdev *dev, const void *data, if (conn->link->dev != remote) { struct bt_hci_evt_le_big_sync_lost evt; - memset(&evt, 0, sizeof(evt)); - evt.big_handle = cmd->handle; - evt.reason = cmd->reason; - remote = conn->link->dev; - le_meta_event(remote, BT_HCI_EVT_LE_BIG_SYNC_LOST, - &evt, sizeof(evt)); + + big = queue_find(remote->le_big, match_bis, conn->link); + if (big) { + memset(&evt, 0, sizeof(evt)); + evt.big_handle = big->handle; + evt.reason = cmd->reason; + le_meta_event(remote, + BT_HCI_EVT_LE_BIG_SYNC_LOST, + &evt, sizeof(evt)); + } } /* Unlink conn from remote BIS */ -- 2.50.1