From 0f5f6cad205c42752f41dbaf008cb6773dd633ad Mon Sep 17 00:00:00 2001 From: Dmitrii Sharshakov Date: Mon, 9 Jun 2025 16:38:09 +0200 Subject: [PATCH] btdev: fix LE Remove ISO Data Path command Fix errors in BAP server --- emulator/btdev.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 4cf48a5af..2c62dc711 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -6726,30 +6726,34 @@ done: static int cmd_remove_iso_path(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_remove_iso_path *cmd = data; - uint8_t status = BT_HCI_ERR_SUCCESS; + struct bt_hci_rsp_le_remove_iso_path rsp; struct btdev_conn *conn; + memset(&rsp, 0, sizeof(rsp)); + + rsp.handle = cmd->handle; + conn = queue_find(dev->conns, match_handle, UINT_TO_PTR(cpu_to_le16(cmd->handle))); if (!conn) { - status = BT_HCI_ERR_UNKNOWN_CONN_ID; + rsp.status = BT_HCI_ERR_UNKNOWN_CONN_ID; goto done; } - switch (cmd->direction) { - case 0x00: + if (cmd->direction > 0x3) { + rsp.status = BT_HCI_ERR_INVALID_PARAMETERS; + goto done; + } + + if (cmd->direction & 0x1) dev->le_iso_path[0] = 0x00; - break; - case 0x01: + + if (cmd->direction & 0x2) dev->le_iso_path[1] = 0x00; - break; - default: - status = BT_HCI_ERR_INVALID_PARAMETERS; - } done: - cmd_complete(dev, BT_HCI_CMD_LE_REMOVE_ISO_PATH, &status, - sizeof(status)); + cmd_complete(dev, BT_HCI_CMD_LE_REMOVE_ISO_PATH, &rsp, + sizeof(rsp)); return 0; } -- 2.47.3