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)
usb = sdi->conn;
if (!usb->devhdl)
- /* Nothing to do. */
- return SR_OK;
+ return SR_ERR_BUG;
/* This allows a frontend to configure the device without ever
* doing an acquisition step. */
libusb_release_interface(usb->devhdl, USB_INTERFACE);
libusb_close(usb->devhdl);
usb->devhdl = NULL;
- sdi->status = SR_ST_INACTIVE;
return SR_OK;
}
(void)cg;
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
devc = sdi->priv;
ret = SR_OK;
switch (key) {
int req_len, buf_len, len, ret;
unsigned char buf[9];
- if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR_DEV_CLOSED;
-
drvc = di->context;
devc = sdi->priv;
usb = sdi->conn;
devc->num_samples = 0;
- std_session_send_df_header(sdi, LOG_PREFIX);
+ std_session_send_df_header(sdi);
if (devc->data_source == DATA_SOURCE_LIVE) {
/* Force configuration. */
devc->stored_samples = (buf[7] << 8) | buf[8];
if (devc->stored_samples == 0) {
/* Notify frontend of empty log by sending start/end packets. */
- std_session_send_df_end(sdi, LOG_PREFIX);
+ std_session_send_df_end(sdi);
return SR_OK;
}
{
struct dev_context *devc;
- 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;