Mares Smart Dive Computer + Bluelink pro

Linus Torvalds torvalds at linux-foundation.org
Wed Sep 26 17:37:55 PDT 2018


On Wed, Sep 26, 2018 at 3:21 PM Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> After switching to the 16 at 0 version, that is *exactly* the same
> command sequence that the Mares App does first too.  But when the
> Mares app does it, it gets the 16 bytes of data.
>
> Weird.

So it turns out that "BLE is slow" is actually the *reason* for the problem.

There's some really odd timing thing, where when we send the read
command as two different packets (first the two command bytes, then
the 8 bytes of offset/length), and wait for the AA ACK in between,
something times out on the Mares side.

But if I send the command byte as *one* 10-byte packet, it all just works.

Which is really strange, because the Mares app itself actually sends
it as two packets, but apparently sends them quickly enough together
that the Mares doesn't go "where's the rest?" and give up on us.

Anyway, the attached patch to libdivecomputer makes it work for me.
I'm really not all that happy with the patch, but hey, it actually
removes more lines than it adds, and it does make my loaner Mares Quad
Air happy, so it's clearly doing something good.

Jef - I assume your "send first two bytes separately" model is because
that's what the Mares app does on a serial line too, and you just
followed suite?

I'm assuming that with a serial line, things are basically so quick
that it's simply not an issue. The Qt BLE code is really slow, and
we've had timing issues with it before (it caused problems on the
Suunto EON Steel/Core too).

So I think I'll commit this patch, although we *could* make it depend
on the transport type (ie BLE vs serial). Although I strongly suspect
that the simpler "just send the whole command" model works on a serial
line too.

Does anybody have a Mares in the "Icon HD" family with a serial line
or USB to test? My loaner Quad Air didn't come with any PC interface,
so now I _just_ have that BlueLink dongle I bought.

Any of the Mares Matrix/Smart/Icon HD/Pucj Pro/Quad/Quad Air family
would be interesting to hear about.

I do wonder *why* BLE ends up being so slow on this thing - I'm
consistently seeing delays of 1s for replies to come in, but while
Fabio's trace from the Mares App also shows _some_ of that, it's not
nearly as bad.  It may just be that the Mares App doesn't actually
wait for the AA to come in, so it just streams the BLE traffic better.

Anyway, after all these oddities, I do have a 100% successful
download. Of course, the dive computer I have as a loaner is entirely
empty of all dives, so I don't have any *dive* downloads, but it
successfully read the memory to see that.

And to test the BLE IO, I did try to do a libdivecomputer dumpfile,
which creates a lot of read activity (even if the data is all 'ff')

                Linus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20180926/c67cf291/attachment.bin>


More information about the subsurface mailing list