From: Kumar Abhishek Date: Sat, 23 Sep 2017 06:57:52 +0000 (+0530) Subject: beaglelogic: Close device after detection, and reopen upon open X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a486fca9e215ecbe12dd5e20efefa6aa8ed086e1;p=libsigrok.git beaglelogic: Close device after detection, and reopen upon open Signed-off-by: Kumar Abhishek --- diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index 25ac0a6e..ca50c9c0 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -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)