2023-04-13 18:20:31

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ 1/2] btdev: Fix not setting CIS parameters properly

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

The code was assuming only index 0 was to be used which doesn't work
when there are multiple CIS being programmed with different parameters.
---
emulator/btdev.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 549f93645684..a04f34d4bdb3 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -5885,6 +5885,7 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,

if (!evt.status) {
struct btdev *remote = conn->link->dev;
+ int i = conn->handle - ISO_HANDLE;

/* TODO: Figure out if these values makes sense */
memcpy(evt.cig_sync_delay, remote->le_cig.params.c_interval,
@@ -5895,15 +5896,15 @@ static void le_cis_estabilished(struct btdev *dev, struct btdev_conn *conn,
sizeof(remote->le_cig.params.c_interval));
memcpy(evt.p_latency, &remote->le_cig.params.p_interval,
sizeof(remote->le_cig.params.p_interval));
- evt.c_phy = remote->le_cig.cis[0].c_phy;
- evt.p_phy = remote->le_cig.cis[0].p_phy;
+ evt.c_phy = remote->le_cig.cis[i].c_phy;
+ evt.p_phy = remote->le_cig.cis[i].p_phy;
evt.nse = 0x01;
evt.c_bn = 0x01;
evt.p_bn = 0x01;
evt.c_ft = 0x01;
evt.p_ft = 0x01;
- evt.c_mtu = remote->le_cig.cis[0].c_sdu;
- evt.p_mtu = remote->le_cig.cis[0].p_sdu;
+ evt.c_mtu = remote->le_cig.cis[i].c_sdu;
+ evt.p_mtu = remote->le_cig.cis[i].p_sdu;
evt.interval = remote->le_cig.params.c_latency;
}

@@ -5948,7 +5949,7 @@ static int cmd_create_cis_complete(struct btdev *dev, const void *data,
evt.acl_handle = cpu_to_le16(acl->handle);
evt.cis_handle = cpu_to_le16(iso->handle);
evt.cig_id = iso->dev->le_cig.params.cig_id;
- evt.cis_id = iso->dev->le_cig.cis[0].cis_id;
+ evt.cis_id = iso->dev->le_cig.cis[i].cis_id;

le_meta_event(iso->link->dev, BT_HCI_EVT_LE_CIS_REQ, &evt,
sizeof(evt));
--
2.39.2


2023-04-13 19:58:07

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,1/2] btdev: Fix not setting CIS parameters properly

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=739570

---Test result---

Test Summary:
CheckPatch FAIL 1.53 seconds
GitLint PASS 0.68 seconds
BuildEll PASS 26.95 seconds
BluezMake PASS 986.88 seconds
MakeCheck PASS 11.62 seconds
MakeDistcheck PASS 149.78 seconds
CheckValgrind PASS 246.19 seconds
CheckSmatch WARNING 330.56 seconds
bluezmakeextell PASS 99.32 seconds
IncrementalBuild PASS 1653.35 seconds
ScanBuild PASS 1029.10 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,2/2] iso-tester: Add BAP Audio Configuration tests
ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#258: FILE: tools/iso-tester.c:796:
+static const struct iso_client_data connect_ac_6i= {
^

ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#265: FILE: tools/iso-tester.c:803:
+static const struct iso_client_data connect_ac_6ii= {
^

ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#272: FILE: tools/iso-tester.c:810:
+static const struct iso_client_data connect_ac_7i= {
^

ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#279: FILE: tools/iso-tester.c:817:
+static const struct iso_client_data connect_ac_7ii= {
^

ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#286: FILE: tools/iso-tester.c:824:
+static const struct iso_client_data connect_ac_8i= {
^

ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#293: FILE: tools/iso-tester.c:831:
+static const struct iso_client_data connect_ac_8ii= {
^

ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#300: FILE: tools/iso-tester.c:838:
+static const struct iso_client_data connect_ac_9i= {
^

ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#307: FILE: tools/iso-tester.c:845:
+static const struct iso_client_data connect_ac_9ii= {
^

ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#314: FILE: tools/iso-tester.c:852:
+static const struct iso_client_data connect_ac_11i= {
^

ERROR:SPACING: spaces required around that '=' (ctx:VxW)
#321: FILE: tools/iso-tester.c:859:
+static const struct iso_client_data connect_ac_11ii= {
^

/github/workspace/src/src/13210503.patch total: 10 errors, 0 warnings, 388 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13210503.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:412:29: warning: Variable length array is used.


---
Regards,
Linux Bluetooth