diff mbox series

[BlueZ,1/1] policy: fix HSP/HFP reconnection

Message ID 20250401020221.119615-2-yao.wei@canonical.com (mailing list archive)
State New
Headers show
Series policy: fix HSP/HFP reconnection | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Yao Wei (魏銘廷) April 1, 2025, 2:02 a.m. UTC
This patch removes checking whether A2DP service initiates the
connection starting HSP/HFP connection, instead just start timer
when HSP/HFP is not connected, also move order so that setting
HSP/HFP connection timer is not blocked by AVRCP connection.

The previous patch also did not get HSP service if HFP is not
available.  This patch adds it in.
---
 plugins/policy.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

Comments

bluez.test.bot@gmail.com April 1, 2025, 3:55 a.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=948733

---Test result---

Test Summary:
CheckPatch                    PENDING   0.33 seconds
GitLint                       PENDING   0.40 seconds
BuildEll                      PASS      20.84 seconds
BluezMake                     PASS      1562.68 seconds
MakeCheck                     PASS      12.91 seconds
MakeDistcheck                 PASS      161.21 seconds
CheckValgrind                 PASS      217.39 seconds
CheckSmatch                   PASS      289.96 seconds
bluezmakeextell               PASS      100.81 seconds
IncrementalBuild              PENDING   0.36 seconds
ScanBuild                     PASS      893.38 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/plugins/policy.c b/plugins/policy.c
index 360d1359f..0e533ba1f 100644
--- a/plugins/policy.c
+++ b/plugins/policy.c
@@ -312,6 +312,14 @@  static void sink_cb(struct btd_service *service, btd_service_state_t old_state,
 			data->sink_timer = 0;
 		}
 
+		/* Try connecting HSP/HFP if it is not connected */
+		hs = btd_device_get_service(dev, HFP_HS_UUID);
+		if (hs == NULL)
+			hs = btd_device_get_service(data->dev, HSP_HS_UUID);
+		if (hs && btd_service_get_state(hs) !=
+						BTD_SERVICE_STATE_CONNECTED)
+			policy_set_hs_timer(data);
+
 		/* Check if service initiate the connection then proceed
 		 * immediatelly otherwise set timer
 		 */
@@ -321,16 +329,6 @@  static void sink_cb(struct btd_service *service, btd_service_state_t old_state,
 						BTD_SERVICE_STATE_CONNECTED)
 			policy_set_ct_timer(data, CONTROL_CONNECT_TIMEOUT);
 
-		/* Also try connecting HSP/HFP if it is not connected */
-		hs = btd_device_get_service(dev, HFP_HS_UUID);
-		if (hs) {
-			if (btd_service_is_initiator(service))
-				policy_connect(data, hs);
-			else if (btd_service_get_state(hs) !=
-						BTD_SERVICE_STATE_CONNECTED)
-				policy_set_hs_timer(data);
-		}
-
 		break;
 	case BTD_SERVICE_STATE_DISCONNECTING:
 		break;