return SR_OK;
}
-static void abort_acquisition(struct dev_context *devc)
-{
- if (devc->transfer)
- libusb_cancel_transfer(devc->transfer);
-}
-
static int configure_channels(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
devc->ctx = drvc->sr_ctx;
if ((ret = la2016_start_acquisition(sdi)) != SR_OK) {
- abort_acquisition(devc);
+ la2016_abort_acquisition(sdi);
return ret;
}
int ret;
ret = la2016_abort_acquisition(sdi);
- abort_acquisition(sdi->priv);
return ret;
}
SR_PRIV int la2016_start_acquisition(const struct sr_dev_inst *sdi)
{
- return set_run_mode(sdi, 3);
+ int ret;
+
+ ret = set_run_mode(sdi, 3);
+ if (ret != SR_OK)
+ return ret;
+
+ return SR_OK;
}
-SR_PRIV int la2016_stop_acquisition(const struct sr_dev_inst *sdi)
+static int la2016_stop_acquisition(const struct sr_dev_inst *sdi)
{
- return set_run_mode(sdi, 0);
+ int ret;
+
+ ret = set_run_mode(sdi, 0);
+ if (ret != SR_OK)
+ return ret;
+
+ return SR_OK;
}
SR_PRIV int la2016_abort_acquisition(const struct sr_dev_inst *sdi)
{
- return la2016_stop_acquisition(sdi);
+ int ret;
+ struct dev_context *devc;
+
+ ret = la2016_stop_acquisition(sdi);
+ if (ret != SR_OK)
+ return ret;
+
+ devc = sdi ? sdi->priv : NULL;
+ if (devc && devc->transfer)
+ libusb_cancel_transfer(devc->transfer);
+
+ return SR_OK;
}
-SR_PRIV int la2016_has_triggered(const struct sr_dev_inst *sdi)
+static int la2016_has_triggered(const struct sr_dev_inst *sdi)
{
uint16_t state;
return (state & 0x3) == 1;
}
-SR_PRIV int la2016_start_retrieval(const struct sr_dev_inst *sdi, libusb_transfer_cb_fn cb)
+static int la2016_start_retrieval(const struct sr_dev_inst *sdi, libusb_transfer_cb_fn cb)
{
struct dev_context *devc;
struct sr_usb_dev_inst *usb;
SR_PRIV int la2016_upload_firmware(struct sr_context *sr_ctx, libusb_device *dev, uint16_t product_id);
SR_PRIV int la2016_setup_acquisition(const struct sr_dev_inst *sdi);
SR_PRIV int la2016_start_acquisition(const struct sr_dev_inst *sdi);
-SR_PRIV int la2016_stop_acquisition(const struct sr_dev_inst *sdi);
SR_PRIV int la2016_abort_acquisition(const struct sr_dev_inst *sdi);
-SR_PRIV int la2016_has_triggered(const struct sr_dev_inst *sdi);
-SR_PRIV int la2016_start_retrieval(const struct sr_dev_inst *sdi, libusb_transfer_cb_fn cb);
SR_PRIV int la2016_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int la2016_init_device(const struct sr_dev_inst *sdi);
SR_PRIV int la2016_deinit_device(const struct sr_dev_inst *sdi);