X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=main.c;h=a53566e8960b31b24ce3b89e6e68edd5b62e841d;hp=8c957e9d50ed9532942e659cb30965e545cccf25;hb=662a1e27fa9573a35a6f9a6f699dee2be447826a;hpb=24278d3e7f6baeb32bcc6f52bc2e934d3a658b32 diff --git a/main.c b/main.c index 8c957e9..a53566e 100644 --- a/main.c +++ b/main.c @@ -17,9 +17,9 @@ * along with this program. If not, see . */ -#include "sigrok-cli.h" #include #include +#include "sigrok-cli.h" struct sr_context *sr_ctx = NULL; #ifdef HAVE_SRD @@ -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); }