beaglelogic: Close device after detection, and reopen upon open

Signed-off-by: Kumar Abhishek <abhishek@theembeddedkitchen.net>
This commit is contained in:
Kumar Abhishek 2017-09-23 12:27:52 +05:30 committed by Uwe Hermann
parent f955ffe83f
commit a486fca9e2
1 changed files with 4 additions and 3 deletions

View 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)