1772 Commits

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

 - clean up Shearwater tank pressure handling

 - minor fixlets

The Shearwater pressure sensor changes by Jef means that I also changed
how we handle the battery level for the pressure sensors, and integrated
it with the tank handling.

* jef/master:
  Improve the support for multiple tank transmitters
  Extract the log version immediately
  Use a struct for the gasmix data
  Use a prefix match for the Suunto bluetooth name
  Update the Shearwater Nerd bluetooth names
  Check condition before entering the loop
2019-10-13 11:19:08 -07:00
Jef Driesen
a7edb159fd Merge branch 'shearwater' 2019-09-27 08:07:50 +02:00
Jef Driesen
6c441bb402 Improve the support for multiple tank transmitters
Some of the newer Shearwater dive computers support up to 2 tank
pressure sensors. The tank pressure samples were already reported, but
the tank field with the corresponding begin/end pressure was still
missing.
2019-09-27 08:07:15 +02:00
Jef Driesen
e23c374cd8 Extract the log version immediately
To be able to collect the tank begin/end pressure, the log version needs
to be available earlier, because it's needed for parsing the tank
pressure data in the samples. Therefore, extract the log version
immediately after locating the opening record.
2019-09-24 14:00:25 +02:00
Jef Driesen
03ff5d32f2 Use a struct for the gasmix data 2019-09-24 14:00:01 +02:00
Jef Driesen
41b24adfcb Use a prefix match for the Suunto bluetooth name
The Suunto D5 bluetooth device name contains the serial number. Thus we
need to match only the prefix, instead of the full name.
2019-09-11 08:51:05 +02:00
Jef Driesen
ffeb6b2447 Update the Shearwater Nerd bluetooth names
Add the Shearwater Nerd 2 bluetooth device name.

The change to uppercase is purely cosmetic. The string comparisions are
not case-sensitive. But for documentation purposes it's good practice to
list the exact name as reported by the device.
2019-09-11 08:51:00 +02:00
Jef Driesen
f801b512c3 Check condition before entering the loop
The condition doesn't change inside the loop, so there is no need to
check it every iteration.
2019-09-11 08:50:16 +02:00
Linus Torvalds
ce6d9896a7 Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-NG
Merge upstream libdivecomputer updates from Jef:

 - Jef took my i200C support patch, so merge that up (only difference
   was that we mark it as BLE-capable)

 - support for multiple cylinders and transmitters for the Ratio iDive
   dive computers

 - Fix Mares BLE packet cache missed invalidation

* 'master' of git://github.com/libdivecomputer/libdivecomputer:
  Discard the cached BLE packet
  Add support for Aqualung i200c
  Take the tank transmitter flags into account
  Add support for multiple tank transmitters
  Use a struct for the gasmix and tank data
v4.9.3
2019-09-07 09:40:10 -07:00
Jef Driesen
912eb37ac3 Discard the cached BLE packet
When using a BLE connection, it's not sufficient to purge the buffers of
the underlying I/O stream. The locally cached BLE packet needs to be
discarded also.
2019-09-06 09:04:23 +02:00
Linus Torvalds
d62674a803 Add support for Aqualung i200c
It's exactly the same as the regular i200, but has a new version number
and string.

Tested-by: Tiago Thedim Dias <tiagotsoc@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-09-03 08:40:10 +02:00
Jef Driesen
d21070ad1a Merge branch 'ix3m-transmitter' 2019-09-02 08:27:21 +02:00
Jef Driesen
8829619473 Take the tank transmitter flags into account
Suppress the tank pressure sample when there is no active transmitter
available, or the connection with the transmitter is (temporary) lost.
In the latter case, the pressure is recorded as zero.
2019-09-02 08:26:38 +02:00
Jef Driesen
dc508c30f9 Add support for multiple tank transmitters
The Ratio dive computers support up to 10 tank pressure sensors. The ID
of the active tank sensor is stored in the sample data, and gets mapped
to the corresponding tank index.
2019-09-02 08:25:17 +02:00
Linus Torvalds
2d40cf46b1 Deepblu Cosmiq+: flesh out some of the comments and fingerprint size
I've tried to find where the firmware version and serial number are, and
have failed miserably.  Some of the commands I have sent instead cleared
the memory of the dive computer.  Whee.

