1746 Commits

Author SHA1 Message Date
Linus Torvalds
ffbb472975 Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-NG
Merge upstream libdivecomputer updates from Jef:

 - Add support for the Aqualung i550C

 - Update Ratio iX3M GPS naming and note that they support rfcomm

 - misc cleanups

* 'master' of git://github.com/libdivecomputer/libdivecomputer:
  Add support for the Aqualung i550C
  Enable bluetooth support for the Ratio iX3M GPS
  Update the naming of the Ratio iX3M GPS range
  Mark the string tables as constant
  Refactor the filter functions
v4.9.1 v4.9.0
2019-07-14 17:34:38 -07:00
Janice McLaughlin
d5aa15c1c5 Add support for the Aqualung i550C 2019-07-08 08:49:14 +02:00
Jef Driesen
07dff48a3b Enable bluetooth support for the Ratio iX3M GPS 2019-07-05 11:39:06 +02:00
Jef Driesen
01d89add2f Update the naming of the Ratio iX3M GPS range 2019-07-05 11:39:06 +02:00
Jef Driesen
708fbb02de Mark the string tables as constant
Not only the strings in the table are constant, but also the table
itself. This allows the compiler to place the table in a read-only data
section.
2019-07-05 11:39:06 +02:00
Jef Driesen
209890daeb Refactor the filter functions
Replace all the different internal filter functions with one generic
function and a set of callback functions.
2019-07-05 11:37:13 +02:00
Linus Torvalds
1bbd386959 Merge git://github.com/libdivecomputer/libdivecomputer
Merge upstream libdivecomputer updates from Jef:

 - Support the new versions of the Mares Genius with more memory

 - misc small fixes (Pelagic/atom2 tank pressure fix, proper error
   codes, license info for AES code)

* git://github.com/libdivecomputer/libdivecomputer:
  Fix the tank pressure reporting
  Return the correct error code
  Add support for the Mares Genius
  Simplify the detection of air integrated models
  Refactor the gas mix and tank parsing
  Refactor the date/time parsing
  Replace the header offset with the header size
  Use symbolic constants for the commands
  Add license information to the AES code
  Update the udev rules
2019-07-04 10:50:17 +09:00
Janice McLaughlin
c70046bccf Fix the tank pressure reporting
A small typo introduced with the Tusa Talis support in commit
b188c414206daaa5b6de464ced98d78f6da7cde1 accidentally disabled the tank
pressure reporting for all models.
2019-06-27 08:55:45 +02:00
Jef Driesen
e80e320b8b Return the correct error code 2019-06-26 15:43:58 +02:00
Jef Driesen
334105322c Merge branch 'genius' 2019-06-26 15:43:36 +02:00
Jef Driesen
feec939a29 Add support for the Mares Genius
The Mares Genius supports a new command to download different types of
objects (e.g. dive header, dive profiles, etc) directly, without needing
to manually read and parse the contents of the flash memory.

The data structure also changed significantly. The profile data is now
organized into different records. Each record starts and ends with a 4
byte ascii marker:

  DSTR: Dive start record
  TISS: Tissue record
  DPRS: Sample record
  AIRS: Air integration record
  DEND: Dive end record

and contains a CRC checksum. The contents of the records remains very
similar to the existing iconhd data format.

Based-on-code-by: Janice McLaughlin <janice@moremobilesoftware.com>
2019-06-26 15:29:56 +02:00
Jef Driesen
a74d4ca14d Simplify the detection of air integrated models 2019-06-26 12:52:07 +02:00
Jef Driesen
7b29651d1e Refactor the gas mix and tank parsing 2019-06-26 12:51:53 +02:00
Jef Driesen
732c607c22 Refactor the date/time parsing
Split the offset calculation in two steps: first the offset to the
header data, and then the date/time field. The main advantage is that
the resulting code now follows the same logic as in the other functions.
2019-06-26 12:51:26 +02:00
Jef Driesen
e4c88a9309 Replace the header offset with the header size
The Mares Genius dive header is no longer located at the end of the data
(after the dive profile), but at the start. Therefore we don't need the
offset to the dive header anymore. Replace with the size of the header
instead.
2019-06-21 16:15:40 +02:00
Jef Driesen
6fb09e05a4 Use symbolic constants for the commands
The two byte commands are in fact a single byte command. The second byte
is some kind of checksum, containing the command byte xor'ed with the
value 0xA5.
2019-06-21 16:15:40 +02:00
Kristaps Dz
ca784be4e2 Add license information to the AES code
The license of the original source is stipulated in
https://github.com/kokke/tiny-AES-c/blob/master/unlicense.txt.
2019-06-21 16:13:27 +02:00
Jef Driesen
ddf086271c Update the udev rules 2019-06-18 09:24:43 +02:00
Linus Torvalds
b9d72607a8 Garmin Descent Mk1: add more informational debug output for file accesses
It turns out that it's fairly common that people pass in the wrong
directory for the Garmin downloader, and we then just silently fail to
parse any dives because we don't find anything.  The resulting logs
don't make it obvious what went wrong.

