]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hameg-hmo/api.c
hameg-hmo: Map logic data from second digital pod to channels D8-D15
[libsigrok.git] / src / hardware / hameg-hmo / api.c
index f47489315d903f63a9515bc1ba09ee43b639f1f7..00d57c5ef3a8d103877b11a041a9189b9dc469ba 100644 (file)
@@ -707,7 +707,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 {
        GSList *l;
        gboolean digital_added[MAX_DIGITAL_GROUP_COUNT];
-       size_t group;
+       size_t group, pod_count;
        struct sr_channel *ch;
        struct dev_context *devc;
        struct sr_scpi_dev_inst *scpi;
@@ -726,8 +726,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        devc->enabled_channels = NULL;
 
        /*
-        * Contruct the list of enabled channels.
+        * Contruct the list of enabled channels. Determine the highest
+        * number of digital pods involved in the acquisition.
         */
+       pod_count = 0;
        for (l = sdi->channels; l; l = l->next) {
                ch = l->data;
                if (!ch->enabled)
@@ -737,12 +739,17 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
                if (ch->type != SR_CHANNEL_LOGIC || !digital_added[group]) {
                        devc->enabled_channels = g_slist_append(
                                        devc->enabled_channels, ch);
-                       if (ch->type == SR_CHANNEL_LOGIC)
+                       if (ch->type == SR_CHANNEL_LOGIC) {
                                digital_added[group] = TRUE;
+                               if (pod_count < group + 1)
+                                       pod_count = group + 1;
+                       }
                }
        }
        if (!devc->enabled_channels)
                return SR_ERR;
+       devc->pod_count = pod_count;
+       devc->logic_data = NULL;
 
        /*
         * Check constraints. Some channels can be either analog or