]> sigrok.org Git - libsigrok.git/commitdiff
beaglelogic: Close device after detection, and reopen upon open
authorKumar Abhishek <redacted>
Sat, 23 Sep 2017 06:57:52 +0000 (12:27 +0530)
committerUwe Hermann <redacted>
Tue, 26 Sep 2017 16:14:46 +0000 (18:14 +0200)
Signed-off-by: Kumar Abhishek <redacted>
src/hardware/beaglelogic/api.c

index 25ac0a6e871ec04be9368498d516bfcbb759989e..ca50c9c015853dd93218a9194c89d6a7d8948b26 100644 (file)
@@ -136,6 +136,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                        goto err_free;
                if (beaglelogic_tcp_detect(devc) != SR_OK)
                        goto err_free;
+               if (devc->beaglelogic->close(devc) != SR_OK)
+                       goto err_free;
                sr_info("BeagleLogic device found at %s : %s",
                        devc->address, devc->port);
        }
@@ -163,9 +165,8 @@ static int dev_open(struct sr_dev_inst *sdi)
        struct dev_context *devc = sdi->priv;
 
        /* Open BeagleLogic */
-       if (devc->beaglelogic == &beaglelogic_native_ops)
-               if (devc->beaglelogic->open(devc))
-                       return SR_ERR;
+       if (devc->beaglelogic->open(devc))
+               return SR_ERR;
 
        /* Set fd and local attributes */
        if (devc->beaglelogic == &beaglelogic_tcp_ops)