]> sigrok.org Git - libsigrok.git/commitdiff
output/vcd: assume packed input data image, unbreak 2nd+ channel
authorGerhard Sittig <redacted>
Sun, 4 Feb 2018 22:17:39 +0000 (23:17 +0100)
committerUwe Hermann <redacted>
Fri, 9 Feb 2018 21:40:58 +0000 (22:40 +0100)
The previous implementation only emitted data for the first enabled
channels, and "saw no changes" after emission of the initial value for
channels on positions that followed a disabled channel.

Assume that the received data from the session bus communicates the bits
of enabled channels in a packed representation. Skip the mapping of
output bit indices to sigrok channel numbers.

This fixes the remaining part of bug #519.

Tested by inspecting in gtkwave the result of command:
  $ sigrok-cli -d demo -C D1,D3,D6 -c samplerate=2M --samples 2500 -O vcd -o trace.vcd

When we find that all input sources (device drivers, and input modules)
provide a dense bit field, all of the mapping logic can get removed
here. This commit just quickly disables the logic.

src/output/vcd.c

index db77a7adeddf09cb37c6c6be9b7745a4de69d6c4..d0b14a04d26f1ba661d57949a52fcbb0a9aba3b3 100644 (file)
@@ -200,7 +200,16 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
                        timestamp_written = FALSE;
 
                        for (p = 0; p < ctx->num_enabled_channels; p++) {
-                               index = ctx->channel_index[p];
+                               /*
+                                * TODO Check whether the mapping from
+                                * data image positions to channel numbers
+                                * is required. Experiments suggest that
+                                * the data image "is dense", and packs
+                                * bits of enabled channels, and leaves no
+                                * room for positions of disabled channels.
+                                */
+                               /* index = ctx->channel_index[p]; */
+                               index = p;
 
                                curbit = ((unsigned)sample[index / 8]
                                                >> (index % 8)) & 1;