Diff between a112d434577182894598ae8e7d0d98c0fa4745c9 and aeeb4fd64adfcf7ca7adaac8dadca43dab6f2939

Changed Files

File Additions Deletions Status
emulator/btdev.c +11 -0 modified
emulator/btdev.h +3 -0 modified
emulator/hciemu.c +4 -0 modified

Full Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 76bae5e..cf5c36b 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -7460,6 +7460,17 @@ const uint8_t *btdev_get_adv_addr(struct btdev *btdev, uint8_t handle)
 	return ext_adv_addr(btdev, ext_adv);
 }
 
+void btdev_get_mtu(struct btdev *btdev, uint16_t *acl, uint16_t *sco,
+								uint16_t *iso)
+{
+	if (acl)
+		*acl = btdev->acl_mtu;
+	if (sco)
+		*acl = btdev->sco_mtu;
+	if (iso)
+		*iso = btdev->iso_mtu;
+}
+
 void btdev_set_le_states(struct btdev *btdev, const uint8_t *le_states)
 {
 	memcpy(btdev->le_states, le_states, sizeof(btdev->le_states));
diff --git a/emulator/btdev.h b/emulator/btdev.h
index a96c1a3..c7b3b46 100644
--- a/emulator/btdev.h
+++ b/emulator/btdev.h
@@ -84,6 +84,9 @@ uint8_t btdev_get_le_scan_enable(struct btdev *btdev);
 
 const uint8_t *btdev_get_adv_addr(struct btdev *btdev, uint8_t handle);
 
+void btdev_get_mtu(struct btdev *btdev, uint16_t *acl, uint16_t *sco,
+								uint16_t *iso);
+
 void btdev_set_le_states(struct btdev *btdev, const uint8_t *le_states);
 
 void btdev_set_al_len(struct btdev *btdev, uint8_t len);
diff --git a/emulator/hciemu.c b/emulator/hciemu.c
index ccc57aa..8529caa 100644
--- a/emulator/hciemu.c
+++ b/emulator/hciemu.c
@@ -308,6 +308,7 @@ static struct hciemu_client *hciemu_client_new(struct hciemu *hciemu,
 {
 	struct hciemu_client *client;
 	int sv[2];
+	uint16_t mtu;
 
 	client = new0(struct hciemu_client, 1);
 	if (!client)
@@ -342,6 +343,9 @@ static struct hciemu_client *hciemu_client_new(struct hciemu *hciemu,
 	client->host_source = create_source_bthost(sv[1], client->host);
 	client->start_source = g_idle_add(start_host, client);
 
+	btdev_get_mtu(client->dev, &mtu, NULL, NULL);
+	bthost_set_acl_mtu(client->host, mtu);
+
 	return client;
 }