]> sigrok.org Git - libsigrok.git/commitdiff
norma-dmm: Fix blocking serial write timeout.
authorUwe Hermann <redacted>
Sun, 13 Sep 2015 22:00:22 +0000 (00:00 +0200)
committerUwe Hermann <redacted>
Sun, 13 Sep 2015 22:10:24 +0000 (00:10 +0200)
This fixes bug #434.

src/hardware/norma-dmm/api.c
src/hardware/norma-dmm/protocol.c

index 284ecf37b79483f60b6892cc2050f5c8d563bb97..6dc9ed87da25ffe21b512ff36a16ad8edff78f6f 100644 (file)
@@ -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;
                }
index ea9cdb434acc82ea81f653aaa3f676e7624f1b46..35b1195723128a89994ea1aa1a1eb043983c9ccc 100644 (file)
@@ -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;