X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=main.c;h=51053bc9a8a3ed2135622ffd7f841eff8d1d91d7;hb=2620358aec3debcf4db81709927e8bb787d08b9b;hp=8c957e9d50ed9532942e659cb30965e545cccf25;hpb=24278d3e7f6baeb32bcc6f52bc2e934d3a658b32;p=sigrok-cli.git diff --git a/main.c b/main.c index 8c957e9..51053bc 100644 --- a/main.c +++ b/main.c @@ -17,9 +17,10 @@ * along with this program. If not, see . */ -#include "sigrok-cli.h" +#include #include #include +#include "sigrok-cli.h" struct sr_context *sr_ctx = NULL; #ifdef HAVE_SRD @@ -50,6 +51,7 @@ static void logger(const gchar *log_domain, GLogLevelFlags log_level, int select_channels(struct sr_dev_inst *sdi) { struct sr_channel *ch; + gboolean enabled; GSList *selected_channels, *l, *channels; channels = sr_dev_inst_channels_get(sdi); @@ -60,10 +62,9 @@ int select_channels(struct sr_dev_inst *sdi) for (l = channels; l; l = l->next) { ch = l->data; - if (g_slist_find(selected_channels, ch)) - ch->enabled = TRUE; - else - ch->enabled = FALSE; + enabled = (g_slist_find(selected_channels, ch) != NULL); + if (sr_dev_channel_enable(ch, enabled) != SR_OK) + return SR_ERR; } g_slist_free(selected_channels); } @@ -136,7 +137,7 @@ static void get_option(void) { struct sr_dev_inst *sdi; struct sr_channel_group *cg; - const struct sr_config_info *ci; + const struct sr_key_info *ci; GSList *devices; GVariant *gvar; GHashTable *devargs; @@ -159,7 +160,7 @@ static void get_option(void) } cg = select_channel_group(sdi); - if (!(ci = sr_config_info_name_get(opt_get))) + if (!(ci = sr_key_info_name_get(SR_KEY_CONFIG, opt_get))) g_critical("Unknown option '%s'", opt_get); if ((devargs = parse_generic_arg(opt_config, FALSE)))