So add some informational messages about what directory we actually
tried to open, and what files we've found (and why we possibly ignored
them).

We already had this for some cases (like "This doesn't look lik ea dive
file"), but not for the more fundamental issues of not finding files to
begin with.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-05-31 13:17:48 -07:00
Linus Torvalds
e38406b353 Start adding IDs for the Oceanic Geo 4.0
There's a new dive computer in town: the Oceanic Geo 4.0.  It looks like
it should support BLE, and is probably fairly similar to the Pro Plus X.
Or so this initial support trial just assumes.

I don't have the version string for this device yet, so that hasn't been
added at all.  A full dump is required, the initial report only (almost
accidentally) gave the model numbers thanks to the BLE scan data.

Reported-by: George Rocks <jrroques2004@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-05-31 10:03:06 -07:00
Linus Torvalds
8fb2b75c25 Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-NG
Merge Jef's upstream updates.

Trivial conflicts just because of whitespace differences and a comment
difference in our Suunto D5 support changes.

* git://github.com/libdivecomputer/libdivecomputer:
  Add support for the Suunto D5
  Add support for the Tusa Talis
  Add the G2 HUD bluetooth device name
  Detect Mares Quad with more flash memory
  Fix the limit for an invalid sample temperature
  Fix a buffer overflow
2019-05-31 09:49:17 -07:00
Jef Driesen
0dc10062ce Add support for the Suunto D5
The Suunto D5 is fully compatible with the Eon Steel, except for the
different USB PID.

Reported-By: Nick Shore <support@mac-dive.com>
2019-05-27 09:06:13 +02:00
Jef Driesen
b188c41420 Add support for the Tusa Talis
Reported-By: Nick Shore <support@mac-dive.com>
2019-05-27 09:06:13 +02:00
Jef Driesen
629e33432f Add the G2 HUD bluetooth device name 2019-05-27 09:06:13 +02:00
Jef Driesen
7b29c5d43d Detect Mares Quad with more flash memory
The latest variant of the Mares Quad has 4 times more flash memory
compared to the original variant (1M vs 256K). Therefore this variant
supports a new command to read the size of the flash memory.

At the moment, it's unknown whether the previous variant also supports
this new command or not. Probably not, because none of the other
compatible models seems to support it either. Hence we only attempt to
read the flash memory size for the Quad, and a failure is not considered
a fatal error. The disadvantage of this approach is that a temporary
communication problem can result in a misdetection of the flash memory
size.

Reported-by: Janice McLaughlin <janice@moremobilesoftware.com>
2019-05-27 08:54:27 +02:00
Janice McLaughlin
5c55760fd5 Fix the limit for an invalid sample temperature
In the EON Steel descriptor for the temperature field, the "nillable"
value is -3000:

   int16,precision=2,nillable=-3000

So the missing equals sign is just a small oversight.
2019-05-24 11:14:13 +02:00
Linus Torvalds
1194585595 Add support for Suunto D5 dive computer
It looks just like a small-form-factor EON Steel/Core, just with new
device IDs.

I haven't been able to pair over BLE yet, but that may be the usual
"Suunto wants to do a private bonded pairing" thing that makes it a pain
on the desktop.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-05-16 14:42:22 -07:00
Jef Driesen
05a21bc8ee Fix a buffer overflow
The length field in the data is checked for the maximum size (e.g. the
size of the buffer), but there is no such check on the minimum size
(e.g. the size of the header). If the length is smaller, the code
accessed data before the start of the buffer.
2019-05-10 16:02:01 +02:00
Linus Torvalds
92cf2f8fa1 Suunto EON Steel/Core: make sure to properly sort the dive list
I incorrectly thought it was already sorted in the directory listing,
but once the dive list start overflowing, it looks like the ordering
goes away.

So sort the dives explicitly by date, rather than depend on any existing
ordering when reading the list of dives.

Reported-by: PM <boesch76@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-05-05 14:19:43 -07:00
Linus Torvalds
e650acc052 Garmin: be more permissive about the activity type
We used to require that we have one of the documented dive types in the
'sub_sport' type field.  But apparently Garmin added a new type number
for CCR diving, so CCR dives weren't recognized at all.

Add the new CCR case, but also say that if we have seen a DIVE_SUMMARY
record with average depth information, we'll just assume it's a dive
even for unrecognized sub_sport numbers.

Reported-by: Thomas Jacob <opiffe@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-05-05 10:00:27 -07:00
Linus Torvalds
2971cc20ff Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-NG
Pull upstream updates from Jef Driesen.

This adds ID entries for the Scubapro G2 HUD (but no GPS parsing support
yet) and the Aladin H Matric.

Also fix ndl/deco parsing for for Aqualung i450T.

* git://github.com/libdivecomputer/libdivecomputer:
  Fix the ndl/deco sample for the Aqualung i450T
  Add support for the Scubapro G2 HUD
  Add support for the Scubapro Aladin H Matrix
2019-04-24 09:04:42 -07:00
Jef Driesen
f37c3d3c86 Fix the ndl/deco sample for the Aqualung i450T 2019-04-24 16:23:11 +02:00
Jef Driesen
74957542bb Add support for the Scubapro G2 HUD
The G2 HUD is compatible with the G2, except for the new USB PID.
2019-04-23 10:00:08 +02:00
Jef Driesen
7d48587ed8 Add support for the Scubapro Aladin H Matrix
The Aladin H Matrix appears to be identical to the Aladin Sport Matrix.
2019-04-23 09:59:24 +02:00
Linus Torvalds
c7112237b3 Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-NG
Merge upstream updates from Jef:

 - better Mares Bluelink Pro downloading

 - Suunto DX CCR and gas mix fixes

* 'master' of git://github.com/libdivecomputer/libdivecomputer:
  Add support for the Mares Bluelink Pro interface
  Check the correct vtable pointer
  Report the setpoint data
  Take the CCR diluents into account
  Implement the initial gas mix
  Get the gas mix index directly from the event data
2019-04-15 08:53:33 -07:00
Jef Driesen
019a98f80c Add support for the Mares Bluelink Pro interface
The main difference with the serial communication is that the BLE
communication uses data packets (with a maximum size of 20 bytes)
instead of a continuous data stream.

Occasionally, the device responds with an empty packet (with just the
ACK and EOF byte) or with a short packet where one or more payload bytes
are missing. The empty packet is most likely caused because the device
didn't receive the second part of the command (with the parameters) in
time. The missing bytes might be caused by a buffer overflow on the
Bluelink Pro, when the data from the dive computer arrives faster over
the serial link than the device can forward it over the slower bluetooth
link to the host system.

One way to address this problem is to lower the packet size from 256 bytes
to only 128 bytes. The main disadvantage is that this also impacts the
download speed considerably. In one particular example, the total
download time increased from about 135 to 210 seconds (which is already
slow compared to the 62 seconds the same download takes over usb)!

An alternative solution is to simply retry the failed command. That way
there is only a performance penalty for the few bad packets, and not for
every single packet. In the above example, only two packets needed a
retransmission.

Note that the iconhd communication protocol uses no checksums. Hence
it's not possible to detect corrupt data packets. Only short packets can
be detected, because they result in a timeout.
2019-04-14 19:55:14 +02:00
Jef Driesen
88a814a616 Check the correct vtable pointer 2019-04-14 11:25:12 +02:00
Jef Driesen
01ec0c0970 Merge branch 'suunto-dx' 2019-04-13 11:37:33 +02:00
Jef Driesen
6ee786c31a Report the setpoint data 2019-04-13 11:37:15 +02:00
Jef Driesen
8a70885f89 Take the CCR diluents into account
The Suunto DX supports 3 CCR diluents and 8 OC gas mixes. Since the gas
mix index in the data is relative to either the set of CCR diluents or
OC gas mixes (depending on the dive mode) and libdivecomputer reports
both sets, the index needs to be adjusted.
2019-04-13 11:37:06 +02:00
Jef Driesen
6867ffb143 Implement the initial gas mix
Initialize the initial gas mix correctly from the data in the dive
header, instead of always using the first gas mix.
2019-04-13 11:23:36 +02:00
Jef Driesen
5116ee8f2d Get the gas mix index directly from the event data
There is no need to lookup the gas mix index, because the number is
stored directly in the event data, right next to the oxygen and helium
values. This actually removes an ambiguity in cases where the user has
configured two or more identical gas mixes. In that case, the lookup
would always find the first gas mix.
2019-04-13 11:15:53 +02:00
Dirk Hohndel
e4698c4844 Shearwater Teric: add support for the TAG INFO_EVENT
This logs every INFO_EVENT record and provides a SAMPLE_EVENT_BOOKMARK event for
the only INFO_EVENT we can parse so far, the TAG event. Three bits in the flag
value in that event structure are now used to hold the tag type, and if a
non-zero type has been set, then the value is the heading in degress.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
v4.8.6
2019-03-16 12:23:28 -07:00
Linus Torvalds
d0ec5cf760 Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-NG
Merge with upstream from Jef:

 - ignore empty pressure samples from OSTC

 - skip empty Oceanic logbook entries

 - update Ratio parsing

* 'master' of git://github.com/libdivecomputer/libdivecomputer:
  Ignore zero tank pressure values
  Add filters for BLE communication
  Skip empty logbook entries
  Add clock synchronization support
  Use symbolic constants for the commands
  Don't pass a NULL pointer to memcpy
  Update the list of the Ratio dive computers
2019-03-12 17:00:19 -07:00
Linus Torvalds
1953d7a5a1 Shearwater: fix (again) per-cell ppO2 reporting
This re-applied commit 902dbf4d6d24 ("shearwater: Fallback to
average/voted ppo2") which got lost in the last merge with upstream when
I synced with Jef's rewrite of the PNF parser.

Reported-by: Martin Long <martin@longhome.co.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-03-12 16:55:25 -07:00
Jef Driesen
530b28bf6f Ignore zero tank pressure values
When the connection with the transmitter is lost, the OSTC records a
zero value for the tank pressure.
2019-03-06 11:05:27 +01:00
Jef Driesen
2ea24cf043 Add filters for BLE communication
This is mainly for future use and reference, because there is still no
built-in support for BLE communication available.
2019-03-06 11:05:27 +01:00
Jef Driesen
f05f60c4ad Skip empty logbook entries
On certain devices, for example the Aeris Elite T3, the logbook
ringbuffer can sometimes contain an empty logbook entry in between the
valid entries. Because the presence of such an empty entry is currently
being interpreted as having reached the last valid entry, the download
is aborted. The result is that all remaining valid entries, located
after the empty entry, can't be downloaded.

This can be avoided by skipping the empty entry instead of aborting the
download.
2019-03-06 11:04:53 +01:00
Jef Driesen
81bca1ff7c Merge branch 'ratio' 2019-02-22 14:23:33 +01:00
Jef Driesen
4bbebe7c32 Add clock synchronization support
The Ratio dive computers support synchronizing the internal clock. One
complication is that recent firmware versions (4.0.56 or 4.1.10) support
two timezones (home and abroad), while the libdivecomputer api only
supports one timezone. To deal with this, the most recent firmware
versions (4.0.58 or 4.1.12) will interprete an invalid timezone index
(0xFF) as leaving the timezone unchanged.

If the firmware doesn't support the dual timezone command, or if the
firmware doesn't have the invalid timezone index modification yet, then
a fallback to the single timezone command is provided. Note that in the
latter case the side effect is that both timezones will be changed!
2019-02-22 14:21:51 +01:00