]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/dreamsourcelab-dslogic/protocol.c
sr_dev_open(): Factor out SR_ST_ACTIVE check.
[libsigrok.git] / src / hardware / dreamsourcelab-dslogic / protocol.c
index cf6272b68b5e2bba30394a1ada9045b8a3d8f461..43280cc56333e44586ebaee608e8cf07cca6783b 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 #include <config.h>
-#include <assert.h>
 #include <math.h>
 #include <glib.h>
 #include <glib/gstdio.h>
@@ -569,10 +568,6 @@ SR_PRIV int dslogic_dev_open(struct sr_dev_inst *sdi, struct sr_dev_driver *di)
        devc = sdi->priv;
        usb = sdi->conn;
 
-       if (sdi->status == SR_ST_ACTIVE)
-               /* Device is already in use. */
-               return SR_ERR;
-
        device_count = libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
        if (device_count < 0) {
                sr_err("Failed to get device list: %s.",
@@ -859,7 +854,8 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
                 *
                 * Hopefully in future it will be possible to pass the data on as-is.
                 */
-               assert(transfer->actual_length % (DSLOGIC_ATOMIC_BYTES * channel_count) == 0);
+               if (transfer->actual_length % (DSLOGIC_ATOMIC_BYTES * channel_count) != 0)
+                       sr_err("Invalid transfer length!");
                deinterleave_buffer(transfer->buffer, transfer->actual_length,
                        devc->deinterleave_buffer, channel_count, channel_mask);
 
@@ -1056,9 +1052,6 @@ SR_PRIV int dslogic_acquisition_start(const struct sr_dev_inst *sdi)
        struct libusb_transfer *transfer;
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        di = sdi->driver;
        drvc = di->context;
        devc = sdi->priv;