]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/gwinstek-gds-800/api.c
sr_config_set(): Factor out SR_ERR_DEV_CLOSED check.
[libsigrok.git] / src / hardware / gwinstek-gds-800 / api.c
index 2889a814d2996c0e46eaffaff53d79d22f944f2b..d64d43eb43dd3a73f10ce9efbef66744aae87d59 100644 (file)
@@ -66,8 +66,8 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
 
        devc = g_malloc0(sizeof(struct dev_context));
        devc->frame_limit = 1;
-       devc->sample_rate = 0.;
-       devc->df_started  = FALSE;
+       devc->sample_rate = 0.0;
+       devc->df_started = FALSE;
        sdi->priv = devc;
 
        sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
@@ -153,9 +153,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        if (!sdi)
                return SR_ERR_ARG;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
@@ -199,9 +196,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        scpi = sdi->conn;
        devc = sdi->priv;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc->state = START_ACQUISITION;
        devc->cur_acq_frame = 0;
 
@@ -220,11 +214,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
        scpi = sdi->conn;
        devc = sdi->priv;
 
-       if (sdi->status != SR_ST_ACTIVE) {
-               sr_err("Device inactive, can't stop acquisition.");
-               return SR_ERR;
-       }
-
        if (devc->df_started) {
                packet.type = SR_DF_FRAME_END;
                sr_session_send(sdi, &packet);