From: Uwe Hermann Date: Tue, 21 May 2013 18:54:42 +0000 (+0200) Subject: csv output: Fix incorrect ordering of the probes. X-Git-Tag: libsigrok-0.2.1~88 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=adf33ecce5e0bc2dff53087b01da6d5baaa89ee3;p=libsigrok.git csv output: Fix incorrect ordering of the probes. The comment for the CSV output module says probes are ordered e.g. 0,1,2,3, but the actual values were in the 3,2,1,0 order. We're fixing this by making the order of the probe values 0,1,2,3 too for now, but this will become a configurable option later on. Thanks Patrick Servello for the patch. --- diff --git a/output/csv.c b/output/csv.c index 0a7c5044..57cfb821 100644 --- a/output/csv.c +++ b/output/csv.c @@ -172,8 +172,7 @@ static int data(struct sr_output *o, const uint8_t *data_in, { struct context *ctx; GString *outstr; - uint64_t sample, i; - int j; + uint64_t sample, i, j; if (!o) { sr_err("%s: o was NULL", __func__); @@ -200,7 +199,7 @@ static int data(struct sr_output *o, const uint8_t *data_in, for (i = 0; i <= length_in - ctx->unitsize; i += ctx->unitsize) { memcpy(&sample, data_in + i, ctx->unitsize); - for (j = ctx->num_enabled_probes - 1; j >= 0; j--) { + for (j = 0; j < ctx->num_enabled_probes; j++) { g_string_append_printf(outstr, "%d%c", (int)((sample & (1 << j)) >> j), ctx->separator);