4 Commits

Author SHA1 Message Date
Linus Torvalds
c52becf6d4 Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-branch
Merge with upstream:

 - support for the OSTC 2 TR

 - add support for dive computer filtering for device discovery

 - various cleanups particularly to timestamp handling

 - remove half-duplex emulation from the I/O api

* 'master' of git://github.com/libdivecomputer/libdivecomputer:
  Remove the half-duplex emulation from the I/O api
  Handle the half-duplex emulation in the vyper2 backend
  Use the new timer for the timestamps in the logging
  Use the new timer for the timeout calculations
  Add a high resolution timer module
  Add functions for converting bluetooth addresses
  Add support for the OSTC 2 TR
  Add a workaround for invalid logbook begin pointers
  Let the ringbuffer function handle a full ringbuffer
  Suppress the warning if no O2 sensors are present
  Integrate the connect step into the open function
  Implement some filter functions
  Add suport for applying a filter function
  Re-write the device discovery using the iterator api
  Cleanup the iterator internals
2018-03-11 12:43:59 -07:00
Linus Torvalds
8a34d822ff Merge remote-tracking branch 'jef/master' into Subsurface-branch
Rough merge of upstream libdivecomputer.

This is mainly about making the new iostream code upstream, although we
don't actually use it.

It abstracts out the the old serial and usbhid code, but we end up still
using our own 'custom_io' interface because the iostream code doesn't do
it right.

* jef/master:
  Correctly determine git SHA if libdivecomputer is a git submodule
  Don't accept a NULL pointer as parameter
  Add support for semi-closed circuit diving
  Detect dives with invalid profile data
  Implement the serial communication functions as no-ops
  Move the socket code to a common file
  Add support for a custom I/O implementation
  Port the USB HID code to the new I/O interface
  Port the bluetooth code to the new I/O interface
  Port the IrDA code to the new I/O interface
  Port the serial code to the new I/O interface
  Add a new abstract I/O interface
  Post release version bump to 0.7.0
2017-12-12 13:59:29 -08:00
Linus Torvalds
208807180a Update the operations in 'custom_io' to consistent calling conventions
The serial ops used a legacy calling convention that passed in just the
pointer to the userdata pointer (ie the first argument to the functions
was "void **userdata").

That's actually very inconvenient, because the custom IO data can not
only contain other interesting information that was filled in by the
custom IO provider, it also made it harder to chain these things
together, as exemplified by the core to emulate serial over the packet
interface in the subsurface bluetooth code.

This also adds the 'dc_context_t' field that is passed to the packet
routine open.  That can allow the open routine to override the
'custom_io' details of the context at open time (to allow nested
custom_io operation).

Note that callers of the open function need to be aware that the
'custom_io' can be changed by the act of opening a custom_io, and the
value shouldn't be cached in some local variable.

Finally, this adds a new user-supplied opaque pointer

	dc_user_device_t *user_device;

to the custom_io descriptor.

The 'user_device' data is filled in when registering the custom_io with
data that the custom IO open() routines can use.  This is different from
the existing 'userdata' in that the 'user_device' is filled in before
dc_open_device() is called (and "open" can then use it to limit what
kinds of devices it looks for, for example).

In contrast, the existing 'userdata' field is filled in by the
"xyz_open()" routines, and contains the data necessary for the IO
itself.

The SSRF_CUSTOM_IO define is updated to v2 to indicate the new
interfaces.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-06-27 13:38:45 -07:00
Linus Torvalds
60efc308d2 Rename 'custom_serial' as 'custom_io' across the board
The custom IO handlers will be extended to not just do serial line
emulation (generally over Bluetooth rfcomm), but do BLE too.

BLE does not look like a serial protocol at all, it's packet-based, and
we may have to add specific routines to indicate which GATT endpoints to
use etc.  But like the traditional custom serial code, we want to do the
actual IO not from within libdivecomputer, but from the user of the
library (because the BLE support will require things like the Qt
Connectivity layer - and we do not want libdivecomputer to have to link
against something like Qt).

So this renames 'custom_serial' to 'custom_io', and instead names the
individual member function pointers 'serial_*' to make it clear that
those members are for serial communication.

It also adds new placeholders for packet_open/close/read/write.  Note
that while these may look similar to the serial counter-parts, they are
not the same or even necessarily mutually exclusive.  It is possible the
the caller fills in one or the other (or both), and they would be used
independently.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-06-18 16:28:24 +09:00