From: Martin Ling Date: Tue, 16 Sep 2014 01:14:23 +0000 (+0100) Subject: agilent-dmm: Make serial write call block in send. X-Git-Tag: libsigrok-0.4.0~978 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a5053ddd216fb9ad9a7df6f4ce82dda863133685;p=libsigrok.git agilent-dmm: Make serial write call block in send. This call is executed from an event handler context was previously nonblocking, however there is no handling for a partial write. The output buffer is unlikely to be full and the commands to be sent are short, so it should be OK to make this a blocking call. --- diff --git a/src/hardware/agilent-dmm/sched.c b/src/hardware/agilent-dmm/sched.c index 2329c076..66cb60a2 100644 --- a/src/hardware/agilent-dmm/sched.c +++ b/src/hardware/agilent-dmm/sched.c @@ -140,7 +140,7 @@ static int agdmm_send(const struct sr_dev_inst *sdi, const char *cmd) strncat(buf, "\r\n", 32); else strncat(buf, "\n\r\n", 32); - if (serial_write(serial, buf, strlen(buf)) == -1) { + if (serial_write_blocking(serial, buf, strlen(buf)) == -1) { sr_err("Failed to send: %s.", strerror(errno)); return SR_ERR; }