From: Martin Ling Date: Thu, 19 Mar 2015 22:00:34 +0000 (+0000) Subject: Use sr_dev_channel_enable(). X-Git-Tag: sigrok-cli-0.6.0~38 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=abb036855e8a35ddeaf7c8bcba02741d78bc25ba;p=sigrok-cli.git Use sr_dev_channel_enable(). --- diff --git a/main.c b/main.c index 8c957e9..4f2ff3c 100644 --- a/main.c +++ b/main.c @@ -50,6 +50,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 +61,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); }