]> sigrok.org Git - libsigrok.git/blobdiff - src/scpi/scpi_libgpib.c
korad-kaxxxxp: Simplify korad_kaxxxxp_receive_data() event loop function.
[libsigrok.git] / src / scpi / scpi_libgpib.c
index ed499cca5bad7bacd0e1e1fa07b70fc4ab7041a9..2f3256be948e2eae404d02cda0e38b4391bab465 100644 (file)
@@ -118,8 +118,9 @@ static int scpi_gpib_read_data(void *priv, char *buf, int maxlen)
 
        if (ibsta & ERR)
        {
-               sr_err("Error while reading SCPI response: iberr = %s.",
-                       gpib_error_string(iberr));
+               sr_err("Error while reading SCPI response: "
+                       "iberr = %s, ibsta = %d.",
+                       gpib_error_string(iberr), ibsta);
                return SR_ERR;
        }
 
@@ -139,6 +140,9 @@ static int scpi_gpib_close(struct sr_scpi_dev_inst *scpi)
 {
        struct scpi_gpib *gscpi = scpi->priv;
 
+       /* Put device in back local mode to prevent lock-out of front panel. */
+       ibloc(gscpi->descriptor);
+       /* Now it's safe to close the handle. */
        ibonl(gscpi->descriptor, 0);
 
        return SR_OK;