Fixes bug #1279.
struct sr_analog_spec spec;
struct sr_dev_inst *sdi;
int channel_group_cmd;
- char *channel_group_name;
+ const char *channel_group_name;
struct pps_channel *pch;
const struct channel_spec *ch_spec;
int ret;
if (!(devc = sdi->priv))
return TRUE;
+ pch = devc->cur_acquisition_channel->priv;
+
channel_group_cmd = 0;
channel_group_name = NULL;
if (g_slist_length(sdi->channel_groups) > 1) {
channel_group_cmd = SCPI_CMD_SELECT_CHANNEL;
- channel_group_name = g_strdup(devc->cur_acquisition_channel->name);
+ channel_group_name = pch->hwname;
}
- pch = devc->cur_acquisition_channel->priv;
if (pch->mq == SR_MQ_VOLTAGE) {
gvtype = G_VARIANT_TYPE_DOUBLE;
cmd = SCPI_CMD_GET_MEAS_VOLTAGE;
ret = sr_scpi_cmd_resp(sdi, devc->device->commands,
channel_group_cmd, channel_group_name, &gvdata, gvtype, cmd);
- g_free(channel_group_name);
if (ret != SR_OK)
return ret;
}
analog.meaning->mqflags = SR_MQFLAG_DC;
f = (float)g_variant_get_double(gvdata);
+ g_variant_unref(gvdata);
analog.data = &f;
sr_session_send(sdi, &packet);
g_slist_free(analog.meaning->channels);
/* Only used for quirk workarounds, notably the Rigol DS1000 series. */
uint64_t firmware_version;
GMutex scpi_mutex;
- const char *actual_channel_name;
+ char *actual_channel_name;
};
SR_PRIV GSList *sr_scpi_scan(struct drv_context *drvc, GSList *options,
scpi->free(scpi->priv);
g_free(scpi->priv);
+ g_free(scpi->actual_channel_name);
g_free(scpi);
}
if (channel_cmd && channel_name &&
g_strcmp0(channel_name, scpi->actual_channel_name)) {
sr_spew("sr_scpi_cmd(): new channel = %s", channel_name);
- scpi->actual_channel_name = channel_name;
+ g_free(scpi->actual_channel_name);
+ scpi->actual_channel_name = g_strdup(channel_name);
ret = scpi_send(scpi, channel_cmd, channel_name);
if (ret != SR_OK)
return ret;
if (channel_cmd && channel_name &&
g_strcmp0(channel_name, scpi->actual_channel_name)) {
sr_spew("sr_scpi_cmd_get(): new channel = %s", channel_name);
- scpi->actual_channel_name = channel_name;
+ g_free(scpi->actual_channel_name);
+ scpi->actual_channel_name = g_strdup(channel_name);
ret = scpi_send(scpi, channel_cmd, channel_name);
if (ret != SR_OK)
return ret;