From: Kevin Dewald <kevin@simpleble.org>
To: linux-bluetooth@vger.kernel.org
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
Kevin Dewald <kevin@simpleble.org>
Subject: [PATCH BlueZ 2/2] bearer: Fix LE Connect and Disconnect ignoring auto-connect
Date: Fri, 6 Nov 2026 17:56:49 -0800 [thread overview]
Message-ID: <20261107015649.84892-3-kevin@simpleble.org> (raw)
In-Reply-To: <20261107015649.84892-1-kevin@simpleble.org>
Bearer.LE1.Disconnect is documented to disable incoming connections of
a device that is not trusted until Connect is called again, as
Device1.Disconnect does, but it left the device in the auto-connect
list. A device that keeps advertising, such as a HID device, was then
connected back right after the disconnection.
Bearer.LE1.Connect did not put a device back in the auto-connect list
either, unlike Device1.Connect. A device taken out of it by
Device1.Disconnect, or left out of it because it was temporary when its
profiles were probed, was then not reconnected after losing the
connection.
Fix it by pausing and resuming auto-connect as Device1 does.
Fixes: 4e21ebcaa5d0 ("bearer: Implement Connect/Disconnect methods")
Assisted-by: Claude:claude-opus-5.5
---
src/bearer.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/bearer.c b/src/bearer.c
index 5285e0274..e11a844d8 100644
--- a/src/bearer.c
+++ b/src/bearer.c
@@ -153,6 +153,7 @@ static DBusMessage *bearer_connect(DBusConnection *conn, DBusMessage *msg,
msg, NULL);
else {
btd_device_set_temporary(device, false);
+ device_resume_auto_connect(device);
err = device_connect_le(device);
if (err < 0)
return btd_error_failed(msg, strerror(-err));
@@ -183,6 +184,10 @@ static DBusMessage *bearer_disconnect(DBusConnection *conn, DBusMessage *msg,
return NULL;
}
+ /* Auto-connect is only done over LE */
+ if (bearer->type != BDADDR_BREDR)
+ device_pause_auto_connect(device);
+
if (msg)
queue_push_tail(bearer->disconnects, dbus_message_ref(msg));
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-11-07 1:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 1:56 [PATCH BlueZ 0/2] bearer: Fix auto-connect handling of LE Connect and Disconnect Kevin Dewald
2026-11-07 1:56 ` [PATCH BlueZ 1/2] device: Add functions to pause and resume auto-connect Kevin Dewald
2026-11-07 8:43 ` bearer: Fix auto-connect handling of LE Connect and Disconnect bluez.test.bot
2026-11-07 1:56 ` Kevin Dewald [this message]
2026-11-09 16:00 ` [PATCH BlueZ 0/2] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261107015649.84892-3-kevin@simpleble.org \
--to=kevin@simpleble.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox