X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=main.c;h=4f2ff3ce6566d8421f14217f025e5eb12f929497;hp=8c957e9d50ed9532942e659cb30965e545cccf25;hb=3d24ca2da53f03585db396e67252a7dcd9e67e6e;hpb=24278d3e7f6baeb32bcc6f52bc2e934d3a658b32 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); }