diff mbox series

[v1] Bluetooth: Read codec capabilities only if supported

Message ID 20211005144556.22074-1-kiran.k@intel.com (mailing list archive)
State Accepted
Headers show
Series [v1] Bluetooth: Read codec capabilities only if supported | expand

Checks

Context Check Description
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/buildkernel success Build Kernel PASS
tedd_an/testrunnersetup success Test Runner Setup PASS
tedd_an/testrunnerl2cap-tester success Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerbnep-tester success Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnermgmt-tester fail Total: 462, Passed: 459 (99.4%), Failed: 3, Not Run: 0
tedd_an/testrunnerrfcomm-tester success Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersco-tester success Total: 12, Passed: 12 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersmp-tester success Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunneruserchan-tester success Total: 4, Passed: 4 (100.0%), Failed: 0, Not Run: 0

Commit Message

K, Kiran Oct. 5, 2021, 2:45 p.m. UTC
Read codec capabilities only if HCI_READ_LOCAL_CODEC_CAPABILITIES
command is supported. If capablities are not supported, then
cache codec data without caps.

Signed-off-by: Kiran K <kiran.k@intel.com>
---
 net/bluetooth/hci_codec.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Oct. 5, 2021, 4:11 p.m. UTC | #1
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=557813

---Test result---

Test Summary:
CheckPatch                    PASS      1.63 seconds
GitLint                       PASS      0.93 seconds
BuildKernel                   PASS      646.49 seconds
TestRunner: Setup             PASS      479.86 seconds
TestRunner: l2cap-tester      PASS      10.63 seconds
TestRunner: bnep-tester       PASS      5.71 seconds
TestRunner: mgmt-tester       FAIL      93.67 seconds
TestRunner: rfcomm-tester     PASS      7.01 seconds
TestRunner: sco-tester        PASS      7.24 seconds
TestRunner: smp-tester        PASS      7.07 seconds
TestRunner: userchan-tester   PASS      5.92 seconds

Details
##############################
Test: TestRunner: mgmt-tester - FAIL - 93.67 seconds
Run test-runner with mgmt-tester
Total: 462, Passed: 459 (99.4%), Failed: 3, Not Run: 0

Failed Test Cases
Suspend/Resume - Success 1 (Suspend)                 Failed       0.136 seconds
Suspend/Resume - Success 3 (Device in WL)            Failed       0.132 seconds
Suspend/Resume - Success 4 (Advertising)             Failed       0.144 seconds



---
Regards,
Linux Bluetooth
Marcel Holtmann Oct. 6, 2021, 8:53 a.m. UTC | #2
Hi Kiran,

> Read codec capabilities only if HCI_READ_LOCAL_CODEC_CAPABILITIES
> command is supported. If capablities are not supported, then
> cache codec data without caps.
> 
> Signed-off-by: Kiran K <kiran.k@intel.com>
> ---
> net/bluetooth/hci_codec.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/net/bluetooth/hci_codec.c b/net/bluetooth/hci_codec.c
index f0421d0edaa3..38201532f58e 100644
--- a/net/bluetooth/hci_codec.c
+++ b/net/bluetooth/hci_codec.c
@@ -25,9 +25,11 @@  static int hci_codec_list_add(struct list_head *list,
 	}
 	entry->transport = sent->transport;
 	entry->len = len;
-	entry->num_caps = rp->num_caps;
-	if (rp->num_caps)
+	entry->num_caps = 0;
+	if (rp) {
+		entry->num_caps = rp->num_caps;
 		memcpy(entry->caps, caps, len);
+	}
 	list_add(&entry->list, list);
 
 	return 0;
@@ -58,6 +60,18 @@  static void hci_read_codec_capabilities(struct hci_dev *hdev, __u8 transport,
 			__u32 len;
 
 			cmd->transport = i;
+
+			/* If Read_Codec_Capabilities command is not supported
+			 * then just add codec to the list without caps
+			 */
+			if (!(hdev->commands[45] & 0x08)) {
+				hci_dev_lock(hdev);
+				hci_codec_list_add(&hdev->local_codecs, cmd,
+						   NULL, NULL, 0);
+				hci_dev_unlock(hdev);
+				continue;
+			}
+
 			skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_CODEC_CAPS,
 					     sizeof(*cmd), cmd,
 					     HCI_CMD_TIMEOUT);