Linus came diagnosed the issue and came up with the patch, Jef suggested to use
a 3 second timeout instead of 5.
Reported-by: Tiberio Alunni <tiberio.alunni@gmail.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Suggested-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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.
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>
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.
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.
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.
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>
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>