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:
Anton Lundin 2016-09-17 17:27:56 +02:00 committed by Dirk Hohndel
parent 1219dc6931
commit ffa3c48593
6 changed files with 204 additions and 293 deletions

View file

@ -100,16 +100,6 @@ static dc_status_t local_dc_device_open(dc_device_t **out, dc_context_t *context
}
#define dc_device_open local_dc_device_open
// Fake the custom open function
static dc_status_t local_dc_device_custom_open(dc_device_t **out, dc_context_t *context, dc_descriptor_t *descriptor, dc_serial_t *serial)
{
if (strcmp(dc_descriptor_get_vendor(descriptor), "Heinrichs Weikamp") == 0 &&strcmp(dc_descriptor_get_product(descriptor), "OSTC 2N") == 0)
return DC_STATUS_SUCCESS;
else
return dc_device_custom_open(out, context, descriptor, serial);
}
#define dc_device_custom_open local_dc_device_custom_open
static dc_status_t local_hw_ostc_device_eeprom_read(void *ignored, unsigned char bank, unsigned char data[], unsigned int data_size)
{
FILE *f;