X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ffx2lafw%2Fapi.c;h=b9123513c49ade9ac38726ad62cd9a0080d19cba;hb=e57057aee778e723da572a6b5e2bd01526cc7beb;hp=da560d86e0702935e3a16fdbbb8ed47263c39bea;hpb=b7c53d48a8170dc07bee1bafb481db3e2ea38e14;p=libsigrok.git diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index da560d86..b9123513 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -18,6 +18,7 @@ * along with this program. If not, see . */ +#include #include "protocol.h" #include "dslogic.h" @@ -193,7 +194,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) const char *conn; char manufacturer[64], product[64], serial_num[64], connection_id[64]; - drvc = di->priv; + drvc = di->context; conn = NULL; for (l = options; l; l = l->next) { @@ -227,11 +228,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) continue; } - if ((ret = libusb_get_device_descriptor( devlist[i], &des)) != 0) { - sr_warn("Failed to get device descriptor: %s.", - libusb_error_name(ret)); - continue; - } + libusb_get_device_descriptor( devlist[i], &des); if ((ret = libusb_open(devlist[i], &hdl)) < 0) continue; @@ -355,7 +352,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *dev_list(const struct sr_dev_driver *di) { - return ((struct drv_context *)(di->priv))->instances; + return ((struct drv_context *)(di->context))->instances; } static int dev_open(struct sr_dev_inst *sdi) @@ -468,7 +465,7 @@ static int cleanup(const struct sr_dev_driver *di) int ret; struct drv_context *drvc; - if (!(drvc = di->priv)) + if (!(drvc = di->context)) return SR_OK; ret = std_dev_clear(di, NULL); @@ -658,8 +655,6 @@ static int start_transfers(const struct sr_dev_inst *sdi) } else devc->trigger_fired = TRUE; - timeout = fx2lafw_get_timeout(devc); - num_transfers = fx2lafw_get_number_of_transfers(devc); size = fx2lafw_get_buffer_size(devc); devc->submitted_transfers = 0; @@ -764,7 +759,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) return SR_ERR_DEV_CLOSED; di = sdi->driver; - drvc = di->priv; + drvc = di->context; devc = sdi->priv; devc->ctx = drvc->sr_ctx; @@ -778,11 +773,12 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) if (devc->dslogic) { dslogic_trigger_request(sdi); - } - else { - if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) - return ret; + } else { start_transfers(sdi); + if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) { + fx2lafw_abort_acquisition(devc); + return ret; + } } return SR_OK; @@ -813,5 +809,5 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = { .dev_close = dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };