Skip to content

bearer: Fix auto-connect handling of LE Connect and Disconnect

Kevin Dewald linux-bluetooth 1 version Applied

Status from this message: This series was applied to bluetooth/bluez.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2device: Add functions to pause and resume auto-connectsrc/device.c src/device.h+27 -171 reply
2/2bearer: Fix LE Connect and Disconnect ignoring auto-connectsrc/bearer.c+5 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH BlueZ 0/2] bearer: Fix auto-connect handling of LE Connect and Disconnect

org.bluez.Bearer.LE1.Disconnect is documented, like org.bluez.Device1.Disconnect, to disable incoming connections of a device that is not trusted until Connect is called again. Device1 does this by taking the device out of the auto-connect list, but the LE bearer does not: a paired HID device that is not trusted and keeps advertising is connected back right after Bearer.LE1.Disconnect.

Bearer.LE1.Connect does not put a device back in the list either, unlike Device1.Connect, so a device taken out of it by Device1.Disconnect is not reconnected after it loses the connection.

The first patch moves what Device1 does into two functions, and the second one calls them from the LE bearer. The BR/EDR bearer is left as it is, as auto-connect is only done over LE.

I reproduced this with a functional test using the HID device of test_hog.py, on master and bluetooth-next 3f425f95ba39:

  Disconnect, untrusted   master              with the series
  Device1.Disconnect      stays disconnected  stays disconnected
  Bearer.LE1.Disconnect   connected back      stays disconnected

Connect, then the HID device drops the link

  Device1.Connect         reconnected         reconnected
  Bearer.LE1.Connect      not reconnected     reconnected

A trusted device is connected back after Device1.Disconnect in both, as expected. make check and the functional tests using the bearers, HoG, btmgmt, bluetoothctl or the agent pass as before.

I have the test as two test cases for test_bearer.py, documented in doc/functional-bearer.rst, and can send them as a third patch if you want them.

Kevin Dewald (2):
device: Add functions to pause and resume auto-connect
bearer: Fix LE Connect and Disconnect ignoring auto-connect

 src/bearer.c |  5 +++++
 src/device.c | 42 +++++++++++++++++++++++++-----------------
 src/device.h |  2 ++
 3 files changed, 32 insertions(+), 17 deletions(-)

base-commit: a8067198717b38391ca183ed7f41a69ec4b81b6e

Signature · 1 line
2.54.0 (Apple Git-157)