186 Commits

Author SHA1 Message Date
Linus Torvalds
3c1e763a47 Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-DS9
Merge upstream changes by Jef Driesen:

 - add support for Liquivision dive computers

 - add support for the Aqualung i470TC

 - extract out Atomic Aquatics Cobalt USB support as a iostream

 - misc fixes

* git://github.com/libdivecomputer/libdivecomputer:
  Fix the OSTC4 firmware upgrade
  Handle a negative number of bytes as an error
  Update the example application
  Use the new USB transport for the Atomic Aquatics Cobalt
  Add an I/O implementation for USB communication
  Add support for filter parameters
  Disable direct access to the filter function
  Increase the receive timeout to 5 seconds
  Fix the McLean Extreme bluetooth name
  Add support for Liquivision dive computers
  Add support for the Aqualung i470TC
2020-08-20 12:36:38 -07:00
Jef Driesen
5380b247af Update the example application
The application is now responsible for setting up the USB based I/O
stream.
2020-08-11 15:16:36 +02:00
Jef Driesen
71a149d776 Add support for Liquivision dive computers 2020-07-09 17:02:32 +02:00
Linus Torvalds
6935fe717a Merge branch 'Oceans-S1' into Subsurface-DS9
Add initial support for the Oceans S1.

This expands a bit on the generic functions for the field-cache code,
and uses that to then add a fairly minimal Oceans S1 downloader.

And while it's minimal, it downloads about everything the S1 offers,
which is mainly just depth and temperature.

There are a few fields that it currently doesn't use, notably the
events and NDL information that the dive computer presumably reports in
the auxiliary data that comes in the sample, but without documentation
and more testing I'm not comfortable parsing that.

There's also some "current dive computer state" that isn't imported,
like the battery status.  I know how to read it, but it's not per-dive
data that could be added as extra fields: it's literally just the
current dive computer battery state at the time of the download.

The Oceans team said they'll provide more information about the
download, so this might be expanded in the future, but it seems fairly
usable even in this form.

Thanks to Dhaval Giani for sending me his Oceans S1 as a loaner, and to
Seth Garrison for doing the initial BLE packet dumps that made me think
it was fairly easily doable.

* Oceans-S1:
  Oceans S1: polish up the downloading logic for usability
  Oceans S1: actually download all dives and parse them
  Oceans S1: fill out core download protocol details
  Oceans S1: start filling in protocol details
  Oceans S1: start documenting the download format and first packets
  Add skeleton for Oceans S1 downloader
  Add generic dc_field_get() helper
2020-06-25 11:33:12 -07:00
Linus Torvalds
6b22340ddc Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-DS9
Merge upstream libdivecomputer updates from Jef Driesen:

 - Jef merged the EON Steel dive sorting fix we had in our branch: one
   less difference to upstream

 - Jef merged the McLean Extreme support with some updates and cleanups,
   this just takes all his changes.

 - manual pages for iostream

 - various minor fixes and updates from Jef

* git://github.com/libdivecomputer/libdivecomputer:
  Update the gitignore file
  Update the man pages for the new iostream functions
  Purge the serial port buffer during initialization
  Add support for the McLean Extreme
  Suunto Eon Steel: sort the dive list properly
  Remove the salinity compensation
  Fix the hwOS ppO2 bug for firmware v3.08
2020-06-25 11:24:00 -07:00
Linus Torvalds
d58b8f6928 Add skeleton for Oceans S1 downloader
This does nothing, but fills in all the basic boiler plate code and data
structures.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-23 13:28:10 -07:00
David Carron
8d35ee6978 Add support for the McLean Extreme 2020-06-08 13:45:43 +02:00
David Carron
ee84202b2b Add support for the McLean Extreme dive computer
Initial support for McLean Extreme

Signed-off by: David McLean Carron <david_de_carron@hotmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-05-18 09:52:17 -07:00
Linus Torvalds
8594445088 Add support for the Deepblu Cosmiq+ dive computer
Somewhat basic support, but the data the Deepblu Cosmiq+ reports is
pretty basic.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-05-07 15:05:37 -07:00
Linus Torvalds
4e9e94d9f8 Add backend for Garmin Descent Mk1
This uses pretty much all of our new infrastructure: the USB storage
iostream for the actual IO, the field-cache for the divecomputer fields,
and the string interface for the events.

It's also a very fast downloader.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-05-07 15:05:37 -07:00
Linus Torvalds
99c2ca7205 Add 'usbstorage' iostream
This ends up being just a file interface for dive computers that expose
their data as a filesystem that can be mounted.

Right now that's only the Garmin Descent Mk1, although technically the
Uemis Zurich also did that (but oddly, and the backend was never merged
into libdivecomputer).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-05-07 15:05:37 -07:00
Linus Torvalds
af2249a7c5 Add generic field cache and string field infrastructure
This adds the infrastructure for the "field cache", which is just
various helpers for the dc_get_field() interface.

This includes the 'dc_field_cache_t' structure that a libdivecomputer
backend can just add to its parser data structure, and a few macros to
make it very easy to initialize the fields and then return them in the
'get_field()' callback.

