public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] device: warn on BR/EDR connection key mismatch
@ 2026-04-03 23:42 Harsh
  2026-04-04  0:39 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Harsh @ 2026-04-03 23:42 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: lazy-pir8

From: lazy-pir8 <harshsahuxlr9@gmail.com>

Log a clear message when a device fails to connect due to
Bluetooth BR/EDR keys changing (e.g., after pairing from
another system). Advises user to remove and re-pair the device.
---
 src/device.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/device.c b/src/device.c
index cfbde307b..cd62abd73 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2066,10 +2066,23 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg)
 		const char *err_str;
 		DBusMessage *reply;
 
-		if (device->bonding_status == MGMT_STATUS_AUTH_FAILED)
-			err_str = ERR_BREDR_CONN_KEY_MISSING;
-		else
-			err_str = ERR_BREDR_CONN_CANCELED;
+	if (device->bonding_status == MGMT_STATUS_AUTH_FAILED) {
+		char name[256] = {0};
+	
+		device_get_name(device, name, sizeof(name));
+	
+		if (name[0] == '\0')
+			snprintf(name, sizeof(name), "unknown");
+	
+		error("DEBUG HIT: Connection failed for %s (key missing case)", name);
+	
+		warn("Connection failed for %s. The device keys may have changed (e.g. pairing from another system). Consider removing and re-pairing.",
+		     name);
+		
+		err_str = ERR_BREDR_CONN_KEY_MISSING;
+	} else {
+		err_str = ERR_BREDR_CONN_CANCELED;
+	}
 		reply = btd_error_failed(device->connect, err_str);
 		g_dbus_send_message(dbus_conn, reply);
 		dbus_message_unref(device->connect);
-- 
2.53.0


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

* RE: [BlueZ] device: warn on BR/EDR connection key mismatch
  2026-04-03 23:42 [PATCH BlueZ] device: warn on BR/EDR connection key mismatch Harsh
@ 2026-04-04  0:39 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-04-04  0:39 UTC (permalink / raw)
  To: linux-bluetooth, harshsahuxlr9

[-- Attachment #1: Type: text/plain, Size: 1311 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PENDING   0.35 seconds
GitLint                       PENDING   0.36 seconds
BuildEll                      PASS      20.06 seconds
BluezMake                     PASS      647.07 seconds
MakeCheck                     PASS      18.75 seconds
MakeDistcheck                 PASS      247.14 seconds
CheckValgrind                 PASS      294.87 seconds
CheckSmatch                   PASS      351.06 seconds
bluezmakeextell               PASS      183.74 seconds
IncrementalBuild              PENDING   0.35 seconds
ScanBuild                     PASS      1017.39 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:



https://github.com/bluez/bluez/pull/2013/checks

---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2026-04-04  0:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03 23:42 [PATCH BlueZ] device: warn on BR/EDR connection key mismatch Harsh
2026-04-04  0:39 ` [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