From: Uwe Hermann Date: Sun, 13 Sep 2015 22:00:22 +0000 (+0200) Subject: norma-dmm: Fix blocking serial write timeout. X-Git-Tag: libsigrok-0.4.0~290 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d545c81c96b5058e52e5354269972876026dd7e3;p=libsigrok.git norma-dmm: Fix blocking serial write timeout. This fixes bug #434. --- diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index 284ecf37..6dc9ed87 100644 --- a/src/hardware/norma-dmm/api.c +++ b/src/hardware/norma-dmm/api.c @@ -120,7 +120,8 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options) nmadmm_requests[NMADMM_REQ_IDN].req_str); g_usleep(150 * 1000); /* Wait a little to allow serial port to settle. */ for (cnt = 0; cnt < 7; cnt++) { - if (serial_write_blocking(serial, req, strlen(req), 0) < 0) { + if (serial_write_blocking(serial, req, strlen(req), + serial_timeout(serial, strlen(req))) < 0) { sr_err("Unable to send identification request."); return NULL; } diff --git a/src/hardware/norma-dmm/protocol.c b/src/hardware/norma-dmm/protocol.c index ea9cdb43..35b11957 100644 --- a/src/hardware/norma-dmm/protocol.c +++ b/src/hardware/norma-dmm/protocol.c @@ -51,7 +51,8 @@ static int nma_send_req(const struct sr_dev_inst *sdi, int req, char *params) devc->last_req = req; devc->last_req_pending = TRUE; - if (serial_write_blocking(serial, buf, len, 0) < 0) { + if (serial_write_blocking(serial, buf, len, + serial_timeout(serial, len)) < 0) { sr_err("Unable to send request."); devc->last_req_pending = FALSE; return SR_ERR;