From: Gerhard Sittig Date: Sun, 4 Feb 2018 22:17:39 +0000 (+0100) Subject: output/vcd: assume packed input data image, unbreak 2nd+ channel X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=aa0979482f6e7c269609bb2c22d7d75a2845ac75;p=libsigrok.git output/vcd: assume packed input data image, unbreak 2nd+ channel 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. --- diff --git a/src/output/vcd.c b/src/output/vcd.c index db77a7ad..d0b14a04 100644 --- a/src/output/vcd.c +++ b/src/output/vcd.c @@ -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;