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 <patrick.servello@gmail.com> for the patch.
This commit is contained in:
Uwe Hermann 2013-05-21 20:54:42 +02:00
parent ee8ddd8f5a
commit adf33ecce5
1 changed files with 2 additions and 3 deletions

View File

@ -172,8 +172,7 @@ static int data(struct sr_output *o, const uint8_t *data_in,
{ {
struct context *ctx; struct context *ctx;
GString *outstr; GString *outstr;
uint64_t sample, i; uint64_t sample, i, j;
int j;
if (!o) { if (!o) {
sr_err("%s: o was NULL", __func__); 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) { for (i = 0; i <= length_in - ctx->unitsize; i += ctx->unitsize) {
memcpy(&sample, data_in + 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", g_string_append_printf(outstr, "%d%c",
(int)((sample & (1 << j)) >> j), (int)((sample & (1 << j)) >> j),
ctx->separator); ctx->separator);