]> sigrok.org Git - sigrok-cli.git/commitdiff
Use sr_dev_channel_enable().
authorMartin Ling <redacted>
Thu, 19 Mar 2015 22:00:34 +0000 (22:00 +0000)
committerUwe Hermann <redacted>
Sat, 21 Mar 2015 15:39:56 +0000 (16:39 +0100)
main.c

diff --git a/main.c b/main.c
index 8c957e9d50ed9532942e659cb30965e545cccf25..4f2ff3ce6566d8421f14217f025e5eb12f929497 100644 (file)
--- 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);
        }