From ffa3c4859327a78288cfb74e633ac3845a86ed86 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Sat, 17 Sep 2016 17:27:56 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- core/configuredivecomputer.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'core/configuredivecomputer.cpp') diff --git a/core/configuredivecomputer.cpp b/core/configuredivecomputer.cpp index 2457ffe82..d8aefaecc 100644 --- a/core/configuredivecomputer.cpp +++ b/core/configuredivecomputer.cpp @@ -633,22 +633,18 @@ QString ConfigureDiveComputer::dc_open(device_data_t *data) } #if defined(SSRF_CUSTOM_SERIAL) - dc_serial_t *serial_device = NULL; - if (data->bluetooth_mode) { -#ifdef BT_SUPPORT - rc = dc_serial_qt_open(&serial_device, data->context, data->devname); +#if defined(BT_SUPPORT) && defined(SSRF_CUSTOM_SERIAL) + 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) { - return errmsg(rc); - } else if (serial_device) { - rc = dc_device_custom_open(&data->device, data->context, data->descriptor, serial_device); + report_error(errmsg(rc)); } else { #else { -- cgit v1.2.3-70-g09d2