diff options
author | Anton Lundin <glance@acc.umu.se> | 2016-09-17 17:27:56 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-09-17 15:47:37 -0700 |
commit | ffa3c4859327a78288cfb74e633ac3845a86ed86 (patch) | |
tree | 2576d8a298875a750f7b05ba9bd5bfebdeff9335 /core/libdivecomputer.c | |
parent | 1219dc693170e4a04fff992bd5aed990674779c1 (diff) | |
download | subsurface-ffa3c4859327a78288cfb74e633ac3845a86ed86.tar.gz |
Rewrite libdivecomputer custom serial code
This rewrites the custom serial code to use the new api which I
implemented in the Subsurface-branch of libdivecomputer.
This is a bit to big patch but I haven't had the time to break it down
into more sensible patches.
This rewrite enables us to support more ftdi based divecomputer
communication and is tested with both a OSTC3, OSTC2N and a Suunto
Vyper, all over the libftdi driver.
The bluetooth code paths are tested to, and should work as before.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/libdivecomputer.c')
-rw-r--r-- | core/libdivecomputer.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c index 92e61b92c..cd1b69bde 100644 --- a/core/libdivecomputer.c +++ b/core/libdivecomputer.c @@ -1026,22 +1026,18 @@ const char *do_libdivecomputer_import(device_data_t *data) err = translate("gettextFromC", "Unable to open %s %s (%s)"); #if defined(SSRF_CUSTOM_SERIAL) - dc_serial_t *serial_device = NULL; - if (data->bluetooth_mode) { #if defined(BT_SUPPORT) && defined(SSRF_CUSTOM_SERIAL) - rc = dc_serial_qt_open(&serial_device, data->context, data->devname); + rc = dc_context_set_custom_serial(data->context, get_qt_serial_ops()); #endif #ifdef SERIAL_FTDI } else if (!strcmp(data->devname, "ftdi")) { - rc = dc_serial_ftdi_open(&serial_device, data->context); + rc = dc_context_set_custom_serial(data->context, &serial_ftdi_ops); #endif } if (rc != DC_STATUS_SUCCESS) { report_error(errmsg(rc)); - } else if (serial_device) { - rc = dc_device_custom_open(&data->device, data->context, data->descriptor, serial_device); } else { #else { |