X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Fcsv.c;h=3eda9bf99a95f62df5a966ff933e1861782dd020;hb=3182932d360303df459abce20dbe093ce9c453e8;hp=0a7c50443efdb6454941375fcdada8443a59e6df;hpb=29a27196a13de2ffd9b671185e4b464b9db9b549;p=libsigrok.git diff --git a/output/csv.c b/output/csv.c index 0a7c5044..3eda9bf9 100644 --- a/output/csv.c +++ b/output/csv.c @@ -91,8 +91,8 @@ static int init(struct sr_output *o) num_probes = g_slist_length(o->sdi->probes); - if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar, - o->sdi) == SR_OK) { + if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE, + &gvar) == SR_OK) { ctx->samplerate = g_variant_get_uint64(gvar); g_variant_unref(gvar); } else @@ -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);