]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/scpi-dmm/protocol.c
scpi-dmm: move OPC availability check to after IDN device identification
[libsigrok.git] / src / hardware / scpi-dmm / protocol.c
index bc739400cb38240e101573f58fa0d064f725715a..279aadf56410cc78213c6d51361f4df8a129f1e1 100644 (file)
@@ -28,7 +28,9 @@ SR_PRIV void scpi_dmm_cmd_delay(struct sr_scpi_dev_inst *scpi)
 {
        if (WITH_CMD_DELAY)
                g_usleep(WITH_CMD_DELAY * 1000);
-       sr_scpi_get_opc(scpi);
+
+       if (!scpi->no_opc_command)
+               sr_scpi_get_opc(scpi);
 }
 
 SR_PRIV const struct mqopt_item *scpi_dmm_lookup_mq_number(
@@ -98,8 +100,10 @@ SR_PRIV int scpi_dmm_get_mq(const struct sr_dev_inst *sdi,
        ret = sr_scpi_get_string(sdi->conn, command, &response);
        if (ret != SR_OK)
                return ret;
-       if (!response || !*response)
+       if (!response || !*response) {
+               g_free(response);
                return SR_ERR_NA;
+       }
        have = response;
        if (*have == '"')
                have++;
@@ -114,6 +118,8 @@ SR_PRIV int scpi_dmm_get_mq(const struct sr_dev_inst *sdi,
                if (mqitem)
                        *mqitem = item;
                ret = SR_OK;
+       } else {
+               sr_warn("Unknown measurement quantity: %s", have);
        }
 
        if (rsp) {