Skip to contentSkip to conversation

device: Fix storing conn parameters without first attempting to use them

PATCH Applied Luiz Augusto von Dentz 3 participants 4 messages Jun 12, 2024 – Jun 13, 2024 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 device: Fix storing conn parameters without first attempting to use them

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

Some controller seems to have problems to use connections parameters that comes from PPCP as seem bellow, so instead of storing the parameters immediately this wait the MGMT_EV_NEW_CONN_PARAM to confirm the connection parameters are save to be stored:

< HCI Command: LE Extended Create Connection (0x08|0x0043) plen 42

        Filter policy: Accept list is not used (0x00)
        Own address type: Public (0x00)
        Peer address type: Random (0x01)
        Peer address: FE:D5:D9:EC:AB:99 (Static)
        Initiating PHYs: 0x03
        Entry 0: LE 1M
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 7.50 msec (0x0006)
          Max connection interval: 4000.00 msec (0x0c80)
          Connection latency: 0 (0x0000)
          Supervision timeout: 5000 msec (0x01f4)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
        Entry 1: LE 2M
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 7.50 msec (0x0006)
          Max connection interval: 4000.00 msec (0x0c80)
          Connection latency: 0 (0x0000)
          Supervision timeout: 5000 msec (0x01f4)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Extended Create Connection (0x08|0x0043) ncmd 1
        Status: Invalid HCI Command Parameters (0x12)
---
 src/device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/device.c +4 -4
index ce794f315995..85857577ae11 100644
@@ -7435,10 +7435,10 @@ void btd_device_set_conn_param(struct btd_device *device, uint16_t min_interval,
 					uint16_t max_interval, uint16_t latency,
 					uint16_t timeout)
 {
-	btd_adapter_store_conn_param(device->adapter, &device->bdaddr,
-					device->bdaddr_type, min_interval,
-					max_interval, latency,
-					timeout);
+	/* Attempt to load the new connection parameters, in case it is
+	 * successful the MGMT_EV_NEW_CONN_PARAM will be generated which will
+	 * then trigger btd_adapter_store_conn_param.
+	 */
 	btd_adapter_load_conn_param(device->adapter, &device->bdaddr,
 					device->bdaddr_type, min_interval,
 					max_interval, latency,
Signature · 1 line
2.45.2
author maintainer
#1 lore raw

PATCH 2/2 gas: Fix default PPCP connection intervals

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

If the remove sets 0xffff switch to using 30-50ms as that is the recommended values for GAP as 7.5ms-4s seems to be causing problems on some controllers.

---
 profiles/gap/gas.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
profiles/gap/gas.c +7 -7
index b50a9c03acd1..dbe5f003bfba 100644
@@ -182,19 +182,19 @@ static void read_ppcp_cb(bool success, uint8_t att_ecode,
 	latency = get_le16(&value[4]);
 	timeout = get_le16(&value[6]);
 
+	/* 0xffff indicates no specific min/max */
+	if (min_interval == 0xffff)
+		min_interval = 0x0018; /* 30.0ms */
+
+	if (max_interval == 0xffff)
+		max_interval = 0x0028; /* 50.0ms */
+
 	DBG("GAP Peripheral Preferred Connection Parameters:");
 	DBG("\tMinimum connection interval: %u", min_interval);
 	DBG("\tMaximum connection interval: %u", max_interval);
 	DBG("\tSlave latency: %u", latency);
 	DBG("\tConnection Supervision timeout multiplier: %u", timeout);
 
-	/* 0xffff indicates no specific min/max */
-	if (min_interval == 0xffff)
-		min_interval = 6;
-
-	if (max_interval == 0xffff)
-		max_interval = 3200;
-
 	/* avoid persisting connection parameters that are not valid */
 	if (min_interval > max_interval ||
 	    min_interval < 6 || max_interval > 3200) {
Signature · 1 line
2.45.2
#2 lore raw
In reply to Luiz Augusto von Dentz

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=861326

---Test result---

Test Summary:

CheckPatch                    PASS      0.95 seconds
GitLint                       FAIL      0.89 seconds
BuildEll                      PASS      26.16 seconds
BluezMake                     PASS      1733.63 seconds
MakeCheck                     PASS      13.45 seconds
MakeDistcheck                 PASS      179.58 seconds
CheckValgrind                 PASS      254.32 seconds
CheckSmatch                   PASS      358.12 seconds
bluezmakeextell               PASS      120.42 seconds
IncrementalBuild              PASS      3141.96 seconds
ScanBuild                     PASS      1014.64 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v1,1/2] device: Fix storing conn parameters without first attempting to use them

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (87>80): "[BlueZ,v1,1/2] device: Fix storing conn parameters without first attempting to use them"

---
Regards,
Linux Bluetooth

#3 lore raw
In reply to Luiz Augusto von Dentz
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Wed, 12 Jun 2024 15:11:44 -0400 you wrote:

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

Some controller seems to have problems to use connections parameters that comes from PPCP as seem bellow, so instead of storing the parameters immediately this wait the MGMT_EV_NEW_CONN_PARAM to confirm the connection parameters are save to be stored:

[...]

Here is the summary with links:
- [BlueZ,v1,1/2] device: Fix storing conn parameters without first attempting to use them

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=98676d410bde
  - [BlueZ,v1,2/2] gas: Fix default PPCP connection intervals
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0b02371e2b15

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html