From: Uwe Hermann Date: Tue, 25 Jul 2017 20:53:02 +0000 (+0200) Subject: drivers: Move SR_ERR_CHANNEL_GROUP log messages to wrappers. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=87dc5410273abf9307dc25a2528a6aa98a8ae44b;p=libsigrok.git drivers: Move SR_ERR_CHANNEL_GROUP log messages to wrappers. --- diff --git a/src/hardware/hameg-hmo/api.c b/src/hardware/hameg-hmo/api.c index a1969c6a..994c43e1 100644 --- a/src/hardware/hameg-hmo/api.c +++ b/src/hardware/hameg-hmo/api.c @@ -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); diff --git a/src/hardware/yokogawa-dlm/api.c b/src/hardware/yokogawa-dlm/api.c index f6f0ce8a..b6c468e3 100644 --- a/src/hardware/yokogawa-dlm/api.c +++ b/src/hardware/yokogawa-dlm/api.c @@ -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); diff --git a/src/hwdriver.c b/src/hwdriver.c index cad75e13..fe86fadb 100644 --- a/src/hwdriver.c +++ b/src/hwdriver.c @@ -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; }