This is _partial_ support for the Oceanic Pro Plus 4 from Jef, based on
a partial dump by John Clark. Quoting Jef in the email thread:
"I'm not sure why downloading the memory dump fails. All 4 attempts
fail around the same memory address (0x3140), but not exactly the
same. Strange, but the good news that there is already enough
information to figure some things out.
Linus and Dirk: Attached is a patch with the things I figured out so
far. Can you make a build for John to try?
Most of the info looks reasonable, but there are probably still a few
things missing or wrong. I don't have any ground truth data to compare
against for things like the temperature sign"
This is that patch for testing.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge upstream libdivecomputer updates from Jef.
Misc small updates all over, the biggest thing (code wise) is probably
the Ratio firmware update support.
* 'master' of git://github.com/libdivecomputer/libdivecomputer:
Fix the Oceanic Geo 4.0 memory layout
Ignore all empty logbook entries
Add a workaround for the hwOS ppO2 firmware bug
Use macros to encode the firmware version
Use symbolic constants for the sample types
Remove the obsolete hwos parameter
Limit the tank pressure workaround to hwOS devices
Fix the OSTC tank pressure decoding
Fix the Scubapro G2 HUD udev rule
Add the Mares Genius to the bluetooth filter
Add firmware upgrade support for the Ratio computers
The logbook ringbuffer is always updated sequentially. Therefore, emtpy
entries can only be present after the oldest dive. However it appears
that under some special conditions (for example an empty battery during
the dive), the logbook entry is not always stored correctly, which can
result in an empty entry after all.
I suspect that at the start of each dive, the OSTC erases the next
available entry in the logbook ringbuffer and updates the internal write
pointer. Once the dive is finished, the actual content of the erased
logbook is written. Thus, when the OSTC runs out of battery power during
the dive, that last step never happens, and the erased entry remains in
place.
As a workaround, ignore all empty logbook entries instead of assuming we
reached the last dive.
Due to a bug in the hwOS Tech firmware v3.03 to v3.07, and the hwOS
Sport firmware v10.57 to v10.63, the ppO2 divisor is sometimes not
correctly reset to zero when no ppO2 samples are being recorded.
Usually this condition can be detected by the fact that the length of
the extended sample will not have enough space left for the ppO2 sample
(9 bytes). As a workaround, reset the divisor back to zero to manually
disable the ppO2 samples.
In theory this detection method is not 100% reliable. There can still be
other sample types present in the extended sample. If their total size
is larger than 9 bytes, the bug will not be detected at all. Instead,
those bytes will get interpreted as the ppO2 sample, resulting in bogus
ppO2 values. Additionally, one of the other sample types will now run
out of space and cause the parsing to fail with an error. However, in
practice this risk is relative low. Most of the other samples are
relative small (1 or 2 bytes), so you would need many of them. That's
rather unlikely in most configurations. The only exception is the large
deco plan sample (15 bytes).
In commit 2829f7ebf9902170bf653d67dbe412a0a4f140cf, the hwos parameter
of the hw_ostc_parser_create() function was kept to preserve backwards
compatibility. Since the function has been removed from the public api,
the parameter can be removed now.
The workaround for the tank pressure in the previous commit is only
relevant for the newer hwOS based devices, and not for the original OSTC
devices. In practice this doesn't cause any problems because the
original OSTC doesn't support a tank pressure sensor, but nevertheless
it's better to use the correct condition.
The tank pressure is stored with a resolution of 1 bar instead of 0.1
bar. There is however one exception. The hwOS Sport firmware used a
resolution of 0.1 bar between versions 10.40 and 10.50.
Unfortunately the only way to distinguish the Sport from the Tech
variant is the different range of the version number (10.x vs 3.x). The
consequence is that this workaround will start to produce wrong results
once the firmware version number of the hwOS tech variant reaches the
10.x range. If that ever happens, this workaround should be removed
again!
Merge misc fixes from Jef's upstream.
This fixes the incorrect and partial Oceanic Geo 4.0 support from commit
e38406b353bb ("Start adding IDs for the Oceanic Geo 4.0"), where I was
assuming it looked like the I770R.
* https://github.com/libdivecomputer/libdivecomputer:
Add support for the Oceanic Geo 4.0
Fix a buffer overflow
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
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.
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.
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.
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
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.
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>
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.
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.
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>
.. 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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
A small typo introduced with the Tusa Talis support in commit
b188c414206daaa5b6de464ced98d78f6da7cde1 accidentally disabled the tank
pressure reporting for all models.