And part of it is the infrastructure support for the 'dc_field_string_t'
type, which adds the support for string fields.  That will be used to
return various string-formatted data from the dive computer, like deco
models, serial numbers, etc.

And no, a serial number is most definitely not a "number". It's a string.

Right now there are no users of this yet, that comes next.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-05-07 15:05:30 -07:00
Jef Driesen
4c91309c56 Add firmware upgrade support for the Ratio computers 2019-11-14 09:43:35 +01:00
Jef Driesen
e363e5b1fd Add support for the Cressi Goa and Cartesio 2019-01-14 21:14:30 +01:00
Jef Driesen
a4d9f72cf0 Fix the transport command-line parameter 2018-08-27 10:29:23 +02:00
Jef Driesen
472e9e984c Add support for the Tecdiving DiveComputer.eu 2018-06-22 23:24:30 +02:00
Jef Driesen
6085a11b1f Add the average depth to the xml output 2018-06-22 23:14:15 +02:00
Jef Driesen
8aef4a49a0 Unify the Uwatec Smart, Meridian and G2 backends
The Uwatec Smart, Meridian and G2 backends are almost identical, except
for the low-level packet sending and receiving code. With the new I/O
layer, those three backends can easily be unified in a single backend.

The Meridian and G2 are completely removed, only the family types are
kept for backwards compatibility.
2018-06-22 23:13:44 +02:00
Jef Driesen
3d394c9262 Don't use the USB VID/PID for opening the device
When two or more identical (or very similar) dive computers are
connected, the USB VID/PID can be ambiguous. That's because the VID/PID
identifies the type of the USB device, and not the individual device.
But each USB HID device descriptor returned by the device discovery
represents a single connected device, and thus guarantees to open the
correct USB device.

To obtain the same behaviour as before, an application can simply open
the first discovered device.
2018-04-03 22:02:15 +02:00
Jef Driesen
a7d0033bae Add a Bluetooth Low Energy (BLE) transport type
Libdivecomputer doesn't have built-in support for BLE communication yet,
so this is mainly for future use and custom I/O implementations.
2018-04-03 21:52:20 +02:00
Jef Driesen
6b50e7f959 Set a default transport in the examples
Setting a default transport type avoids the need to explicitely set a
transport using the the new --transport command-line option. This also
preserves backwards compatibility with previous versions where the
option didn't exist yet.
2018-04-03 21:44:08 +02:00
Jef Driesen
630b5e7c3c Add support for the scan command 2018-04-03 21:44:08 +02:00
Jef Driesen
c50958495d Update the example application
The dctool example application is updated to the latest changes:

 - The I/O stream is opened and closed by the application.

 - A new (mandatory) option is added to select the desired transport
   type. This is nessecary because several dive computers support
   multiple transport types now.
2018-04-03 21:44:08 +02:00
Jef Driesen
ef2402eff5 Integrate the new I/O interface in the public api
Currently the dive computer backends are responsible for opening (and
closing) the underlying I/O stream internally. The consequence is that
each backend is hardwired to a specific transport type (e.g. serial,
irda or usbhid). In order to remove this dependency and support more
than one transport type in the same backend, the opening (and closing)
of the I/O stream is moved to the application.

The dc_device_open() function is modified to accept a pointer to the I/O
stream, instead of a string with the device node (which only makes sense
for serial communication). The dive computer backends only depend on the
common I/O interface.
2018-04-03 21:11:06 +02:00
Jef Driesen
54fef8e093 Add support for using an optional device descriptor
The device descriptor is either mandatory for a certain command (with
DCTOOL_CONFIG_DESCRIPTOR) or always NULL. But for some commands it will
be useful to support an optional descriptor as well. To support this, we
always try to lookup the device descriptor whenever the corresponding
command-line options are set.
2018-04-03 21:06:48 +02:00
Jef Driesen
f87720dff9 Add support for semi-closed circuit diving
Add a new type to distinguish between closed circuit (CCR) and
semi-closed circuit (SCR) diving. Some dive computers from HW and
DiveSystem/Ratio support this.

Because the CCR/SCR abbreviations are more commonly used, let's take the
opportunity to also rename the existing DC_DIVEMODE_CC. To preserve
backwards compatibility, a macro is added to map the old name to the new
one.

Reported-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-30 09:03:46 +01:00
Jef Driesen
68380b2ec0 Fix some casts with constant pointers
Casting away the const qualifier generates a compiler warning which can
easily be avoided by preserving the const qualifier.
2017-11-24 23:45:11 +01:00
Jef Driesen
156f54302d Add basic timezone support
Allthough most dive computers always use local time and don't support
timezones at all, there are a few exceptions. There are two different
sources of timezone information:

 - Some of the newer Uwatec/Scubapro devices use UTC internally and also
   support a timezone setting. This UTC offset is currently taken into
   account to obtain the dive date/time, but the UTC offset itself is
   lost.

 - Uwatec/Scubapro and Reefnet devices rely on the clock of the host
   system to synchronize the internal device clock and calculate the
   dive date/time. The consequence is that the resulting date/time is
   always in the timezone of the host system.

