mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
1219dc6931
commit
ffa3c48593
6 changed files with 204 additions and 293 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue