]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: config_set: Move error printing to wrapper.
authorUwe Hermann <redacted>
Fri, 21 Jul 2017 07:14:48 +0000 (09:14 +0200)
committerUwe Hermann <redacted>
Fri, 21 Jul 2017 15:06:40 +0000 (17:06 +0200)
src/hardware/rigol-ds/api.c
src/hwdriver.c

index c39e10c80229294afc1dc4d1165059ee9befcb40..272059aeeb97ebd68b00b25b33dfa6f169e31ec8 100644 (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]) {
index 41f71abeef61b3018ab94c395383f98ad696acf3..cad75e13b0800246f35f9ecfcdebdb5f22c5bb0e 100644 (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;
 }