]> sigrok.org Git - libsigrok.git/blobdiff - hardware/rigol-ds/api.c
scpi: add a generic scan API and implement it in usbtmc and serial transport
[libsigrok.git] / hardware / rigol-ds / api.c
index f61d58ca1e01993ac656fe6eb34fc6c5a3bb2fc2..0f319cbd0902c5bce5d5c8c4eaee190ebf6a642b 100644 (file)
@@ -269,7 +269,7 @@ static int probe_port(const char *resource, const char *serialcomm, GSList **dev
 
        *devices = NULL;
 
-       if (!(scpi = scpi_dev_inst_new(resource, serialcomm)))
+       if (!(scpi = scpi_dev_inst_new(di->priv, resource, serialcomm)))
                return SR_ERR;
 
        if (sr_scpi_open(scpi) != SR_OK) {
@@ -482,13 +482,13 @@ static int dev_close(struct sr_dev_inst *sdi)
        struct sr_scpi_dev_inst *scpi;
        struct dev_context *devc;
 
-       if (sdi->status != SR_ST_INACTIVE)
-               return SR_OK;
+       if (sdi->status != SR_ST_ACTIVE)
+               return SR_ERR_DEV_CLOSED;
 
        scpi = sdi->conn;
        devc = sdi->priv;
 
-       if (devc->model->series->protocol >= PROTOCOL_V2)
+       if (devc->model->series->protocol == PROTOCOL_V2)
                rigol_ds_config_set(sdi, ":KEY:LOCK DISABLE");
 
        if (scpi) {