]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hameg-hmo/api.c
sr_dev_close(): Set status to SR_ST_INACTIVE.
[libsigrok.git] / src / hardware / hameg-hmo / api.c
index 7bd0b8b4cc8bc12bbcd89778acabd147cbb66a0f..9245869b35b2cb7f167fe2d26726062c13769359 100644 (file)
@@ -98,8 +98,7 @@ static struct sr_dev_inst *hmo_probe_serial_device(struct sr_scpi_dev_inst *scpi
        return sdi;
 
 fail:
-       if (hw_info)
-               sr_scpi_hw_info_free(hw_info);
+       sr_scpi_hw_info_free(hw_info);
        sr_dev_inst_free(sdi);
        g_free(devc);
 
@@ -132,27 +131,18 @@ static int dev_clear(const struct sr_dev_driver *di)
 
 static int dev_open(struct sr_dev_inst *sdi)
 {
-       if (sdi->status != SR_ST_ACTIVE && sr_scpi_open(sdi->conn) != SR_OK)
+       if (sr_scpi_open(sdi->conn) != SR_OK)
                return SR_ERR;
 
        if (hmo_scope_state_get(sdi) != SR_OK)
                return SR_ERR;
 
-       sdi->status = SR_ST_ACTIVE;
-
        return SR_OK;
 }
 
 static int dev_close(struct sr_dev_inst *sdi)
 {
-       if (sdi->status == SR_ST_INACTIVE)
-               return SR_OK;
-
-       sr_scpi_close(sdi->conn);
-
-       sdi->status = SR_ST_INACTIVE;
-
-       return SR_OK;
+       return sr_scpi_close(sdi->conn);
 }
 
 static int check_channel_group(struct dev_context *devc,
@@ -728,9 +718,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_scpi_dev_inst *scpi;
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        scpi = sdi->conn;
        devc = sdi->priv;
 
@@ -812,9 +799,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
 
        std_session_send_df_end(sdi);
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        devc->num_frames = 0;