]> sigrok.org Git - libsigrok.git/commitdiff
fx2lafw: pass sdi to command functions.
authorMartin Ling <redacted>
Mon, 14 Apr 2014 20:32:01 +0000 (21:32 +0100)
committerBert Vermeulen <redacted>
Wed, 30 Apr 2014 20:57:22 +0000 (13:57 -0700)
hardware/fx2lafw/api.c
hardware/fx2lafw/protocol.c
hardware/fx2lafw/protocol.h

index 00b8ad5d0eefc6b78736bd92bed99dbd271e017f..7bfbdad934e809ea56d2c0383eca57170dafe16d 100644 (file)
@@ -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;
        }
index 0d16e6c11166aca69e21d1cfdb0eedd3d8646d8c..45e7837c182c916c607af3569b4f1da86d0f950d 100644 (file)
@@ -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;
index dc1c83ff62098f2895737b20c0c6eaad7df84e52..08e2589946de6d0d6c6f53a8ae15598652b833ad 100644 (file)
@@ -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);