Jef Driesen f0faebb3a1 Introduce an adaptive inter packet delay.
On some systems a small delay is required between receiving the response
of a packet and sending the request for the next packet. Without this
delay, almost every request fails with either a NAK or a timeout.
Retrying usually works, but also causes the download to slow down
considerable.

The root of the problem appears to be related to the FTDI low latency
setting. On Windows and Mac OS X systems, the default setting for the
latency is 16ms, while Linux defaults to a low latency setting of only
1ms. This higher latency on Windows and Mac automatically introduces a
small delay while reading the packet, and that probably happens to be
just enough to make the transfer succeed without any problems. But on
Linux, due to the low latency setting, the next request is send almost
immediately, and that causes the transfer to fail. I suspect the dive
computer may still be busy with the previous request and needs a bit
more time before it's ready to accept a new request.

To mitigate this problem, we introduce a adaptive inter packet delay.
Initially this adaptive delay is set to zero. This is to make sure we
don't affect those systems that don't need a delay at all. Now, every
time a packet fails, that's an indication the inter packet delay is too
small, and we slightly increase the value. After a few attempts we'll
automatically reach the minimal required value. To avoid that the delay
grows out of control in the case of serious trouble, it's limited at
16ms.

Note that the fixed 100ms delay before retrying a failed packet remains
in place. That's on purpose, to make sure the next attempt will always
be successful, regardless of whether the adaptive delay has already
reached its minimal value or not.
2014-03-28 10:08:13 +01:00
2014-03-19 09:16:07 +01:00
2014-03-19 09:16:07 +01:00
2014-03-19 09:16:07 +01:00
2014-03-06 10:43:41 +01:00
2014-03-19 09:16:07 +01:00
2013-05-13 23:50:52 +02:00

Overview
========

Libdivecomputer is a cross-platform and open source library for
communication with dive computers from various manufacturers.

The official web site is:

  http://www.libdivecomputer.org/

The sourceforge project page is:

  http://sourceforge.net/projects/libdivecomputer/

Installation
============

On UNIX-like systems (including Linux, Mac OS X, MinGW), use the
autotools based build system. Run the following commands from the top
directory (containing this file) to configure, build and install the
library and utilities:

  $ ./configure
  $ make
  $ make install

If you downloaded the libdivecomputer source code directly from the git
source code repository, then you need to create the configure script as
the first step:

  $ autoreconf --install

To uninstall libdivecomputer again, run:

  $ make uninstall

Support
=======

Please send bug reports, feedback or questions to the mailing list:

  http://libdivecomputer.org/cgi-bin/mailman/listinfo/devel

or contact me directly:

  jef@libdivecomputer.org

License
=======

Libdivecomputer is free software, released under the terms of the GNU
Lesser General Public License (LGPL).

You can find a copy of the license in the file COPYING.
Description
No description provided
Readme 3.6 MiB
Languages
C 98.3%
M4 1.2%
Makefile 0.5%