static int config_set(uint32_t key, GVariant *data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
- int ret;
enum sr_mq mq;
enum sr_mqflag mq_flags;
struct dev_context *devc;
devc = sdi->priv;
- ret = SR_OK;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
devc->limit_samples = g_variant_get_uint64(data);
mq = g_variant_get_uint32(tuple_child);
tuple_child = g_variant_get_child_value(data, 1);
mq_flags = g_variant_get_uint64(tuple_child);
- ret = hp_3457a_set_mq(sdi, mq, mq_flags);
g_variant_unref(tuple_child);
- break;
+ return hp_3457a_set_mq(sdi, mq, mq_flags);
case SR_CONF_ADC_POWERLINE_CYCLES:
- ret = hp_3457a_set_nplc(sdi, g_variant_get_double(data));
- break;
+ return hp_3457a_set_nplc(sdi, g_variant_get_double(data));
default:
- ret = SR_ERR_NA;
+ return SR_ERR_NA;
}
- return ret;
+ return SR_OK;
}
static int config_list(uint32_t key, GVariant **data,
return SR_ERR_ARG;
}
- devc->current_channel = devc->active_channels->data;
devc->num_active_channels = g_slist_length(devc->active_channels);
+ if (!devc->num_active_channels) {
+ sr_err("Need at least one active channel!");
+ g_slist_free(devc->active_channels);
+ return SR_ERR_ARG;
+ }
+ devc->current_channel = devc->active_channels->data;
hp_3457a_select_input(sdi, front_selected ? CONN_FRONT : CONN_REAR);