]> sigrok.org Git - libsigrok.git/blobdiff - hardware/lascar-el-usb/api.c
Don't automatically clear known instances from USB drivers on scan
[libsigrok.git] / hardware / lascar-el-usb / api.c
index db890d908f9dbcad1aa0bc150b0916fc719bd332..ea2a80f7a2e738cf5c35050228e763f0b2657dd7 100644 (file)
@@ -85,9 +85,6 @@ static GSList *hw_scan(GSList *options)
 
        drvc = di->priv;
 
-       /* USB scan is always authoritative. */
-       clear_instances();
-
        conn = NULL;
        for (l = options; l; l = l->next) {
                src = l->data;
@@ -229,14 +226,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        int ret;
 
+       if (sdi->status != SR_ST_ACTIVE)
+               return SR_ERR_DEV_CLOSED;
+
        if (!di->priv) {
                sr_err("Driver was not initialized.");
                return SR_ERR;
        }
-       if (sdi->status != SR_ST_ACTIVE) {
-               sr_err("Device inactive, can't set config options.");
-               return SR_ERR;
-       }
 
        devc = sdi->priv;
        ret = SR_OK;
@@ -369,6 +365,9 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        int ret, i;
        unsigned char cmd[3], resp[4], *buf;
 
+       if (sdi->status != SR_ST_ACTIVE)
+               return SR_ERR_DEV_CLOSED;
+
        if (!di->priv) {
                sr_err("Driver was not initialized.");
                return SR_ERR;