[PATCH 1/2] Cochran: removed unneeded serial configuration and commands.

John Van Ostrand john at vanostrand.com
Sun Dec 7 10:17:51 PST 2014


The Cochran serial configuration and commands duplicated what Analyst
did when communicating with the DC. These are unneeded and were
removed.

Signed-off-by: John Van Ostrand <john at vanostrand.com>
---
 src/cochran_commander.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/src/cochran_commander.c b/src/cochran_commander.c
index 5f7b8f3..dc9b3d5 100644
--- a/src/cochran_commander.c
+++ b/src/cochran_commander.c
@@ -82,7 +82,6 @@ cochran_packet (cochran_device_t *device, dc_event_progress_t *progress,
 	if (high_speed) {
 		serial_sleep(device->port, 45);
 
-		// Weird but I only get the right result when I do it twice
 		// Rates are odd, like 825600 for the EMC, 115200 for commander
 		rc = serial_configure(device->port, device->data.conf.high_baud, 8,
 						SERIAL_PARITY_NONE, 2, SERIAL_FLOWCONTROL_NONE);
@@ -91,14 +90,6 @@ cochran_packet (cochran_device_t *device, dc_event_progress_t *progress,
 			free (device);
 			return DC_STATUS_IO;
 		}
-
-		rc = serial_configure(device->port, device->data.conf.high_baud, 8,
-						SERIAL_PARITY_NONE, 2, SERIAL_FLOWCONTROL_NONE);
-		if (rc == -1) {
-			ERROR (abstract->context, "Failed to set the high baud rate.");
-			free (device);
-			return DC_STATUS_IO;
-		}
 	}
 
 	// Receive the answer from the device.
@@ -146,14 +137,8 @@ cochran_commander_serial_setup (cochran_device_t *device, dc_context_t *context)
 	serial_set_queue_size(device->port, 4096, 4096);
 
 	// Make sure everything is in a sane state.
-	// Mimicing Analyst software with excessive flushes
 	serial_flush (device->port, SERIAL_QUEUE_OUTPUT);
 	serial_flush (device->port, SERIAL_QUEUE_INPUT);
-	serial_flush (device->port, SERIAL_QUEUE_INPUT);
-	serial_flush (device->port, SERIAL_QUEUE_INPUT);
-	serial_flush (device->port, SERIAL_QUEUE_INPUT);
-	serial_flush (device->port, SERIAL_QUEUE_INPUT);
-	serial_flush (device->port, SERIAL_QUEUE_INPUT);
 
 	serial_set_break(device->port, 1);
 	serial_sleep(device->port, 16);
-- 
1.9.3



More information about the devel mailing list