X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flascar-el-usb%2Fapi.c;h=40670cec39f23daa292d4345a9411ed466bde971;hb=1c47e0da8f2571bc34dbdc368c3c1f55318c3aa0;hp=14273ce3d4fcfcb32fc7b391ef060ec0b0acb4e0;hpb=a95f142e88fa5368adfabf87544acfdeed7d7604;p=libsigrok.git diff --git a/src/hardware/lascar-el-usb/api.c b/src/hardware/lascar-el-usb/api.c index 14273ce3..40670cec 100644 --- a/src/hardware/lascar-el-usb/api.c +++ b/src/hardware/lascar-el-usb/api.c @@ -17,9 +17,10 @@ * along with this program. If not, see . */ +#include #include #include -#include "libsigrok.h" +#include #include "libsigrok-internal.h" #include "protocol.h" @@ -51,7 +52,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) GSList *usb_devices, *devices, *l; const char *conn; - drvc = di->priv; + drvc = di->context; conn = NULL; for (l = options; l; l = l->next) { @@ -90,7 +91,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) @@ -100,7 +101,7 @@ static int dev_open(struct sr_dev_inst *sdi) struct sr_usb_dev_inst *usb; int ret; - if (!(drvc = di->priv)) { + if (!(drvc = di->context)) { sr_err("Driver was not initialized."); return SR_ERR; } @@ -124,7 +125,7 @@ static int dev_close(struct sr_dev_inst *sdi) struct sr_dev_driver *di = sdi->driver; struct sr_usb_dev_inst *usb; - if (!di->priv) { + if (!di->context) { sr_err("Driver was not initialized."); return SR_ERR; } @@ -148,7 +149,7 @@ static int cleanup(const struct sr_dev_driver *di) int ret; struct drv_context *drvc; - if (!(drvc = di->priv)) + if (!(drvc = di->context)) /* Can get called on an unused driver, doesn't matter. */ return SR_OK; @@ -206,7 +207,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - if (!di->priv) { + if (!di->context) { sr_err("Driver was not initialized."); return SR_ERR; } @@ -252,7 +253,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * return SR_OK; } -static void mark_xfer(struct libusb_transfer *xfer) +static void LIBUSB_CALL mark_xfer(struct libusb_transfer *xfer) { if (xfer->status == LIBUSB_TRANSFER_COMPLETED) @@ -340,12 +341,12 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - if (!di->priv) { + if (!di->context) { sr_err("Driver was not initialized."); return SR_ERR; } - drvc = di->priv; + drvc = di->context; devc = sdi->priv; usb = sdi->conn; devc->cb_data = cb_data; @@ -355,7 +356,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) sr_dbg("Starting log retrieval."); - /* Send header packet to the session bus. */ std_session_send_df_header(cb_data, LOG_PREFIX); interval = (devc->config[0x1c] | (devc->config[0x1d] << 8)) * 1000; @@ -368,8 +368,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) if (devc->logged_samples == 0) { /* This ensures the frontend knows the session is done. */ - packet.type = SR_DF_END; - sr_session_send(devc->cb_data, &packet); + std_session_send_df_end(devc->cb_data, LOG_PREFIX); return SR_OK; } @@ -415,7 +414,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv); } if (xfer_in->user_data != GINT_TO_POINTER(1) || - xfer_in->user_data != GINT_TO_POINTER(1)) { + xfer_out->user_data != GINT_TO_POINTER(1)) { sr_dbg("no response to log transfer request"); libusb_free_transfer(xfer_in); libusb_free_transfer(xfer_out); @@ -451,7 +450,7 @@ SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) struct sr_dev_driver *di = sdi->driver; (void)cb_data; - if (!di->priv) { + if (!di->context) { sr_err("Driver was not initialized."); return SR_ERR; } @@ -483,5 +482,5 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = { .dev_close = dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };