1338 Commits

Author SHA1 Message Date
Anton Lundin
a6538ae7da Set error status if transfer fails in close
This fixes whats probably was a merge error. This is a resync with
upstream.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-18 07:13:55 -07:00
Anton Lundin
f7d2086675 Don't overwrite status
This removes whats probably a merge error, that overwrites the return
status.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-18 07:13:44 -07:00
Anton Lundin
4c5b51f851 Add blank row to match upstream
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-18 07:13:27 -07:00
Anton Lundin
20d268acdb Remove last traces of our old custom serial code
This is just to make future merges easier.

There were nothing left of Claudiu's code in those files, so thats why i
removed the copyright lines.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-18 07:13:13 -07:00
Anton Lundin
94e7a77d01 Re-implement custom serial in a new way
This re-implements the custom serial concept in a new way. This way
doesn't touch any of the backend code, it just introduces a optional
redirection layer in the existing serial backends.

This implementation supports more serial operations to, so we can
support more backends this way.

Hooking into the existing serial backends might look ugly but its
probably the best way to make sure this patch conflicts as little as
possible with upstream.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-09-17 14:09:37 -07:00
Anton Lundin
7e086f697d Remove the old custom serial code
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-09-17 14:09:37 -07:00
Linus Torvalds
f9db4ca97c Merge git://git.libdivecomputer.org/libdivecomputer into Subsurface-branch
This is a rough merge of the upstream libdivecomputer changes.

I say "rough", because this disables the custom serial code as it
clashes very badly with Jef's new dc_serial_t abstraction.

Anton Lundin has patches on top of this to re-introduce the custom code
in a way that integrates better with the upstream libdivecomputer state.

* git://git.libdivecomputer.org/libdivecomputer: (42 commits)
  Add support for the Sherwood Vision.
  Fix the decoding of the maximum depth.
  Improve the default layout detection.
  Add a warning for unsupported devices.
  Fix the temperature for the Tusa Zen Air.
  Add support for the Aqualung i550T.
  Use the new settings field for the salinity.
  Fix the parsing of freedives.
  Detect the gauge and freedive mode correctly.
  Add the salinity field for the Aladin Tec.
  Add support for the Scubapro Mantis 2.
  Fix the decoding of the dive time.
  Add support for the Scubapro Mantis.
  Fix the Aeris 500AI serial number.
  Add the serial number encoding to the layout.
  Add salinity and timezone fields to Aladin Tec 2G
  Add NDL and RBT for the ATOM31 and I450T
  Add support for the new extended hardware descriptor.
  Update the OSTC device descriptors.
  Add a workaround for an OSTC4 firmware bug.
  ...
2016-09-17 14:08:32 -07:00
Linus Torvalds
ed8b8f1221 Suunto EON Steel: extend our string space
We only used to save 16 extended strings per dive from the EON Steel
download, which is _plenty_: it's not like we actually generate that
many strings.  Firmware version, battery status, transmitter info -
there's just not that many strings.

Oops.

Except if you have lots of transmitters.  Then each wireless transmitter
will have three strings each, for transmitter ID and beginning/ending
battery status.

I only have one, but Andreas Klein has four.  And it took me
embarrassingly long to realize that he really did have them on the
dives, because after the first two transmitter IDs got recorded, the
string space filled up and we silently dropped the rest.

But I have learnt my lesson.  Future generations will talk about how I
said "32 strings will be enough for anybody".

But at least it should be enough for a few more transmitters.  Somebody
should extend this some better way, but I'm still chasing other issues.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-29 21:45:33 -07:00
Linus Torvalds
6fa9f1566f Suunto EON Steel: initialize the tank 'gasmix' index
The gasmix query interface considers cylinders and gas mixes independent
things, so the tank data structure has a pointer to the gasmix index.

But the EON Steel treats cylinders as just having a gasmix (and so does
subsurface, for that matter), so the gasmix index for the tank is just
the same as the tank index.

But we never filled it in, so you'd always see a "gas index" of zero,
and subsurface would end up warning each time about how the gasmix index
doesn't match the cylinder index (but because subsurface actually agreed
with EON Steel, it worked despite the warning).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-29 21:45:19 -07:00
Linus Torvalds
d11d30999b Suunto EON Steel: do the proper enum lookup for a few more cases
Instead of hardcoding the enum values for setpoint type and gas type,
use "lookup_enum()" to actually parse the enum data and use that.

