From: Martin Ling Date: Mon, 14 Apr 2014 20:32:01 +0000 (+0100) Subject: fx2lafw: pass sdi to command functions. X-Git-Tag: libsigrok-0.3.0~26 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a54edb1dfb44c863618779d42b03090de8711961;p=libsigrok.git fx2lafw: pass sdi to command functions. --- diff --git a/hardware/fx2lafw/api.c b/hardware/fx2lafw/api.c index 00b8ad5d..7bfbdad9 100644 --- a/hardware/fx2lafw/api.c +++ b/hardware/fx2lafw/api.c @@ -527,8 +527,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) /* Send header packet to the session bus. */ std_session_send_df_header(cb_data, LOG_PREFIX); - if ((ret = fx2lafw_command_start_acquisition(usb->devhdl, - devc->cur_samplerate, devc->sample_wide)) != SR_OK) { + if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) { fx2lafw_abort_acquisition(devc); return ret; } diff --git a/hardware/fx2lafw/protocol.c b/hardware/fx2lafw/protocol.c index 0d16e6c1..45e7837c 100644 --- a/hardware/fx2lafw/protocol.c +++ b/hardware/fx2lafw/protocol.c @@ -67,9 +67,10 @@ static int command_get_fw_version(libusb_device_handle *devhdl, return SR_OK; } -static int command_get_revid_version(libusb_device_handle *devhdl, - uint8_t *revid) +static int command_get_revid_version(struct sr_dev_inst *sdi, uint8_t *revid) { + struct sr_usb_dev_inst *usb = sdi->conn; + libusb_device_handle *devhdl = usb->devhdl; int ret; ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR | @@ -84,9 +85,13 @@ static int command_get_revid_version(libusb_device_handle *devhdl, return SR_OK; } -SR_PRIV int fx2lafw_command_start_acquisition(libusb_device_handle *devhdl, - uint64_t samplerate, gboolean samplewide) +SR_PRIV int fx2lafw_command_start_acquisition(const struct sr_dev_inst *sdi) { + struct dev_context *devc = sdi->priv; + struct sr_usb_dev_inst *usb = sdi->conn; + libusb_device_handle *devhdl = usb->devhdl; + uint64_t samplerate = devc->cur_samplerate; + gboolean samplewide = devc->sample_wide; struct cmd_start_acquisition cmd = { 0 }; int delay = 0, ret; @@ -255,7 +260,7 @@ SR_PRIV int fx2lafw_dev_open(struct sr_dev_inst *sdi, struct sr_dev_driver *di) break; } - ret = command_get_revid_version(usb->devhdl, &revid); + ret = command_get_revid_version(sdi, &revid); if (ret != SR_OK) { sr_err("Failed to get REVID."); break; diff --git a/hardware/fx2lafw/protocol.h b/hardware/fx2lafw/protocol.h index dc1c83ff..08e25899 100644 --- a/hardware/fx2lafw/protocol.h +++ b/hardware/fx2lafw/protocol.h @@ -98,8 +98,7 @@ struct dev_context { struct sr_context *ctx; }; -SR_PRIV int fx2lafw_command_start_acquisition(libusb_device_handle *devhdl, - uint64_t samplerate, gboolean samplewide); +SR_PRIV int fx2lafw_command_start_acquisition(const struct sr_dev_inst *sdi); SR_PRIV gboolean fx2lafw_check_conf_profile(libusb_device *dev); SR_PRIV int fx2lafw_dev_open(struct sr_dev_inst *sdi, struct sr_dev_driver *di); SR_PRIV int fx2lafw_configure_channels(const struct sr_dev_inst *sdi);