]> sigrok.org Git - libsigrok.git/commitdiff
agilent-dmm: Fix blocking serial write timeout.
authorBert Vermeulen <redacted>
Sat, 4 Oct 2014 00:30:27 +0000 (02:30 +0200)
committerBert Vermeulen <redacted>
Sat, 4 Oct 2014 08:39:11 +0000 (10:39 +0200)
src/hardware/agilent-dmm/agilent-dmm.h
src/hardware/agilent-dmm/api.c
src/hardware/agilent-dmm/sched.c

index 3b320f5c53dda419e4a7d696f95a214330ac1846..77a4a3dc577d908fe84950cffd4f603e5c7da858 100644 (file)
@@ -24,6 +24,9 @@
 
 #define AGDMM_BUFSIZE  256
 
+/* Always USB-serial, 1ms is plenty. */
+#define SERIAL_WRITE_TIMEOUT_MS 1
+
 /* Supported models */
 enum {
        AGILENT_U1231 = 1,
index 96b10d41dcccfb5e530ffa079d1039797a129b88..084f9b4d89171699c3f87cbd8d3785fb43e8a796 100644 (file)
@@ -116,7 +116,7 @@ static GSList *scan(GSList *options)
                return NULL;
 
        serial_flush(serial);
-       if (serial_write_blocking(serial, "*IDN?\r\n", 7, 0) < 7) {
+       if (serial_write_blocking(serial, "*IDN?\r\n", 7, SERIAL_WRITE_TIMEOUT_MS) < 7) {
                sr_err("Unable to send identification string.");
                return NULL;
        }
index cb50c88add1444b2827f0f5e036df78441fa923f..46f4ade210d00f440a4227cf7e0e9753c9247da6 100644 (file)
@@ -140,7 +140,7 @@ static int agdmm_send(const struct sr_dev_inst *sdi, const char *cmd)
                strcat(buf, "\r\n");
        else
                strcat(buf, "\n\r\n");
-       if (serial_write_blocking(serial, buf, strlen(buf), 0) < (int)strlen(buf)) {
+       if (serial_write_blocking(serial, buf, strlen(buf), SERIAL_WRITE_TIMEOUT_MS) < (int)strlen(buf)) {
                sr_err("Failed to send.");
                return SR_ERR;
        }