]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/gwinstek-gds-800/api.c
sr_dev_close(): Set status to SR_ST_INACTIVE.
[libsigrok.git] / src / hardware / gwinstek-gds-800 / api.c
index d64d43eb43dd3a73f10ce9efbef66744aae87d59..0b8262cdebb053175012e3b1f5a301e70f676c76 100644 (file)
@@ -98,8 +98,6 @@ static int dev_open(struct sr_dev_inst *sdi)
                return SR_ERR;
        }
 
-       sdi->status = SR_ST_ACTIVE;
-
        return SR_OK;
 }
 
@@ -107,17 +105,12 @@ static int dev_close(struct sr_dev_inst *sdi)
 {
        struct sr_scpi_dev_inst *scpi;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        scpi = sdi->conn;
-       if (scpi) {
-               if (sr_scpi_close(scpi) < 0)
-                       return SR_ERR;
-               sdi->status = SR_ST_INACTIVE;
-       }
 
-       return SR_OK;
+       if (!scpi)
+               return SR_ERR_BUG;
+
+       return sr_scpi_close(scpi);
 }
 
 static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,