summaryrefslogtreecommitdiff
path: root/emulator
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-04-06 13:01:03 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-04-06 15:02:00 -0700
commitd1871fc935228f034741e1f5064a0f3e2234ffcd (patch)
treed4aaf042846360b729718e6391c683bfafdfbc0a /emulator
parent10948891336d8ca43055c465e3d00f428a035c4c (diff)
downloadbluez-d1871fc935228f034741e1f5064a0f3e2234ffcd.tar.gz
btdev: Fix BIG Create Sync
This fixes status return to BIG Create Sync command.
Diffstat (limited to 'emulator')
-rw-r--r--emulator/btdev.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/emulator/btdev.c b/emulator/btdev.c
index d191c829b..f70fa9136 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -6070,15 +6070,19 @@ static int cmd_big_create_sync(struct btdev *dev, const void *data, uint8_t len)
/* If the Sync_Handle does not exist, the Controller shall return the
* error code Unknown Advertising Identifier (0x42).
*/
- if (dev->le_pa_sync_handle != le16_to_cpu(cmd->sync_handle))
+ if (dev->le_pa_sync_handle != le16_to_cpu(cmd->sync_handle)) {
status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID;
+ goto done;
+ }
/* If the Host sends this command with a BIG_Handle that is already
* allocated, the Controller shall return the error code Command
* Disallowed (0x0C).
*/
- if (dev->big_handle == cmd->handle)
+ if (dev->big_handle == cmd->handle) {
status = BT_HCI_ERR_COMMAND_DISALLOWED;
+ goto done;
+ }
/* If the Num_BIS parameter is greater than the total number of BISes
* in the BIG, the Controller shall return the error code Unsupported
@@ -6087,12 +6091,10 @@ static int cmd_big_create_sync(struct btdev *dev, const void *data, uint8_t len)
if (cmd->num_bis != len - sizeof(*cmd))
status = BT_HCI_ERR_UNSUPPORTED_FEATURE;
- if (status)
- return status;
-
+done:
cmd_status(dev, status, BT_HCI_CMD_LE_BIG_CREATE_SYNC);
- return status;
+ return 0;
}
static int cmd_big_create_sync_complete(struct btdev *dev, const void *data,
@@ -6140,7 +6142,7 @@ static int cmd_big_create_sync_complete(struct btdev *dev, const void *data,
pdu.ev.pto = 0x00;
pdu.ev.irc = 0x01;
pdu.ev.max_pdu = bis->sdu;
- pdu.ev.interval = bis->latency;
+ pdu.ev.interval = bis->latency / 1.25;
pdu.ev.num_bis = cmd->num_bis;
le_meta_event(dev, BT_HCI_EVT_LE_BIG_SYNC_ESTABILISHED, &pdu,
@@ -6873,6 +6875,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id)
btdev->iso_mtu = 251;
btdev->iso_max_pkt = 1;
btdev->le_cig.params.cig_id = 0xff;
+ btdev->big_handle = 0xff;
btdev->country_code = 0x00;