Mares: increase timeout to 3 seconds

The Mares Bluetooth dongle is some seriously messed up stuff, and takes
forever to answer anything.  I'm not sure what we do wrong, because the
Mares mobile App seems to be able to work with it without the excessive
delays, but it is really incredibly slow when we talk to it.

I suspect the dongle has has some "wait until buffer is half full"
timeout, and it then triggers for every command and short reply in both
directions, and there's likely some way to flush it, but I didn't see
anything back when I had one for testing.

Anyway, as a result, one second is just about the latency that the
dongle itself adds regardless of anything else, so when the dive
computer itself needs a timeout to think about things, the overall
timeout needs to be noticeably more than one second.

Three seconds seems to be a somewhat reasonable compromise, and we do
have documentation for it being the right value:

 "Then shalt thou count to three, no more, no less. Three shall be the
  number thou shalt count, and the number of the counting shall be
  three. Four shalt thou not count, neither count thou two, excepting
  that thou then proceed to three. Five is right out."

because we do have strong reasons to believe that the Mares Bluetooth
dongle is a beast from hell.  Everybody who has ecver met it has
certainly gone "Arrrghhh" at some point.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2019-12-28 11:35:58 -08:00
parent 778adb37cc
commit 3c25c78bae

View File

@ -482,8 +482,8 @@ mares_iconhd_device_open (dc_device_t **out, dc_context_t *context, dc_iostream_
goto error_free;
}
// Set the timeout for receiving data (1000 ms).
status = dc_iostream_set_timeout (device->iostream, 1000);
// Set the timeout for receiving data (3s = 3000 ms, the BLE dongle can be slow).
status = dc_iostream_set_timeout (device->iostream, 3000);
if (status != DC_STATUS_SUCCESS) {
ERROR (context, "Failed to set the timeout.");
goto error_free;