It was extraneous becaue it's included in the dc_device_t struct. --- src/cochran_commander.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/cochran_commander.c b/src/cochran_commander.c index 9fb8c6b..97e0531 100644 --- a/src/cochran_commander.c +++ b/src/cochran_commander.c @@ -221,7 +221,7 @@ cochran_packet (cochran_device_t *device, dc_event_progress_t *progress,
static dc_status_t -cochran_commander_serial_setup (cochran_device_t *device, dc_context_t *context) +cochran_commander_serial_setup (cochran_device_t *device) { int rc;
@@ -229,7 +229,7 @@ cochran_commander_serial_setup (cochran_device_t *device, dc_context_t *context) rc = serial_configure (device->port, 9600, 8, SERIAL_PARITY_NONE, 2, SERIAL_FLOWCONTROL_NONE); if (rc == -1) { - ERROR (context, "Failed to set the terminal attributes."); + ERROR (device->base.context, "Failed to set the terminal attributes."); serial_close (device->port); return DC_STATUS_IO; } @@ -247,7 +247,7 @@ cochran_commander_serial_setup (cochran_device_t *device, dc_context_t *context)
// Set the timeout for receiving data (5000 ms). if (serial_set_timeout (device->port, 5000) == -1) { - ERROR (context, "Failed to set the timeout."); + ERROR (device->base.context, "Failed to set the timeout."); serial_close (device->port); return DC_STATUS_IO; } @@ -256,7 +256,7 @@ cochran_commander_serial_setup (cochran_device_t *device, dc_context_t *context) char answer[1]; int n = serial_read(device->port, answer, 1); if (n != 1) { - ERROR (context, "Failed to receive device heartbeat."); + ERROR (device->base.context, "Failed to receive device heartbeat."); return EXITCODE (n); }
@@ -265,16 +265,16 @@ cochran_commander_serial_setup (cochran_device_t *device, dc_context_t *context)
dc_status_t -cochran_commander_serial_open(cochran_device_t *device, dc_context_t *context) +cochran_commander_serial_open(cochran_device_t *device) { // Open the device. - int rc = serial_open (&device->port, context, device->name); + int rc = serial_open (&device->port, device->base.context, device->name); if (rc == -1) { - ERROR (context, "Failed to open the serial port."); + ERROR (device->base.context, "Failed to open the serial port."); return DC_STATUS_IO; }
- return cochran_commander_serial_setup(device, context); + return cochran_commander_serial_setup(device); }
@@ -304,7 +304,7 @@ cochran_commander_device_open (dc_device_t **out, dc_context_t *context, cochran_commander_device_set_fingerprint((dc_device_t *) device, NULL, 0);
- rc = cochran_commander_serial_open(device, context); + rc = cochran_commander_serial_open(device); if (rc != DC_STATUS_SUCCESS) { dc_device_deallocate((dc_device_t *) device); return rc; @@ -586,7 +586,7 @@ cochran_read_logbook (dc_device_t *abstract, dc_event_progress_t *progress) serial_sleep(device->port, 800);
// set back to 9600 baud - cochran_commander_serial_setup(device, abstract->context); + cochran_commander_serial_setup(device);
// Request log book rc = cochran_commander_read(abstract, progress, 0, d->logbook, @@ -686,7 +686,7 @@ cochran_read_samples(dc_device_t *abstract, dc_event_progress_t *progress) serial_sleep(device->port, 800);
// set back to 9600 baud - cochran_commander_serial_setup(device, abstract->context); + cochran_commander_serial_setup(device);
// Read the sample data rc = cochran_commander_read (abstract, progress, d->sample_data_offset, @@ -817,7 +817,7 @@ cochran_commander_device_dump (dc_device_t *abstract, dc_buffer_t *data) serial_sleep(device->port, 800);
// set back to 9600 baud - cochran_commander_serial_setup(device, abstract->context); + cochran_commander_serial_setup(device);
// Read the sample data, from 0 to sample end will include logbook rc = cochran_commander_read (abstract, &progress, 0,