]> sigrok.org Git - libsigrok.git/commitdiff
demo: Drop previous "default enabled" logic (experiment remainder)
authorGerhard Sittig <redacted>
Sun, 11 Jun 2017 19:02:57 +0000 (21:02 +0200)
committerUwe Hermann <redacted>
Fri, 23 Jun 2017 17:33:24 +0000 (19:33 +0200)
A previous implementation of the demo driver supported the creation of
larger channel counts yet only enabling part of them by default. This
was kind of pointless, I just was not aware of the available scan
options.

Drop the "enabled channels" limitation, enable all channels that get
created (like the implementation before the experiment did), and create
as many channels as was compiled in by default or later got specified
by scan options.

src/hardware/demo/api.c

index 9c1b7c4466590a7975565b3652e46f7ab6b1dfe8..1f2e950ef4a71bd8122d9fe82a66ce2aa382d31e 100644 (file)
 #include "protocol.h"
 
 #define DEFAULT_NUM_LOGIC_CHANNELS     8
-#define DEFAULT_ENABLED_LOGIC_CHANNELS 8
 #define DEFAULT_LOGIC_PATTERN          PATTERN_SIGROK
 
 #define DEFAULT_NUM_ANALOG_CHANNELS    4
-#define DEFAULT_ENABLED_ANALOG_CHANNELS        4
 #define DEFAULT_ANALOG_AMPLITUDE       10
 
 /* Note: No spaces allowed because of sigrok-cli. */
@@ -98,7 +96,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        GSList *l;
        int num_logic_channels, num_analog_channels, pattern, i;
        char channel_name[16];
-       gboolean enabled;
 
        num_logic_channels = DEFAULT_NUM_LOGIC_CHANNELS;
        num_analog_channels = DEFAULT_NUM_ANALOG_CHANNELS;
@@ -131,8 +128,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                cg->name = g_strdup("Logic");
                for (i = 0; i < num_logic_channels; i++) {
                        sprintf(channel_name, "D%d", i);
-                       enabled = (i < DEFAULT_ENABLED_LOGIC_CHANNELS) ? TRUE : FALSE;
-                       ch = sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, enabled, channel_name);
+                       ch = sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_name);
                        cg->channels = g_slist_append(cg->channels, ch);
                }
                sdi->channel_groups = g_slist_append(NULL, cg);
@@ -149,9 +145,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                devc->ch_ag = g_hash_table_new(g_direct_hash, g_direct_equal);
                for (i = 0; i < num_analog_channels; i++) {
                        snprintf(channel_name, 16, "A%d", i);
-                       enabled = (i < DEFAULT_ENABLED_ANALOG_CHANNELS) ? TRUE : FALSE;
                        ch = sr_channel_new(sdi, i + num_logic_channels, SR_CHANNEL_ANALOG,
-                                       enabled, channel_name);
+                                       TRUE, channel_name);
                        acg->channels = g_slist_append(acg->channels, ch);
 
                        /* Every analog channel gets its own channel group as well. */