X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Foutput%2Fcsv.c;h=4752658716d1e827731c543411f40fa18893a9ff;hb=49b6732ec5dd0742d223dea40c0c3632870ede86;hp=4c114409d22dd5b87028ffc5379c67bfa5f1f01c;hpb=a551cb0927db34bf83fcb2c71023fe4df08a22b6;p=libsigrok.git diff --git a/src/output/csv.c b/src/output/csv.c index 4c114409..47526587 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -49,7 +49,7 @@ * trigger: Whether or not to add a "trigger" column as the last column. * Defaults to FALSE. * - * dedup: Don't output duplicate rows. Defaults to TRUE. If time is off, then + * dedup: Don't output duplicate rows. Defaults to FALSE. If time is off, then * this is forced to be off. */ @@ -312,6 +312,7 @@ static void process_analog(struct context *ctx, int ret; size_t num_rcvd_ch, num_have_ch; size_t idx_have, idx_smpl, idx_rcvd; + size_t idx_send; struct sr_analog_meaning *meaning; GSList *l; float *fdata = NULL; @@ -336,6 +337,7 @@ static void process_analog(struct context *ctx, sr_warn("Problems converting data to floating point values."); num_have_ch = ctx->num_analog_channels + ctx->num_logic_channels; + idx_send = 0; for (idx_have = 0; idx_have < num_have_ch; idx_have++) { if (ctx->channels[idx_have].ch->type != SR_CHANNEL_ANALOG) continue; @@ -351,9 +353,10 @@ static void process_analog(struct context *ctx, &ctx->channels[idx_have].label); } for (idx_smpl = 0; idx_smpl < analog->num_samples; idx_smpl++) - ctx->analog_samples[idx_smpl * ctx->num_analog_channels + idx_have] = fdata[idx_smpl * num_rcvd_ch + idx_rcvd]; + ctx->analog_samples[idx_smpl * ctx->num_analog_channels + idx_send] = fdata[idx_smpl * num_rcvd_ch + idx_rcvd]; break; } + idx_send++; } g_free(fdata); } @@ -640,6 +643,8 @@ static struct sr_option options[] = { static const struct sr_option *get_options(void) { + GSList *l = NULL; + if (!options[0].def) { options[0].def = g_variant_ref_sink(g_variant_new_string("")); options[1].def = g_variant_ref_sink(g_variant_new_boolean(TRUE)); @@ -649,9 +654,13 @@ static const struct sr_option *get_options(void) options[5].def = g_variant_ref_sink(g_variant_new_string(";")); options[6].def = g_variant_ref_sink(g_variant_new_boolean(TRUE)); options[7].def = g_variant_ref_sink(g_variant_new_string("units")); + l = g_slist_append(l, g_variant_ref_sink(g_variant_new_string("units"))); + l = g_slist_append(l, g_variant_ref_sink(g_variant_new_string("channel"))); + l = g_slist_append(l, g_variant_ref_sink(g_variant_new_string("off"))); + options[7].values = l; options[8].def = g_variant_ref_sink(g_variant_new_boolean(TRUE)); options[9].def = g_variant_ref_sink(g_variant_new_boolean(FALSE)); - options[10].def = g_variant_ref_sink(g_variant_new_boolean(TRUE)); + options[10].def = g_variant_ref_sink(g_variant_new_boolean(FALSE)); } return options;