]> sigrok.org Git - libsigrok.git/commitdiff
drivers: Move SR_ERR_CHANNEL_GROUP log messages to wrappers.
authorUwe Hermann <redacted>
Tue, 25 Jul 2017 20:53:02 +0000 (22:53 +0200)
committerUwe Hermann <redacted>
Mon, 31 Jul 2017 14:23:31 +0000 (16:23 +0200)
src/hardware/hameg-hmo/api.c
src/hardware/yokogawa-dlm/api.c
src/hwdriver.c

index a1969c6a9c770fa3d24d9b13e36875ce1add0677..994c43e1a0fc8c6e3be81dee19c01169884e1826 100644 (file)
@@ -195,7 +195,6 @@ static int config_get(uint32_t key, GVariant **data,
                break;
        case SR_CONF_NUM_VDIV:
                if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
                        return SR_ERR_CHANNEL_GROUP;
                } else if (cg_type == CG_ANALOG) {
                        for (i = 0; i < model->analog_channels; i++) {
@@ -212,7 +211,6 @@ static int config_get(uint32_t key, GVariant **data,
                break;
        case SR_CONF_VDIV:
                if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
                        return SR_ERR_CHANNEL_GROUP;
                } else if (cg_type == CG_ANALOG) {
                        for (i = 0; i < model->analog_channels; i++) {
@@ -243,7 +241,6 @@ static int config_get(uint32_t key, GVariant **data,
                break;
        case SR_CONF_COUPLING:
                if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
                        return SR_ERR_CHANNEL_GROUP;
                } else if (cg_type == CG_ANALOG) {
                        for (i = 0; i < model->analog_channels; i++) {
@@ -317,10 +314,8 @@ static int config_set(uint32_t key, GVariant *data,
                }
                break;
        case SR_CONF_VDIV:
-               if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
+               if (cg_type == CG_NONE)
                        return SR_ERR_CHANNEL_GROUP;
-               }
 
                g_variant_get(data, "(tt)", &p, &q);
 
@@ -400,10 +395,8 @@ static int config_set(uint32_t key, GVariant *data,
                }
                break;
        case SR_CONF_COUPLING:
-               if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
+               if (cg_type == CG_NONE)
                        return SR_ERR_CHANNEL_GROUP;
-               }
 
                tmp = g_variant_get_string(data, NULL);
 
index f6f0ce8a6d7c756e993470fadda51c40c974208e..b6c468e3e32ae811463cb6cae1674c6fa9671a03 100644 (file)
@@ -215,7 +215,6 @@ static int config_get(uint32_t key, GVariant **data,
                break;
        case SR_CONF_NUM_VDIV:
                if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
                        return SR_ERR_CHANNEL_GROUP;
                } else if (cg_type == CG_ANALOG) {
                                *data = g_variant_new_int32(model->num_ydivs);
@@ -228,7 +227,6 @@ static int config_get(uint32_t key, GVariant **data,
        case SR_CONF_VDIV:
                ret = SR_ERR_NA;
                if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
                        return SR_ERR_CHANNEL_GROUP;
                } else if (cg_type != CG_ANALOG)
                        break;
@@ -258,7 +256,6 @@ static int config_get(uint32_t key, GVariant **data,
        case SR_CONF_COUPLING:
                ret = SR_ERR_NA;
                if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
                        return SR_ERR_CHANNEL_GROUP;
                } else if (cg_type != CG_ANALOG)
                        break;
@@ -325,10 +322,8 @@ static int config_set(uint32_t key, GVariant *data,
                }
                break;
        case SR_CONF_VDIV:
-               if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
+               if (cg_type == CG_NONE)
                        return SR_ERR_CHANNEL_GROUP;
-               }
 
                g_variant_get(data, "(tt)", &p, &q);
 
@@ -397,10 +392,8 @@ static int config_set(uint32_t key, GVariant *data,
                ret = dlm_trigger_slope_set(sdi->conn, state->trigger_slope);
                break;
        case SR_CONF_COUPLING:
-               if (cg_type == CG_NONE) {
-                       sr_err("No channel group specified.");
+               if (cg_type == CG_NONE)
                        return SR_ERR_CHANNEL_GROUP;
-               }
 
                tmp = g_variant_get_string(data, NULL);
 
index cad75e13b0800246f35f9ecfcdebdb5f22c5bb0e..fe86fadbd27fb51c8736e9b57af3a14654a5b981 100644 (file)
@@ -772,6 +772,10 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver,
                g_variant_ref_sink(*data);
        }
 
+       if (ret == SR_ERR_CHANNEL_GROUP)
+               sr_err("%s: No channel group specified.",
+                       (sdi) ? sdi->driver->name : "unknown");
+
        return ret;
 }