In order to preserve this timezone information, the dc_datetime_t
structure is extended with a new "timezone" field, containing the UTC
offset in seconds. Devices without timezone support will set the field
to the special value DC_TIMEZONE_NONE.

The dc_datetime_localtime() and dc_datetime_gmtime() functions will
automatically populate the new field with respectively the local
timezone offset and zero. The dc_datetime_mktime() function will take
into account the new timezone field for the conversion to UTC. The
special value DC_TIMEZONE_NONE is interpreted as zero.
2017-08-18 23:26:45 +02:00
Jef Driesen
215d1155f8 Add time synchronization to the example application 2017-08-18 23:17:33 +02:00
Linus Torvalds
f107d7c0d8 Add initial Scubapro G2 frontend
The back-end parser seems to be the same as for the Uwatec Smart (aka
Galileo Sol).  At least that's the assumption right now.

The downloader just uses USB HID (very similar to EON Steel) rather than
the horrible IrDA thing.

There's also eventually a BLE thing, but that's for the future.

This is an unholy mixture of the Uwatec Smart downloader logic and the
EON Steel usbhid transfer code.  The back-end is pure Uwatec Smart
(model 0x11, same as Galileo Sol).

I'm not at all sure this gets everything right, but it downloads
*something*.

[Jef Driesen: Renamed the backend to uwatec, and made some smaller
              cosmetic changes to match the existing coding style.]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-06-28 15:32:39 +02:00
Jef Driesen
8952ad0c29 Remove unnecessary include statements 2017-04-13 08:02:11 +02: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
Jef Driesen
c8b2d89354 Set the default model number.
When the device family is provided without an explicit model number, we
simply choose the first available model. But since new models are being
added all the time, this default model is not guaranteed to remain the
same. That's not desirable because it can alter the behaviour of the
application.

The introduction of the Aeris 500AI is an example of this problem. The
default model in the vtpro family used to be the Oceanic Versa Pro. But
because the Aeris 500AI has a lower model number, it automatically
became the new default model. Since both use a different protocol
variant (MOD vs INTR) they are not interchangable.

The default model is now hardcoded. The best option is of course to
provide the model number explicitly!
2016-07-11 21:49:16 +02:00
Jef Driesen
b41ecd0c15 Add a parameter with the model number. 2016-07-11 21:47:29 +02:00
Jef Driesen
469717a2a1 Add support for imperial units in the xml output.
Libdivecomputer always uses metric units internally. But when reverse
engineering a device that stores everything using imperial units, it's
very convenient to be able to switch the output to imperial units too.
2016-03-29 16:34:27 +02:00
Jef Driesen
8ab3fb0542 Always close the xml tags.
The dive and sample xml tags were not closed properly if an error
occurred during parsing.
2016-03-27 22:02:52 +02:00
John Van Ostrand
9a4e2b75a5 Add support for the Cochran Commander and EMC. 2016-03-22 20:09:45 +01:00
Jef Driesen
83e54d84a2 Add support for the parse command. 2016-02-26 08:24:11 +01:00
Jef Driesen
e8b9e88171 Integrate the new output formats.
The existing output code is removed and replaced with the new XML and
RAW output formats. The desired output format can be selected with a new
command-line option. The XML format remains the default output format.
2016-02-26 08:24:11 +01:00
Jef Driesen
5d9ddafc41 Add support for the raw output format.
The RAW output format exports each dive to a raw (binary) file. To
output multiple files, the filename is interpreted as a template and
should contain one or more placeholders.
2016-02-26 08:23:55 +01:00
Jef Driesen
e35f0a3ff4 Add support for the xml output format.
The XML output format exports all dives to a single xml file.
2016-02-26 08:23:45 +01:00
Jef Driesen
195702046c Add a new abstract output interface.
The new output interface provides the necessary infrastructure to add
support for multiple output formats. Due to the abstract interface, each
new format will require only minimal changes in the application itself.
2016-02-26 07:55:40 +01:00
Jef Driesen
67a3697a4d Disable the getopt argument permutation on BSD systems.
On BSD based operating systems (which includes Mac OS X), the getopt()
function is posix compliant and thus the option processing stops when
the first non-option is found. But the getopt_long() function permutes
the argument vector, just like the GNU implementation.

Using a leading '+' character in the option string disables the
permutation again.
2016-01-30 23:00:17 +01:00
Jef Driesen
5add68b2d5 Use the optreset variable on BSD systems.
On BSD based operating systems the optreset variable should be used to
reset the internal getopt state. Setting optind to zero is a GNU
extension.
2016-01-30 23:00:17 +01:00
Jef Driesen
013882f3f2 Add the fwupdate command. 2016-01-05 20:38:47 +01:00
Jef Driesen
ce472ffa19 Add the read and write commands. 2016-01-05 20:38:47 +01:00
Jef Driesen
195c4c7a7e Add the download command. 2016-01-05 20:38:47 +01:00
Jef Driesen
bfbb56c781 Add the dump command. 2016-01-04 19:50:51 +01:00
Jef Driesen
ff7c3f6901 Add the list command. 2016-01-04 19:50:51 +01:00
Jef Driesen
4dee95d352 Add the version command. 2016-01-04 19:50:51 +01:00