]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/fx2lafw/api.c
rigol-ds: Fix wrong channel group malloc size.
[libsigrok.git] / src / hardware / fx2lafw / api.c
index 1e6d40114de5298ac221fd6afe0de6e347b46e83..8e9b5be4a6688651b28096461b931ceb3b9e9efe 100644 (file)
@@ -171,7 +171,6 @@ static GSList *scan(GSList *options)
        struct dev_context *devc;
        struct sr_dev_inst *sdi;
        struct sr_usb_dev_inst *usb;
-       struct sr_channel *ch;
        struct sr_config *src;
        const struct fx2lafw_profile *prof;
        GSList *l, *devices, *conn_devices;
@@ -288,11 +287,9 @@ static GSList *scan(GSList *options)
 
                /* Fill in channellist according to this device's profile. */
                num_logic_channels = prof->dev_caps & DEV_CAPS_16BIT ? 16 : 8;
-               for (j = 0; j < num_logic_channels; j++) {
-                       ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
+               for (j = 0; j < num_logic_channels; j++)
+                       sr_channel_new(sdi, j, SR_CHANNEL_LOGIC, TRUE,
                                        channel_names[j]);
-                       sdi->channels = g_slist_append(sdi->channels, ch);
-               }
 
                devc = fx2lafw_dev_new();
                devc->profile = prof;
@@ -626,7 +623,6 @@ static int start_transfers(const struct sr_dev_inst *sdi)
        devc = sdi->priv;
        usb = sdi->conn;
 
-       devc->cb_data = cb_data;
        devc->sent_samples = 0;
        devc->acq_aborted = FALSE;
        devc->empty_transfer_count = 0;
@@ -679,9 +675,7 @@ static int start_transfers(const struct sr_dev_inst *sdi)
        }
 
        /* Send header packet to the session bus. */
-       std_session_send_df_header(devc->cb_data, LOG_PREFIX);
-
-       usb_source_add(sdi->session, devc->ctx, timeout, receive_data, NULL);
+       std_session_send_df_header(sdi, LOG_PREFIX);
 
        return SR_OK;
 }
@@ -751,12 +745,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        drvc = di->priv;
        devc = sdi->priv;
 
-       /* Configures devc->trigger_* and devc->sample_wide */
-       if (fx2lafw_configure_channels(sdi) != SR_OK) {
-               sr_err("Failed to configure channels.");
-               return SR_ERR;
-       }
-
        devc->ctx = drvc->sr_ctx;
        devc->cb_data = cb_data;
        devc->sent_samples = 0;
@@ -764,7 +752,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        devc->acq_aborted = FALSE;
 
        timeout = fx2lafw_get_timeout(devc);
-       usb_source_add(devc->ctx, timeout, receive_data, NULL);
+       usb_source_add(sdi->session, devc->ctx, timeout, receive_data, NULL);
 
        if (devc->dslogic) {
                dslogic_trigger_request(sdi);