Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH bluez] device: fix loss BREDR info when merge duplicate device
@ 2026-10-10  6:55 Ye He
  2026-10-10  9:52 ` [bluez] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Ye He @ 2026-10-10  6:55 UTC (permalink / raw)
  To: Linux Bluetooth; +Cc: Ye He

Two device objects for the same device in case it has
first been discovered over BREDR and has a private
address when discovered over LE for the next time.
The merge logic doesn't create a new BREDR bearer.
Makes the application loss connection info of BREDR.

Signed-off-by: Ye He <ye.he@amlogic.com>
---
 src/device.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 8fdef14489540e64b95e7e75d153d532811af611..9b36d01d4cb8fa6f866409901bcbd9ae2d86a886 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5456,9 +5456,22 @@ void device_merge_duplicate(struct btd_device *dev, struct btd_device *dup)
 {
 	GSList *l;
 
-	DBG("");
+	DBG("dev path '%s', dup dev path '%s'", dev->path, dup->path);
+
+	/* copy state */
+	dev->bredr_state = dup->bredr_state;
+	dev->bredr = btd_bearer_new(dev, BDADDR_BREDR);
+	DBG("connected %d, paired %d, bonded %d",
+			dev->bredr_state.connected, dev->bredr_state.paired,
+			dev->bredr_state.bonded);
 
-	dev->bredr = dup->bredr;
+	/* emit bearer properties */
+	if (dev->bredr_state.connected)
+		btd_bearer_connected(dev->bredr, 0);
+	if (dev->bredr_state.paired)
+		btd_bearer_paired(dev->bredr);
+	if (dev->bredr_state.bonded)
+		btd_bearer_bonded(dev->bredr);
 
 	dev->trusted = dup->trusted;
 	dev->blocked = dup->blocked;

---
base-commit: 7428ca2df9356363079db0f48412c20cbdb9471f
change-id: 20260505-device-merge-dd823b9f7dd9

Best regards,
-- 
Ye He <ye.he@amlogic.com>


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

end of thread, other threads:[~2026-10-10  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-10  6:55 [PATCH bluez] device: fix loss BREDR info when merge duplicate device Ye He
2026-10-10  9:52 ` [bluez] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox