changeset 34:99f753d4ccaf

fc-cmu200d: check for errors on serial port write
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2017 00:33:10 +0000
parents 34a8d83fd63b
children 5c0a6e536c70
files cmu200/sercmd.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cmu200/sercmd.c	Tue May 23 00:12:10 2017 +0000
+++ b/cmu200/sercmd.c	Tue May 23 00:33:10 2017 +0000
@@ -18,8 +18,15 @@
 send_scpi_cmd(cmd)
 	char *cmd;
 {
+	int cc, len;
+
 	printf("Command to CMU: %s", cmd);
-	write(target_fd, cmd, strlen(cmd));
+	len = strlen(cmd);
+	cc = write(target_fd, cmd, len);
+	if (cc != len) {
+		perror("serial port write error");
+		exit(1);
+	}
 }
 
 collect_instr_response()