]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/scpi-pps/api.c
scpi-pps: Populate sdi->serial_num and fix hw_info mem leak
[libsigrok.git] / src / hardware / scpi-pps / api.c
index 813bf7f375aeeffefdc044a4220696430e1fe4f0..412d94eef271f442624ec1a25ee90d5b84321de0 100644 (file)
@@ -88,6 +88,11 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        sdi->conn = scpi;
        sdi->driver = di;
        sdi->inst_type = SR_INST_SCPI;
+       sdi->serial_num = g_strdup(hw_info->serial_number);
+
+       sr_scpi_hw_info_free(hw_info);
+       hw_info = NULL;
+
        devc = g_malloc0(sizeof(struct dev_context));
        devc->device = device;
        sdi->priv = devc;
@@ -507,9 +512,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
        std_session_send_df_header(sdi, LOG_PREFIX);
 
        /* Prime the pipe with the first channel's fetch. */
-       ch = sdi->channels->data;
+       ch = next_enabled_channel(sdi, NULL);
        pch = ch->priv;
-       select_channel(sdi, ch);
+       if ((ret = select_channel(sdi, ch)) != SR_OK)
+               return ret;
        if (pch->mq == SR_MQ_VOLTAGE)
                cmd = SCPI_CMD_GET_MEAS_VOLTAGE;
        else if (pch->mq == SR_MQ_CURRENT)