All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] device: only use the address type selection algorithm when remote device is a dual-mode device when pair device
@ 2024-10-28 11:36 Cheng Jiang
  2024-10-28 14:01 ` [v1] " bluez.test.bot
  2024-10-28 14:13 ` [PATCH v1] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 4+ messages in thread
From: Cheng Jiang @ 2024-10-28 11:36 UTC (permalink / raw)
  To: linux-bluetooth

---
 src/device.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/device.c b/src/device.c
index 7585184de..71fdbb145 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3077,12 +3077,21 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg,
 	if (device->bonding)
 		return btd_error_in_progress(msg);
 
-	if (device->bredr_state.bonded)
+	/* Only use this selection algorithms when device is combo
+	 * chip. Ohterwise, it will use the wrong bearer to establish
+	 * a connection if the device is already paired. which will
+	 * stall the pairing procedure.
+	 */
+	if (device->bredr && device->le) {
+		if (device->bredr_state.bonded)
+			bdaddr_type = device->bdaddr_type;
+		else if (device->le_state.bonded)
+			bdaddr_type = BDADDR_BREDR;
+		else
+			bdaddr_type = select_conn_bearer(device);
+	} else {
 		bdaddr_type = device->bdaddr_type;
-	else if (device->le_state.bonded)
-		bdaddr_type = BDADDR_BREDR;
-	else
-		bdaddr_type = select_conn_bearer(device);
+	}
 
 	state = get_state(device, bdaddr_type);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-29  8:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-28 11:36 [PATCH v1] device: only use the address type selection algorithm when remote device is a dual-mode device when pair device Cheng Jiang
2024-10-28 14:01 ` [v1] " bluez.test.bot
2024-10-28 14:13 ` [PATCH v1] " Luiz Augusto von Dentz
2024-10-29  8:11   ` Cheng Jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.