Mares Smart Dive Computer + Bluelink pro
Linus Torvalds
torvalds at linux-foundation.org
Tue Sep 25 23:07:35 PDT 2018
On Tue, Sep 25, 2018 at 10:53 PM Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> I wonder if the problem is
> that the Mares back-end tries to read in small chunks, and we hit that
>
> if ((size_t)packet.size() > size)
> return DC_STATUS_NOMEMORY;
>
> test instead of actually reading the data.
>
> Hmm.
Ahhah.
Indeed. That's exactly what is going on. The Mares code wants to
actualklky first read the single ACK byte. I had entirely missed that
part.
The BLE code isn't doing a very good job of looking like a serial
stream. We actually *used* to have code to make it act more like a
stream, but then the custom IO changes all changed that.
So I need to make that BLEObject::read() function just handle the
"user just wants a partial packet" case. Nobody has cared until now.
And I guess I also need to make it loop over the packet until it gets
the asked-for data.
Grr. The problem here is that we actually don't know whether the
divecomputer wants to get packets or wants to see a stream. We used to
have separate code for the "serial emulation" and the "BLE packet",
but all that went away with the whole "convert to libdivecomputer
custom io".
I will have to think about this again, but now I *really* am convinced
I understand what is going on.
And this does explain why the Mares backend gives up. It will wait for
the first packet to come in, but then the DC_STATUS_NOMEMORY error
will cause it to stop immediately.
Anyway, Fabio, you've been an *excellent* candy machine. Thank you.
Linus
More information about the subsurface
mailing list