In order to support development of the open source firmware of the
OSTC4.
This is needed in order to be able to install firmware with the same
version number multiple times during development and testing.
Signed-off-by: Michael Keller <github@ike.ch>
Merge upstream updates from Jef Driesen:
- Deepblu Cosmiq+ support has been merged upstream
- Oceans S1 support has been merged upstream
- Various new models supported: Cressi Donatello, Scubapro G2 TEK, new
Excursion v6+ firmware.
- misc core changes, most notably supporting a new annoying specialized
binary format for "decomode", because Jef still can't deal with
strings.
- lots of small details
* https://github.com/libdivecomputer/libdivecomputer: (58 commits)
Keep open-circuit and diluent gas mixes separately
Parse some extra gas mix information
Limit the index to the fixed gas mixes
Handle dives without a valid gas mix more explicit
Ignore all gas mixes for freedives
Always include all gas mixes defined in the header
Add support for the new Excursion v6+ firmware
Add support for the HP CCR tank pressure
Use the correct field for the setpoint sample
Add support for the Oceans S1
Add support for the Deepblu Cosmiq+
Add missing functions for accessing big/little endian values
Move the snprintf functions to the platform module
Repeat the handshake every few packets
Enable big page support
Remove the model number from the vtpro struct
Add the model number to the version table
Move all model numbers to the common header
Remove a duplicated include statement
Add support for the 300bar pressure sensor
...
The Oceans S1 uses a plaintext and line based communication protocol
over BLE. The larger payloads, which also contain plaintext data, are
transferred using the XMODEM-CRC protocol.
Based-on-code-by: Linus Torvalds <torvalds@linux-foundation.org>
The Deepblu Cosmiq+ uses a plaintext and line based communication
protocol over BLE, where the binary payload data is encoded as
hexadecimal characters.
Based-on-code-by: Linus Torvalds <torvalds@linux-foundation.org>
For dive computers where the reference time (epoch) of the device is
unknown, libdivecomputer uses the current time of the device (devtime)
and the host system (systime) to synchronize both clocks.
Currently, both timestamps are passed directly to the constructor of the
parser. With the new public function, the application can adjust the
timestamps afterwards.
Some dive computers store the depth as an absolute pressure value (in
bar). To convert to a depth value (in meters), the atmospheric pressure
and water density are required. For dive computers that do not have
those values available, libdivecomputer uses a default value. With the
new public api functions, applications can adjust those default values.
Some dive computers already provided a backend specific calibration
function. Those functions are now deprecated. They are kept around to
maintain backwards compatibility for now, but they will be removed in
the next version.
Report the decompression algorithm (Buhlmann, VPM, RGBM or DCIEM), and
if available also the parameters. For now only the conservatism setting
is supported, and for the Buhlmann algorithm also the Gradient Factors
(GF).
Merge Jef's upstream updates:
- Add support for Seac Screen and Action
- Add support for Cressi Michelangelo
- misc small fixes
* https://github.com/libdivecomputer/libdivecomputer:
Add support for the Seac Screen and Action
Add an address parameter to the memory dump helper function
Ignore invalid gas mixes
Add support for the Cressi Michelangelo
Move the C_ARRAY_SIZE macro to a common place
Fix the timezone offset in the xml output
Emit a devinfo event when downloading a memory dump
Read the info and more info data during startup
Use helper functions to decode multibyte values
Fix changing the OSTC settings
Merge Jef's upstream into the Subsurface branch:
- support for new dive computers: Mares Pick Pro+, Deep Six Excursion,
Crest CR-4, Genesis Centauri and Tusa TC1.
- support freedive mode on Mares Smart Air
- work with Oceanic dive computers regardless of whether they need the
BLE handshake or not
- OSTC updates: support bigger BLE packets in newer versions, fix
setpoint in SCR mode
- Shearwater updates: full dive mode parsing, correct timezone handling
on Teric, support up to four transmitters on newer log versions.
* git://github.com/libdivecomputer/libdivecomputer: (26 commits)
Read the extra tank information
Add support for transmitter T3 and T4
Limit the number of records for the Predator
Report the timezone offset for the Teric
Use the correct model number from the final block
Use the dive mode stored in the header
Report the correct dive mode for SCR dives
Increase the size of the BLE packet cache
Add support for the Genesis Centauri and Tusa TC1
Read the hardware and software version
Report the initial setpoint in SCR mode
Add the divemode to the layout descriptor
Re-order the fields in the layout descriptor
Show the correct help message for the scan command
Add support for the Crest CR-4
Add udev rule for the Suunto EON Steel Black
Ignore unsupported BLE handshake
Detect NAK response packets
Remove the initial gas switch
Restore the original standard gravity factor
...
Merge upstream updates from Jef:
- add suppoort for various new variants of existing dive computers:
+ Suunto Eon Steel Black, and new variant of Zoop Novo
+ Sherwood Beacon
+ new Shearwater Perdix AI model number
- add new Sporasub SP2 support
- various minor fixes and updates
* 'master' of git://github.com/libdivecomputer/libdivecomputer: (22 commits)
Add support for a new Suunto Zoop Novo variant
Add support for the EON Steel Black
Add support for the Sporasub SP2
Fix an overflow in the progress events
Use a common sleep implementation
Fix the clang compiler flag detection
Add Github Actions CI builds and releases
Show a summary after configuration
Extend the OS detection to non Windows platforms
Implement the ndl/deco sample
Fix the maximum depth
Mark the McLean Extreme as supporting BLE
Fix -Wcast-qual compiler warning
Mark the new iX3M 2021 models as supporting BLE
Add support for the Sherwood Beacon
Remove the infinite timeout
Simplify the loop for reading the packet header
Add a new Perdix AI hardware type
Fix the McLean Extreme fingerprint feature
Perform the check for the NULL key earlier
...
The Sporasub SP2 uses a very simple communication protocol and memory
layout, but with some unusual aspects:
Dives are artifically limited to a maximum of 6000 samples.
Unlike all other dive computers, the dives are not stored in some kind
of ringbuffer structure. Once the memory is full, no new dives can be
recorded. The existing dives need to be erased first, and the dive
computer will start recording again at te start of the memory area. The
Sporasub application has an "Auto-clear watch memory after data
transfer" feature for this purpose.
I didn't implement a more efficient download algorithm because
downloading a full memory dumps takes less than 10 seconds.
Merge with Jef's upstream libdivecomputer updates:
- support new Ratio iX3M 2021 model IDs
- support Mares Horizon, and fix the Mares Genius layout
- add support for Shearwood Sage
- various warning fixes, other minor details
* 'master' of git://github.com/libdivecomputer/libdivecomputer: (23 commits)
Wait before sending the firmware data
Add support for the new iX3M 2021 models
Avoid generating the SIGPIPE signal
Use an unsigned value to represent the undefined state
Use an unsigned integer for the number of dives
Use the cross-platform socket file descriptor type
Limit the size to INT_MAX
Define DC_TIMEZONE_NONE as a signed integer
Use an unsigned integer for the length
Fix -Wsign-compare compiler warnings
Fix -Wshadow compiler warnings
Fix -Wcast-qual compiler warning
Fix -Wswitch compiler warning
Remove unused variables
Implement the rbt sample
Use some more descriptive variable names
Verify the oxygen and helium percentage
Add support for the Mares Horizon
Swap the object major and minor version
Fix the Mares Genius memory layout
...
The hexadecimal value 0x80000000 is too large to be represented as a
signed 32bit integer. Therefore the default type for the constant is an
unsigned 32bit integer. This is a bit annoying because the timezone
field is actually defined as a signed integer, and thus comparisions
produce -Wsign-compare compiler warnings.
Fixed by switching to INT_MIN, which is the same underlying value but
interpreted as a signed integer.
Merge upstream libdivecomputer from Jef:
- support the Scubapro Aladin A2
- improve Cressi Goa support
- parse and report Oceanic firmware versions
* 'master' of git://github.com/libdivecomputer/libdivecomputer:
Report the firmware version in the devinfo event
Refactor the version string matching to use one table
Parse the firmware version
Add support for Cressi Goa gauge and freedives
Add the extra 5 bytes containing the divemode
Add a function to insert data anywhere in the buffer
Add support for the Scubapro Aladin A2
The memory buffer already supported appending and prepending data, but
not inserting data anywhere in the buffer. That's exactly what the new
function does. The free space is still maintained at either the start or
the end of the buffer.
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
The USB communication is now also implemented as an I/O stream
transport. Unlike most I/O devices, USB communication supports multiple
interfaces and endpoints. This requires some some special care:
In the general case, autodetection isn't really possible without
additional knowledge. Hence the need for the filter parameters to pass
this kind of information.
The implementation assumes two bulk endpoints for the standard
read/write interface. Communication with the control endpoint is
supported through the new DC_IOCTL_USB_CONTROL_{READ,WRITE} ioctl's.
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
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
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>
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>
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>
The libdivecomputer sample flag field for events is fairly useless,
traditionally just having a "begin/end" bit.
This extends the flags field with a severity marker ("state", "info",
"warning", "alarm") so that subsurface can report the event with the
proper kind of notice (ie big red error marker for an alarm, but not
show divecomputer state changes by default, for example).
For Shearwater events we can also add the type of event ("interest",
"navpoint", "danger", "animal", "injury").
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
A lot of dive computers have fairly arbitrary events that are not really
amenable to the simplistic static enumerated values that libdivecomputer
traditionally uses.
In fact, some dive computers (particularly the newer Suunto ones) very
explicitly report strings natively, with events literally being
described with a string like "Below Wet Activation Depth".
So instead of trying to turn these strings into one of the enumerated
values (and have the dive log software try to turn them back into some
random string when showing the user), just report the string itself.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This adds the ability to report time to surface (TTS) as a sample, which
a number of backends will want.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
The dc_tankvolume_t type had information about metric vs imperial
volume, but we actually want other things too, like the actual usage of
the cylinder.
So rename it to 'dc_tankinfo_t' and extend the semantics from an
enumeration of volume units, to be a bitmap of information flags.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The set_latency function is the perfect example of a feature that should
be implemented as an ioctl: it's only implemented by a single driver,
and the functionality is also highly platform specific.
This new ioctl function allows to perform I/O stream specific requests
through a generic interface. This provides an easy way to extend the I/O
interface with some driver specific features, without having to modify
the public api.
The Linux implementation is very straighforward and just a lightweight
wrapper around the select function. But the Windows implementation is
much more complex, because the Windows event notification mechanism
behaves very different:
The WaitCommEvent function does not support a timeout and is always a
blocking call. The only way to implement a timeout is to use
asynchronous I/O (or overlapped I/O as it's called in the Windows API),
to run the operation in the background. This requires some additional
book keeping to keep track of the pending background operation.
The event mechanism is also edge triggered instead of level triggered,
and reading the event with the WaitCommEvent function clears the pending
event. Therefore, the state of the input buffer needs to be checked with
the ClearCommError function before and after the WaitCommEvent call.
The check before is necessary in case the event is already cleared by a
previous WaitCommEvent call, while there is still data present in the
input buffer. In this case, WaitCommEvent should not be called at all,
because it would wait until more data arrives.
The check afterwards is necessary in case WaitCommEvent reports a
pending event, while the data in the input buffer has already been
consumed. In this case, the current event must be ignored and
WaitCommEvent needs to be called again, to wait for the next event.
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.
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.
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.
With the support for multiple transports per device, the
dc_descriptor_get_transport() function became obsolete because it does
support only a single transport type. Applications should use the new
dc_descriptor_get_transports() function instead.
Because the list of supported built-in transports depends on the
availability of external libraries (libusb, hidapi) and the operating
system, the application needs some mechanism to retrieve this
information at runtime. Therefore, a new dc_context_get_transports()
function is added, which returns a bitmask with all the available
built-in transports.
Several dive computers support multiple transports. For example the
Suunto Eon Steel supports both USB HID and BLE. All devices using
bluetooth classic communication support both the native bluetooth
transport and the legacy serial port emulation.
To support this feature, the values of the dc_transport_t type are
changed into bitmasks, and the dc_descriptor_t struct is extended with a
bitfield with all the supported transports.