]> sigrok.org Git - sigrok-cli.git/blobdiff - main.c
Various #include file cosmetic fixes.
[sigrok-cli.git] / main.c
diff --git a/main.c b/main.c
index 8c957e9d50ed9532942e659cb30965e545cccf25..a53566e8960b31b24ce3b89e6e68edd5b62e841d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -17,9 +17,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "sigrok-cli.h"
 #include <stdlib.h>
 #include <glib.h>
 #include <stdlib.h>
 #include <glib.h>
+#include "sigrok-cli.h"
 
 struct sr_context *sr_ctx = NULL;
 #ifdef HAVE_SRD
 
 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;
 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);
        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;
 
                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);
        }
                }
                g_slist_free(selected_channels);
        }