From: Uwe Hermann Date: Fri, 21 Jul 2017 07:14:48 +0000 (+0200) Subject: rigol-ds: config_set: Move error printing to wrapper. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9e411f4be85302b9623e597c142f11268745812e;p=libsigrok.git rigol-ds: config_set: Move error printing to wrapper. --- diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index c39e10c8..272059ae 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -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]) { diff --git a/src/hwdriver.c b/src/hwdriver.c index 41f71abe..cad75e13 100644 --- a/src/hwdriver.c +++ b/src/hwdriver.c @@ -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; }