I don't think this matters right now, since the numeric translations
haven't changed, but it is the RigthThing(tm) to do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-29 21:45:06 -07:00
Jef Driesen
3b179e7058 Add support for the Sherwood Vision. 2016-08-25 09:10:06 +02:00
Jef Driesen
c506be93f9 Fix the decoding of the maximum depth.
Several devices (e.g. Oceanic Geo, Oceanic Veo 2.0 and Tusa Zen) report
a maximum depth that is clearly too large. The problem is easily fixed
by ignoring the higher bits. The exact bit mask is an educated guess. A
12 bit value is plausible because it's also used for the sample depths.
2016-08-23 07:58:25 +02:00
Jef Driesen
3b18d4a448 Improve the default layout detection.
Select the default memory layout for unsupported devices based on the
amount of memory indicated in the version string. This allows to
download a full memory dump.
2016-08-21 13:27:39 +02:00
Jef Driesen
6d3fbb7e6d Add a warning for unsupported devices. 2016-08-21 13:27:06 +02:00
Jef Driesen
dfa191c9bc Fix the temperature for the Tusa Zen Air. 2016-08-20 21:22:19 +02:00
Jef Driesen
f666cb8cb3 Add support for the Aqualung i550T. 2016-08-20 21:20:01 +02:00
Anton Lundin
cba786df2f Fix deco model strings in hw parser
The new version of the log book format broke the string handling.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-20 08:24:13 -07:00
Anton Lundin
4527c77a6b Add strings as extradata in xml
This teaches the dctool about the subsurface special field strings, and
saves them in the xml output in a way which is compatible with
subsurface.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-20 08:24:02 -07:00
Jef Driesen
2e40d35da4 Merge branch 'uwatec' 2016-08-18 23:32:41 +02:00
Jef Driesen
0ab2d8ccda Use the new settings field for the salinity.
Since the salinity bit is stored in the settings, there is no need for a
separate salinity entry in the header tables.
2016-08-17 14:09:52 +02:00
Jef Driesen
bfcd707889 Fix the parsing of freedives.
In freedive mode the sample rate is only 1 second instead of 4 seconds.
The tank pressure fields appear to be re-used for some other (unknown)
purposes, and should be ignored.
2016-08-17 14:08:50 +02:00
Jef Driesen
8b0a048175 Detect the gauge and freedive mode correctly.
The gauge and freedive mode bits are stored in the settings field. The
location of the gauge bit appears to be the same for all models. For the
freedive bit it depends on the model, and also not all models support
it.
2016-08-17 08:10:36 +02:00
Jef Driesen
1226b47c6d Add the salinity field for the Aladin Tec. 2016-08-17 08:10:11 +02:00
Jef Driesen
769d90aca2 Add support for the Scubapro Mantis 2. 2016-08-14 10:07:45 +02:00
Jef Driesen
af7e7aed19 Fix the decoding of the dive time.
The dive time is stored in two separate bytes: one for the number of
minutes, and another one for the hours. Since we only took into account
the first byte containing the minutes, the divetime for dives longer
than one hour was always too short.
2016-08-12 11:47:41 +02:00
Jef Driesen
ae93a6ab08 Add support for the Scubapro Mantis.
The Scubapro Mantis uses the same model number as the Meridian, and
works out of the box.
2016-08-11 08:57:47 +02:00
Jef Driesen
9e585a9525 Fix the Aeris 500AI serial number.
The Aeris 500AI serial number appears to be located at a slightly
different offset, and with an unusual encoding. It's a BCD encoded
number, but with the digits of each byte swapped.
2016-08-08 09:20:55 +02:00
Jef Driesen
00c2705786 Add the serial number encoding to the layout.
At the moment, the encoding of the serial number is tied to the global
pointer mode. To support devices where this is no longer the case, a new
entry for the serial number encoding is added.
2016-08-08 08:38:23 +02:00
Thomas Gschwind
0a769cdd57 Add salinity and timezone fields to Aladin Tec 2G 2016-08-07 09:31:21 +02:00
Janice
e99b8ac837 Add NDL and RBT for the ATOM31 and I450T 2016-08-05 10:26:07 +02:00
Jef Driesen
b4dc2532e8 Add support for the new extended hardware descriptor.
The latest v2.09 (hwOS) and v1.1.0 (hwOS4) firmware introduced a new
variant of the hardware descriptor command. This extended command
returns:

 - a 16 bit hardware descriptor
 - a 16 bit feature descriptor
 - an 8 bit model descriptor

The hardware descriptor is backwards compatible with the existing one
(upper bits are all zero for now). For the OSTC4, the feature descriptor
is currently used to indicated the Bonex scooter version (0x01), and the
model descriptor is 0x43. For all other models, the feature and model
descriptors are always zero for now.

For older firmware versions, which do not support the new extended
descriptor yet, there is an automatic fallback to the previous
descriptor.
2016-08-02 10:44:34 +02:00
Jef Driesen
9ef840fc96 Update the OSTC device descriptors.
There are a few new hardware variants since the last update.
2016-07-30 21:40:56 +02:00
Jef Driesen
f94aab3c8e Merge branch 'ostc4' 2016-07-30 21:39:56 +02:00
Jef Driesen
b896847e14 Add a workaround for an OSTC4 firmware bug.
Due to a firmware bug, the deco/ndl info is incorrect for all OSTC4
dives with a firmware older than version 1.0.8. Since it's not possible
to correct the info again, it's ignored and not returned to the
application.
2016-07-30 21:36:55 +02:00
Jef Driesen
ff15b865b2 Fix the decoding of the OSTC4 firmware version.
The OSTC4 firmware version uses four digits for the firmware version
(X.Y.Z.Beta), while all other hwOS models use two digits (X.Y). To
preserve backwards compatibility with the existing two byte data format,
the OSTC4 firmware version is packed into a 16 bit integer as follows:

   XXXX XYYY YYZZ ZZZB

