From: Pauli Virtanen <pav@iki.fi>
To: linux-bluetooth@vger.kernel.org
Cc: Pauli Virtanen <pav@iki.fi>
Subject: [PATCH BlueZ 2/4] btdev: fix inactive CIG configurable status
Date: Sun, 28 May 2023 17:39:14 +0000 [thread overview]
Message-ID: <1788d43df1a572539158d133f8d330e36340d7fe.1685283364.git.pav@iki.fi> (raw)
In-Reply-To: <502997002ac9d4a76593aa4ba8237b7fb803c701.1685283364.git.pav@iki.fi>
CIG shall not be configurable after the first Create CIS until Remove
CIG is issued (Core v5.3 Vol 6 Part B Sec. 4.5.14.3). We currently have
it configurable in the inactive state (Create CIS done and all CIS
closed), which is incorrect.
Track CIG state and allow reconfigure only in nonexistent/configured
state, i.e., when no CIS have been created yet.
---
emulator/btdev.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index f9260511a..98d7af99e 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -105,6 +105,7 @@ struct le_ext_adv {
struct le_cig {
struct bt_hci_cmd_le_set_cig_params params;
struct bt_hci_cis_params cis[CIS_SIZE];
+ bool activated;
} __attribute__ ((packed));
struct btdev {
@@ -5864,29 +5865,24 @@ static int cmd_set_cig_params(struct btdev *dev, const void *data,
goto done;
}
+ /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E
+ * page 2553
+ *
+ * If the Host issues this command when the CIG is not in the
+ * configurable state, the Controller shall return the error
+ * code Command Disallowed (0x0C).
+ */
+ if (dev->le_cig[cig_idx].activated) {
+ rsp.params.status = BT_HCI_ERR_COMMAND_DISALLOWED;
+ goto done;
+ }
+
rsp.params.status = BT_HCI_ERR_SUCCESS;
rsp.params.cig_id = cmd->cig_id;
for (i = 0; i < cmd->num_cis; i++) {
- struct btdev_conn *iso;
-
rsp.params.num_handles++;
rsp.handle[i] = cpu_to_le16(make_cis_handle(cig_idx, i));
-
- /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E
- * page 2553
- *
- * If the Host issues this command when the CIG is not in the
- * configurable state, the Controller shall return the error
- * code Command Disallowed (0x0C).
- */
- iso = queue_find(dev->conns, match_handle,
- UINT_TO_PTR(le16_to_cpu(rsp.handle[i])));
- if (iso) {
- rsp.params.status = BT_HCI_ERR_COMMAND_DISALLOWED;
- i = 0;
- goto done;
- }
}
memcpy(&dev->le_cig[cig_idx], data, len);
@@ -6006,6 +6002,8 @@ static int cmd_create_cis_complete(struct btdev *dev, const void *data,
evt.cig_id = le_cig->params.cig_id;
evt.cis_id = le_cig->cis[cis_idx].cis_id;
+ le_cig->activated = true;
+
le_meta_event(iso->link->dev, BT_HCI_EVT_LE_CIS_REQ, &evt,
sizeof(evt));
}
--
2.40.1
next prev parent reply other threads:[~2023-05-28 17:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-28 17:39 [PATCH BlueZ 1/4] iso-tester: Add tests for AC configuration reconnect Pauli Virtanen
2023-05-28 17:39 ` Pauli Virtanen [this message]
2023-05-28 17:39 ` [PATCH BlueZ 3/4] btdev: check LE Create CIS error conditions Pauli Virtanen
2023-05-28 17:39 ` [PATCH BlueZ 4/4] test-runner: enable no_hash_pointers=1 Pauli Virtanen
2023-05-28 20:07 ` [BlueZ,1/4] iso-tester: Add tests for AC configuration reconnect bluez.test.bot
2023-05-30 18:40 ` [PATCH BlueZ 1/4] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1788d43df1a572539158d133f8d330e36340d7fe.1685283364.git.pav@iki.fi \
--to=pav@iki.fi \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).