From: Wolfram Sang Date: Thu, 11 May 2017 11:51:10 +0000 (+0200) Subject: output/csv: get proper index for input channels X-Git-Tag: libsigrok-0.5.0~66 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=10892c5b8aa54bee29e908ab457180ca8cdb1011 output/csv: get proper index for input channels 'j' is the loop variable for channels, not 'ch'. This fixes parts of bug #844. Signed-off-by: Wolfram Sang --- diff --git a/src/output/csv.c b/src/output/csv.c index dd94f28d..831208dc 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -380,7 +380,7 @@ static void process_logic(struct context *ctx, if (ctx->channels[j].ch->type == SR_CHANNEL_LOGIC) { for (i = 0; i < num_samples; i++) { sample = logic->data + i * logic->unitsize; - idx = ctx->channels[ch].ch->index; + idx = ctx->channels[j].ch->index; if (ctx->label_do && !ctx->label_names) ctx->channels[j].label = "logic"; ctx->logic_samples[i * ctx->num_logic_channels + ch] = sample[idx / 8] & (1 << (idx % 8));