X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fsysclk-lwla%2Fapi.c;h=34dc884d83e58a89d573a6be8d78115288492d4c;hb=f1ba6b4b2c9a8ecf90bb31efb218752aa7e49d1a;hp=1da4b00eb86698e4707996e0695a816f85701064;hpb=d2f7c417fdd96a13d8fd86350d2fc13db16f626c;p=libsigrok.git diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c index 1da4b00e..34dc884d 100644 --- a/src/hardware/sysclk-lwla/api.c +++ b/src/hardware/sysclk-lwla/api.c @@ -273,11 +273,6 @@ static int dev_open(struct sr_dev_inst *sdi) devc = sdi->priv; usb = sdi->conn; - if (sdi->status != SR_ST_INACTIVE) { - sr_err("Device already open."); - return SR_ERR; - } - /* Try the whole shebang three times, fingers crossed. */ for (i = 0; i < 3; i++) { ret = sr_usb_open(drvc->sr_ctx->libusb_ctx, usb); @@ -308,8 +303,6 @@ static int dev_open(struct sr_dev_inst *sdi) /* This delay appears to be necessary for reliable operation. */ g_usleep(30 * 1000); - sdi->status = SR_ST_ACTIVE; - devc->active_fpga_config = FPGA_NOCONF; devc->short_transfer_quirk = FALSE; devc->state = STATE_IDLE; @@ -322,7 +315,6 @@ static int dev_open(struct sr_dev_inst *sdi) break; /* Rinse and repeat. */ - sdi->status = SR_ST_INACTIVE; sr_usb_close(usb); } @@ -332,8 +324,7 @@ static int dev_open(struct sr_dev_inst *sdi) return ret; } -/* Shutdown and close device. - */ +/* Shutdown and close device. */ static int dev_close(struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -343,10 +334,6 @@ static int dev_close(struct sr_dev_inst *sdi) devc = sdi->priv; usb = sdi->conn; - if (sdi->status == SR_ST_INACTIVE) { - sr_dbg("Device already closed."); - return SR_OK; - } if (devc->acquisition) { sr_err("Cannot close device during acquisition!"); /* Request stop, leak handle, and prepare for the worst. */ @@ -354,17 +341,16 @@ static int dev_close(struct sr_dev_inst *sdi) return SR_ERR_BUG; } - sdi->status = SR_ST_INACTIVE; - /* Download of the shutdown bitstream, if any. */ ret = (*devc->model->apply_fpga_config)(sdi); if (ret != SR_OK) sr_warn("Unable to shut down device."); libusb_release_interface(usb->devhdl, USB_INTERFACE); + sr_usb_close(usb); - return ret; + return SR_OK; } /* Check whether the device options contain a specific key. @@ -645,9 +631,6 @@ static int config_commit(const struct sr_dev_inst *sdi) devc = sdi->priv; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - if (devc->acquisition) { sr_err("Acquisition still in progress?"); return SR_ERR; @@ -743,11 +726,6 @@ static int config_list(uint32_t key, GVariant **data, */ static int dev_acquisition_start(const struct sr_dev_inst *sdi) { - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - - sr_info("Starting acquisition."); - return lwla_start_acquisition(sdi); }