rigol-ds: config_set: Move error printing to wrapper.

This commit is contained in:
Uwe Hermann 2017-07-21 09:14:48 +02:00
parent 0f8bee7162
commit 9e411f4be8
2 changed files with 7 additions and 9 deletions

View File

@ -744,10 +744,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
}
break;
case SR_CONF_VDIV:
if (!cg) {
sr_err("No channel group specified.");
if (!cg)
return SR_ERR_CHANNEL_GROUP;
}
g_variant_get(data, "(tt)", &p, &q);
for (i = 0; i < devc->model->analog_channels; i++) {
if (cg == devc->analog_groups[i]) {
@ -767,10 +765,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
sr_dbg("Didn't set vdiv, unknown channel(group).");
return SR_ERR_NA;
case SR_CONF_COUPLING:
if (!cg) {
sr_err("No channel group specified.");
if (!cg)
return SR_ERR_CHANNEL_GROUP;
}
tmp_str = g_variant_get_string(data, NULL);
for (i = 0; i < devc->model->analog_channels; i++) {
if (cg == devc->analog_groups[i]) {
@ -789,10 +785,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
sr_dbg("Didn't set coupling, unknown channel(group).");
return SR_ERR_NA;
case SR_CONF_PROBE_FACTOR:
if (!cg) {
sr_err("No channel group specified.");
if (!cg)
return SR_ERR_CHANNEL_GROUP;
}
p = g_variant_get_uint64(data);
for (i = 0; i < devc->model->analog_channels; i++) {
if (cg == devc->analog_groups[i]) {

View File

@ -820,6 +820,10 @@ SR_API int sr_config_set(const struct sr_dev_inst *sdi,
g_variant_unref(data);
if (ret == SR_ERR_CHANNEL_GROUP)
sr_err("%s: No channel group specified.",
(sdi) ? sdi->driver->name : "unknown");
return ret;
}