X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Funi-t-ut32x%2Fapi.c;h=1d12a580a76fbdd844520b1dcc3f111cf08c5504;hb=f1ba6b4b2c9a8ecf90bb31efb218752aa7e49d1a;hp=25f142b49d9da9a9ff60cacbf430c89c21b50c42;hpb=40bbf635fadac32d1e702f02fe571d95338d582b;p=libsigrok.git diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index 25f142b4..1d12a580 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -127,9 +127,8 @@ static int dev_open(struct sr_dev_inst *sdi) sr_err("Failed to claim interface: %s.", libusb_error_name(ret)); return SR_ERR; } - sdi->status = SR_ST_ACTIVE; - return ret; + return SR_OK; } static int dev_close(struct sr_dev_inst *sdi) @@ -137,14 +136,13 @@ static int dev_close(struct sr_dev_inst *sdi) struct sr_usb_dev_inst *usb; usb = sdi->conn; + if (!usb->devhdl) - /* Nothing to do. */ - return SR_OK; + return SR_ERR_BUG; libusb_release_interface(usb->devhdl, USB_INTERFACE); libusb_close(usb->devhdl); usb->devhdl = NULL; - sdi->status = SR_ST_INACTIVE; return SR_OK; } @@ -182,9 +180,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd (void)cg; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - devc = sdi->priv; switch (key) { @@ -241,9 +236,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) int len, ret; unsigned char cmd[2]; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - drvc = di->context; devc = sdi->priv; usb = sdi->conn; @@ -296,9 +288,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) static int dev_acquisition_stop(struct sr_dev_inst *sdi) { - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - /* Signal USB transfer handler to clean up and stop. */ sdi->status = SR_ST_STOPPING;