comparison 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
comparison
equal deleted inserted replaced
33:34a8d83fd63b 34:99f753d4ccaf
16 char instrument_response[4096]; 16 char instrument_response[4096];
17 17
18 send_scpi_cmd(cmd) 18 send_scpi_cmd(cmd)
19 char *cmd; 19 char *cmd;
20 { 20 {
21 int cc, len;
22
21 printf("Command to CMU: %s", cmd); 23 printf("Command to CMU: %s", cmd);
22 write(target_fd, cmd, strlen(cmd)); 24 len = strlen(cmd);
25 cc = write(target_fd, cmd, len);
26 if (cc != len) {
27 perror("serial port write error");
28 exit(1);
29 }
23 } 30 }
24 31
25 collect_instr_response() 32 collect_instr_response()
26 { 33 {
27 char buf[BUFSIZ]; 34 char buf[BUFSIZ];