Legacy Bluetooth Vs LE regression on Android / Shearwater.

Linus Torvalds torvalds at linux-foundation.org
Tue Mar 26 14:42:09 PDT 2019


On Tue, Mar 26, 2019 at 1:17 PM Long, Martin <martin at longhome.co.uk> wrote:
>
> Hmmm. It does appear to be the same ongoing issue rather than a regression.

So we've always had off problems with the Shearwater bluetooth stack.
The dual stack being the worst of the lot.

I like the dive computers, don't get me wrong, but their BLE
implementation leaves something to be desired. The shearwater stack
seems to have some odd "statefulness" to it that nobody else does.

For example, on the BLE side (at least with the newer BLE-only
shearwaters), it looks like at least the Teric (and I think the Perdix
AI too) will use a "long term key" if you pair with them in LE mode.
Except the "term" of the "long term key" seems to be "until the dive
computer is turned off".

So if the other side of the equation actually tries to use the key
next time, the connection will simply fail - because after turning the
dive computer off and on again, the long-term key association will
have been forgotten by the Shearwater BLE stack.

To make things more confusing, "turning off" isn't apparently all that
well-defined either. If the dive computer is still calculating deco
from previous dives (so for a couple of days after the last dive),
turning the screen off seems to not really turn everything off. But if
you haven't been diving in a while, it really will.

This is all partly conjecture. There's _some_ state there. It can be
hard to connect to the Shearwater from a different laptop of cellphone
when it still remembers the previous computer it connected to. And
I've never figured out the pattern.

So it has a very random component to it.

But _once_ you've connected to it, and you don't change anything, and
you don't re-pair, it tends to be very solid.

In fact, on the BLE side it would generally be better to *not* pair to
it, and just connect to it without pairing, to avoid the whole
long-term key issue, but right now pairing to it is how subsurface
makes sure we remember the details, so then you may have to unpair and
re-pair just to get a new working long-term key, depending on whether
the other side does "pair and bond" (with that key) or just "pair"
(without).

So it's probably one of the best dive computers out there, but it sure
isn't one of the best bluetooth stacks out there..

                   Linus


More information about the subsurface mailing list