Skip to content

Commit cc35750

Browse files
Thalleynashif
authored andcommitted
Bluetooth: ISO: Add missing handling of interval and latency of unidir
Adds missing handling of the m_interval and m_latency if tx QOS is not set, and handling of the s_interval and s_latency if rx QOS is not set. Signed-off-by: Emil Gydesen <[email protected]>
1 parent e53d549 commit cc35750

File tree

1 file changed

+23
-4
lines changed
  • subsys/bluetooth/host

1 file changed

+23
-4
lines changed

subsys/bluetooth/host/iso.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,11 @@ static struct net_buf *hci_le_set_cig_params(struct bt_iso_create_param *param)
385385
struct net_buf *rsp;
386386
int i, err;
387387

388+
if (!param->chans[0]->qos->tx && !param->chans[0]->qos->rx) {
389+
BT_ERR("Both TX and RX QoS are disabled");
390+
return NULL;
391+
}
392+
388393
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CIG_PARAMS,
389394
sizeof(*req) + sizeof(*cis) * param->num_conns);
390395
if (!buf) {
@@ -396,13 +401,27 @@ static struct net_buf *hci_le_set_cig_params(struct bt_iso_create_param *param)
396401
memset(req, 0, sizeof(*req));
397402

398403
req->cig_id = param->conns[0]->iso.cig_id;
399-
sys_put_le24(param->chans[0]->qos->tx->interval, req->m_interval);
400-
sys_put_le24(param->chans[0]->qos->rx->interval, req->s_interval);
404+
if (param->chans[0]->qos->tx) {
405+
sys_put_le24(param->chans[0]->qos->tx->interval, req->m_interval);
406+
req->m_latency = sys_cpu_to_le16(param->chans[0]->qos->tx->latency);
407+
} else {
408+
/* Use RX values if TX is disabled */
409+
sys_put_le24(param->chans[0]->qos->rx->interval, req->m_interval);
410+
req->m_latency = sys_cpu_to_le16(param->chans[0]->qos->rx->latency);
411+
}
412+
413+
if (param->chans[0]->qos->rx) {
414+
sys_put_le24(param->chans[0]->qos->rx->interval, req->s_interval);
415+
req->s_latency = sys_cpu_to_le16(param->chans[0]->qos->rx->latency);
416+
} else {
417+
/* Use TX values if RX is disabled */
418+
sys_put_le24(param->chans[0]->qos->tx->interval, req->s_interval);
419+
req->s_latency = sys_cpu_to_le16(param->chans[0]->qos->tx->latency);
420+
}
421+
401422
req->sca = param->chans[0]->qos->sca;
402423
req->packing = param->chans[0]->qos->packing;
403424
req->framing = param->chans[0]->qos->framing;
404-
req->m_latency = sys_cpu_to_le16(param->chans[0]->qos->tx->latency);
405-
req->s_latency = sys_cpu_to_le16(param->chans[0]->qos->rx->latency);
406425
req->num_cis = param->num_conns;
407426

408427
/* Program the cis parameters */

0 commit comments

Comments
 (0)