2023-07-13 23:02:58

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ 1/2] bthost: Add support to set ISO Packet Status

From: Luiz Augusto von Dentz <[email protected]>

This adds support to set ISO Packet Status to bthost_send_iso.
---
emulator/bthost.c | 12 ++++++------
emulator/bthost.h | 4 ++--
tools/iso-tester.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/emulator/bthost.c b/emulator/bthost.c
index 3179bb3d20fe..c7d59eefc80c 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -732,8 +732,8 @@ void bthost_send_cid_v(struct bthost *bthost, uint16_t handle, uint16_t cid,
}

static void send_iso(struct bthost *bthost, uint16_t handle, bool ts,
- uint16_t sn, uint32_t timestamp,
- const struct iovec *iov, int iovcnt)
+ uint16_t sn, uint32_t timestamp, uint8_t pkt_status,
+ const struct iovec *iov, int iovcnt)
{
struct bt_hci_iso_hdr iso_hdr;
struct bt_hci_iso_data_start data_hdr;
@@ -773,7 +773,7 @@ static void send_iso(struct bthost *bthost, uint16_t handle, bool ts,
}

data_hdr.sn = cpu_to_le16(sn);
- data_hdr.slen = cpu_to_le16(iso_data_len_pack(len, 0));
+ data_hdr.slen = cpu_to_le16(iso_data_len_pack(len, pkt_status));

pdu[3].iov_base = &data_hdr;
pdu[3].iov_len = sizeof(data_hdr);
@@ -782,8 +782,8 @@ static void send_iso(struct bthost *bthost, uint16_t handle, bool ts,
}

void bthost_send_iso(struct bthost *bthost, uint16_t handle, bool ts,
- uint16_t sn, uint32_t timestamp,
- const struct iovec *iov, int iovcnt)
+ uint16_t sn, uint32_t timestamp, uint8_t pkt_status,
+ const struct iovec *iov, int iovcnt)
{
struct btconn *conn;

@@ -791,7 +791,7 @@ void bthost_send_iso(struct bthost *bthost, uint16_t handle, bool ts,
if (!conn)
return;

- send_iso(bthost, handle, ts, sn, timestamp, iov, iovcnt);
+ send_iso(bthost, handle, ts, sn, timestamp, pkt_status, iov, iovcnt);
}

bool bthost_l2cap_req(struct bthost *bthost, uint16_t handle, uint8_t code,
diff --git a/emulator/bthost.h b/emulator/bthost.h
index cdc12dc1ce8e..46781365b283 100644
--- a/emulator/bthost.h
+++ b/emulator/bthost.h
@@ -81,8 +81,8 @@ void bthost_send_cid(struct bthost *bthost, uint16_t handle, uint16_t cid,
void bthost_send_cid_v(struct bthost *bthost, uint16_t handle, uint16_t cid,
const struct iovec *iov, int iovcnt);
void bthost_send_iso(struct bthost *bthost, uint16_t handle, bool ts,
- uint16_t sn, uint32_t timestamp,
- const struct iovec *iov, int iovcnt);
+ uint16_t sn, uint32_t timestamp, uint8_t pkt_status,
+ const struct iovec *iov, int iovcnt);

typedef void (*bthost_l2cap_rsp_cb) (uint8_t code, const void *data,
uint16_t len, void *user_data);
diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index bbd5a47f6197..7140f83b2236 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
@@ -1715,7 +1715,7 @@ static void iso_recv(struct test_data *data, GIOChannel *io)

host = hciemu_client_get_host(data->hciemu);
bthost_send_iso(host, data->handle, isodata->ts, sn++, 0,
- isodata->recv, 1);
+ isodata->pkt_status, isodata->recv, 1);

data->io_id[0] = g_io_add_watch(io, G_IO_IN, iso_recv_data, data);
}
--
2.40.1