]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/lascar-el-usb/api.c
sr_dev_close(): Set status to SR_ST_INACTIVE.
[libsigrok.git] / src / hardware / lascar-el-usb / api.c
index 405c8f923053d4f3be29580144919dcaf17860c1..9801732a8e70ce1211757abf7030dc9eb029f6f8 100644 (file)
@@ -97,9 +97,8 @@ static int dev_open(struct sr_dev_inst *sdi)
                sr_err("Failed to claim interface: %s.", libusb_error_name(ret));
                return SR_ERR;
        }
-       sdi->status = SR_ST_ACTIVE;
 
-       return ret;
+       return SR_OK;
 }
 
 static int dev_close(struct sr_dev_inst *sdi)
@@ -109,13 +108,11 @@ static int dev_close(struct sr_dev_inst *sdi)
        usb = sdi->conn;
 
        if (!usb->devhdl)
-               /*  Nothing to do. */
-               return SR_OK;
+               return SR_ERR_BUG;
 
        libusb_release_interface(usb->devhdl, LASCAR_INTERFACE);
        libusb_close(usb->devhdl);
        usb->devhdl = NULL;
-       sdi->status = SR_ST_INACTIVE;
 
        return SR_OK;
 }
@@ -164,9 +161,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        ret = SR_OK;
        switch (key) {
@@ -293,9 +287,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        int ret;
        unsigned char cmd[3], resp[4], *buf;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        drvc = di->context;
        devc = sdi->priv;
        usb = sdi->conn;
@@ -395,13 +386,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi)
 {
-       if (sdi->status != SR_ST_ACTIVE) {
-               sr_err("Device inactive, can't stop acquisition.");
-               return SR_ERR;
-       }
-
        sdi->status = SR_ST_STOPPING;
        /* TODO: free ongoing transfers? */