]> sigrok.org Git - libsigrok.git/blobdiff - hardware/saleae-logic16/api.c
saleae-logic16: Use unitsize 1 if none of channels 8-15 are used.
[libsigrok.git] / hardware / saleae-logic16 / api.c
index 438d91a4501137067d9c5f4d8250e8210522818e..130c579744e14196b1968b205a8d6e540e73fe63 100644 (file)
@@ -195,7 +195,7 @@ static GSList *scan(GSList *options)
                sdi->driver = di;
 
                for (j = 0; channel_names[j]; j++) {
-                       if (!(ch = sr_probe_new(j, SR_PROBE_LOGIC, TRUE,
+                       if (!(ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
                                                   channel_names[j])))
                                return NULL;
                        sdi->channels = g_slist_append(sdi->channels, ch);
@@ -653,6 +653,17 @@ static int configure_channels(const struct sr_dev_inst *sdi)
                devc->channel_masks[devc->num_channels++] = channel_bit;
        }
 
+       if (devc->cur_channels & ~0xff) {
+               devc->unitsize = 2;
+       } else {
+#ifdef WORDS_BIGENDIAN
+               int i;
+               for (i=0; i<devc->num_channels; i++)
+                       devc->channel_masks[i] >>= 8;
+#endif
+               devc->unitsize = 1;
+       }
+
        return SR_OK;
 }