and stored with little endian byte order.
2016-07-30 21:36:55 +02:00
Jef Driesen
2829f7ebf9 Add an ostc3 specific function with the model number.
To be able to pass the OSTC 3 model number to the parser, and preserve
backwards compatibility, we need a new function. The new function should
also be used for the Frog, by passing zero as the model number.

Using the hw_ostc_parser_create() function with the hwos parameter set
to one, is now deprecated but will remain supported for backwards
compatibility.
2016-07-23 23:14:13 +02:00
Jef Driesen
29caab0673 Rename the frog parameter and field to hwos.
The frog parameter and field are not only used for the Frog, but also
for all hwOS based models. Therefore, using the more generic hwos as the
name is more meaningful.
2016-07-23 23:11:30 +02:00
Linus Torvalds
406dbf3dae Add severity indication to the event flags for the Suunto EON Steel
This way Subsurface can show different icons depending on what kind of
event we report.

This also fixes a bug where the begin/end marker was mistakenly added as
the value instead of as flag.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 17:07:38 +09:00
Jef Driesen
ad2257569c Add a new dc_parser_new2 convenience function.
For applications supporting offline parsing (like libdivecomputer's own
dctool application), some device specific knowledge is still required in
order to map a particular model to the corresponding backend. The new
convenience function will take care of that internally.

The already existing dc_parser_new() function does the same, but
requires an open device handle, which makes it unsuitable for offline
parsing.
2016-07-22 21:14:33 +02:00
Linus Torvalds
8fb4018db3 Suunto EON Steel: add transmitter battery state reporting
I'm not sure how reliable it is, and older wireless tank pods had a bug
in the reporting (looks like the battery voltage range calibration was
done incorrectly, and it reports 0% battery for new batteries).

But depending on how well it actually works when the batteries start
getting weak, the transmitter battery reporting is potentially *very*
useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
8eb1c1232e Suunto EON Steel: add surface time reporting
For some reason I hadn't reported surface time.  It's trivial to do
especially now that we have the varargs string adding function.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
7fe87f36b5 Suunto EON Steel: split out gas info parsing
The dive gas parsing cases can be split out into a helper function to
keep things more manageable.  Especially since there will be a couple
more cases coming up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
4599405078 Suunto EON Steel: add 'varargs' version of 'add_string()' function
.. and use it for the cases that used to do this by hand (Personal
Adjustment and Desaturation Time).

There will be more users coming up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
69d26e00b0 Suunto EON Steel: add desaturation time reporting
The EON Steel reports it in seconds remaining after the dive.  That's a
bit excessive, but I guess SI units is where it's at.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
5d4e1f97db Suunto EON Steel: add dive state event reporting
Now that we support string events and don't need to try to figure out
some libdivecomputer event number that doesn't exist, it's easy to add
the proper support for the dive state reporting that the EON Steel has.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
3547c72111 EON Steel: look up enum descriptor strings
It turns out you can't hardcode the enum numbers either, since they
change from dive to dive (or possibly firmware version to firmware
version).

So do it right, and actually parse the string descriptor for the enum.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
1b5ccf5983 EON Steel: pass in the type descriptor to samples that need it
The samples that take 'enum' types need the type descriptor to parse
what the enum type means.

This doesn't actually use the data yet, I need to add parsing of the
enum descriptor string.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
79e2e3b0b5 Add 'string' event type
The event numbers are an indecipherable mess, and Suunto EON Steel has
notifications, events and warnings that just don't fit.  Plus they
really come as strings from the EON Steel anyway.

So add a "SAMPLE_EVENT_STRING" type, and for that type the event has a
"const char *name" instead of the odd and meaningless flags/value pair.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
2e26ae4708 Make the tank "type" field more useful
Right now it only has an indication of whether the cylinder size is
imperial or metric, which is frankly quite useless.

Turn it into a bitmask instead, where we keep the imperial/metric data
for compatibility, but add another two bits that say that it's a CC
cylinder, and whether it's the oxygen or diluent cylinder.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 19:58:29 +09:00
Linus Torvalds
f38e8fe9ee EON Steel: mark tank cache initialized when filling it in
The previous commit fixed the cache initialization testing, and
uncovered the fact that the tank size cache initialization didn't set
the initialized bit correctly.  That oversight had been hidden by the
fact that we then tested the bit wrongly, so not setting it right didn't
use to matter as long as there were other higher cache bits that were
set.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-17 12:07:39 +09:00