2022-08-10 10:09:13

by Christian Eggers

[permalink] [raw]
Subject: [newbie] How does automatic reconnection work

Many Bluetooth devices seem to have some kind of "reconnect behavior". For instance
an audio speaker reconnects automatically to a phone as soon as they are within an
appropriate distance.

On the web, there are also many instructions how to troubleshoot problems related to
"automatic reconnect" ([1], [2], [3]).

How is this feature actually implemented? What do I have to consider if I want to
automatically reconnect my product with the customers phone?

In my concrete case, I create a BNEP connection from my product to the customers phone
(which acts as a NAP, Bluetooth Tethering has to be enabled on the phone). I would like
to automatically reestablish the network connection as soon as the phone is within an
appropriate range.

regards
Christian


[1] https://techwiser.com/fix-bluetooth-device-doesnt-auto-connect-in-linux/
[2] https://unix.stackexchange.com/questions/334386/how-to-set-up-automatic-connection-of-bluetooth-headset
[3] https://stackoverflow.com/questions/32288670/bluez-auto-reconnect-devices




2022-08-10 22:17:24

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [newbie] How does automatic reconnection work

Hi Christian,

On Wed, Aug 10, 2022 at 3:09 AM Christian Eggers <[email protected]> wrote:
>
> Many Bluetooth devices seem to have some kind of "reconnect behavior". For instance
> an audio speaker reconnects automatically to a phone as soon as they are within an
> appropriate distance.
>
> On the web, there are also many instructions how to troubleshoot problems related to
> "automatic reconnect" ([1], [2], [3]).
>
> How is this feature actually implemented? What do I have to consider if I want to
> automatically reconnect my product with the customers phone?
>
> In my concrete case, I create a BNEP connection from my product to the customers phone
> (which acts as a NAP, Bluetooth Tethering has to be enabled on the phone). I would like
> to automatically reestablish the network connection as soon as the phone is within an
> appropriate range.

Auto connection is controllable via main.conf:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/main.conf#n263

That said that is not enabled for BNEP profiles by default, it is kind
weird thing actually given that phones in general don't have Bluetooth
tethering enabled all the time, in fact I believe the normal behavior
is to disable tethering when disconnected, so even if you managed to
reconnect it may not be tethering.




> regards
> Christian
>
>
> [1] https://techwiser.com/fix-bluetooth-device-doesnt-auto-connect-in-linux/
> [2] https://unix.stackexchange.com/questions/334386/how-to-set-up-automatic-connection-of-bluetooth-headset
> [3] https://stackoverflow.com/questions/32288670/bluez-auto-reconnect-devices
>
>
>


--
Luiz Augusto von Dentz