output/csv: always generate text for analog/logic data packets

Unconditionally generate output text when a session packet is received
which carries analog or logic sample data. Even if the data gets queued
and is not shown immediately, in that case the output text remains empty
but needs to be present. Otherwise applications may assume that the CSV
output module had not handled the data at all, which would result in
unexpected "screen output" with fallback data being interleaved with the
CSV output.

This resolves bug #1026 in its strictest sense (the unexpected presence
of fallback data). But leaves all other issues mentioned in comment 1.
This commit is contained in:
Gerhard Sittig 2020-08-22 18:24:12 +02:00
parent ce384e074f
commit 98b7b08956
1 changed files with 4 additions and 1 deletions

View File

@ -420,7 +420,8 @@ static void dump_saved_values(struct context *ctx, GString **out)
} else {
sr_info("Dumping %u samples", ctx->num_samples);
*out = g_string_sized_new(512);
if (!*out)
*out = g_string_sized_new(512);
num_channels =
ctx->num_logic_channels + ctx->num_analog_channels;
@ -678,6 +679,7 @@ static int receive(const struct sr_output *o,
ctx->trigger = TRUE;
break;
case SR_DF_LOGIC:
*out = g_string_sized_new(512);
logic = packet->payload;
ctx->pkt_snums = logic->length;
ctx->pkt_snums /= logic->length;
@ -685,6 +687,7 @@ static int receive(const struct sr_output *o,
process_logic(ctx, logic);
break;
case SR_DF_ANALOG:
*out = g_string_sized_new(512);
analog = packet->payload;
ctx->pkt_snums = analog->num_samples;
ctx->pkt_snums /= g_slist_length(analog->meaning->channels);