diff cmu200/sercmd.c @ 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 aeffe53e110d
children
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()