But let's document the responses to the commands anyway, and flesh out
the fingerprinting code (which is useless without a device ID, which we
do not currently have).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-27 13:45:34 -07:00
Linus Torvalds
d532be187a Deepblu Cosmiq+: stop downloading once we've seen the dives already
.. and also support cancellation of dive downloading in the middle.

The Cosmiq+ doesn't remember all that many dives, but BLE is slow and
there's no point in downloading more than necessary.

I'll look at fingerprinting next, so that we can avoid downloading the
profile data if we have already seen the header.  That's a further small
optimization.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-27 12:19:32 -07:00
Linus Torvalds
df7aeeef01 Deepblu Cosmiq+: fix oxygen percentage reporting
When I added more parsing of the dive data of the Cosmiq+ in commit
4dff291a1a53 ("Deepblu Cosmiq+: fill in some parsing details") I got the
gasmix units completely wrong and clearly never tested it.

The DC_FIELD_GASMIX reporting uses floating point percentages, not
integer percentages, and instead of reporting 21% as 0.21, we used to
report it as 21.0.  It all looked fine in my profiles, because I'd only
tested simulated air dives, and subsurface defaults to air even if
somebody reports crazy impossible gases.

Easy enough to fix, and now actually tested by doing a simulated nitrox
dive.

Reported-by: Michael Werle <mwerle@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-27 11:58:08 -07:00
Jef Driesen
1cd285a4d8 Use a struct for the gasmix and tank data
This small refactoring is mainly a preparation to support multiple
tanks. There is no functional change.
2019-08-27 14:01:50 +02:00
Linus Torvalds
aab3d7a68e Add support for Aqualung i200c
It's exactly the same as the regular i200, but has a new version number
and string.

Tested-by: Tiago Thedim Dias <tiagotsoc@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
v4.9.2
2019-08-24 13:39:01 -07:00
Linus Torvalds
32e6ae4efa Deepblu Cosmiq+: fix missing prototype
Apparently I never added the new deepblu.h header file to the parser,
and never noticed.

But then Travis complains on the iOS build. Good catch, Travis.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-19 12:39:08 -07:00
Linus Torvalds
ccef003d47 Deepblu Cosmiq+: add progress reporting for downloading
Note that the fingerprinting code hasn't been connected yet (I'm n ot
entirely sure what I should compare - the whole 36-byte dive header?),
and it currently always downloads all dives on the Cosmiq+.

Not that that much matters, since there aren't all that many dives that
fit on it, but it's worth pointing out the current weaknesses of the
code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-18 14:29:02 -07:00
Linus Torvalds
4dff291a1a Deepblu Cosmiq+: fill in some parsing details
This adds support for the different modes (scuba/gauge/freedive) and
teaches the parser to set the right sample interval and get the dive
time right.

In freedive mode, the sample interval is 1s, and the dive time is in
seconds too.  In the other modes, the sample interval is 20s, and the
divetime is in minutes.

Also set the right gas for scuba.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-18 13:50:50 -07:00
Linus Torvalds
eacfe4011a Deepblu Cosmiq+: add basic dive information parsing
This at least approximates downloading a dive from the Deepblu Cosmiq+,
and gives reasonable profiles for my test-dives (in a dive computer
chamber, not real dives).

I'm sure there's a lot to be improved here, and this literally only gets
depth and water temperature, but that seems to be what the Cosmiq+ gives
us.

Lots of credit to Michael Werle for bluetooth packet captures, and some basic analysis of the protocol.

Packet-logging-by: Michael Werle <mwerle@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-17 15:06:16 -07:00
Linus Torvalds
2efa83eeee Deepblu Cosmiq+: start downloading dive data
This actually seems to download all the data.  It just doesn't parse any
of it yet, so you get just empty dives.  But the basic packet and data
transfer seems to work.

Now I need to fill in the details on the actual dive parsing side, and I
should see a profile.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-17 11:53:25 -07:00
Linus Torvalds
4ce0ae9e4f Deepblu: add basic send/receive functionality
This was tested with a command to set the time and date, but only the
actual IO parts are here.

The packet format is fairly simple, even if it's not exactly clear why
everything is HEX-encoded.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-16 14:09:28 -07:00
Linus Torvalds
9812bf0828 Deepblu Cosmiq+: Add skeleton code
This does nothing at all, but it adds all the core skeleton
infrastructure for the Deepblu Cosmiq+ dive computer.

Let's see if I can make sense of things and make it download anything.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-15 14:46:38 -07:00
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