X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Ftrace32_ad.c;h=4ac06cf565c1792b2df0c0b7437e166d8e8f6d80;hb=3be42bc22f8b36599a448273c12a76d3e0f7a940;hp=06fc52146fd376c86f4b556d816791e91085011e;hpb=6d2897e394950bb661a27fd33dbcd14d8c56c61f;p=libsigrok.git diff --git a/src/input/trace32_ad.c b/src/input/trace32_ad.c index 06fc5214..4ac06cf5 100644 --- a/src/input/trace32_ad.c +++ b/src/input/trace32_ad.c @@ -85,7 +85,7 @@ enum { struct context { gboolean meta_sent; - gboolean header_read, records_read; + gboolean header_read, records_read, trigger_sent; char format, device, record_mode, compression; char pod_status[MAX_POD_COUNT]; struct sr_channel *channels[MAX_POD_COUNT][17]; /* 16 + CLK */ @@ -467,13 +467,14 @@ static void process_record_pi(struct sr_input *in, gsize start) return; } - if (timestamp == inc->trigger_timestamp) { + if (timestamp == inc->trigger_timestamp && !inc->trigger_sent) { sr_dbg("Trigger @%lf s, record #%d.", timestamp * TIMESTAMP_RESOLUTION, inc->cur_record); packet.type = SR_DF_TRIGGER; packet.payload = NULL; sr_session_send(in->sdi, &packet); + inc->trigger_sent = TRUE; } /* Is this the last record in the file? */ @@ -519,13 +520,14 @@ static void process_record_iprobe(struct sr_input *in, gsize start) single_payload[2] = R8(in->buf->str + start + 10) & 1; payload_len = 3; - if (timestamp == inc->trigger_timestamp) { + if (timestamp == inc->trigger_timestamp && !inc->trigger_sent) { sr_dbg("Trigger @%lf s, record #%d.", timestamp * TIMESTAMP_RESOLUTION, inc->cur_record); packet.type = SR_DF_TRIGGER; packet.payload = NULL; sr_session_send(in->sdi, &packet); + inc->trigger_sent = TRUE; } /* Is this the last record in the file? */ @@ -729,7 +731,6 @@ static int receive(struct sr_input *in, GString *buf) static int end(struct sr_input *in) { struct context *inc; - struct sr_datafeed_packet packet; int ret; inc = in->priv; @@ -741,10 +742,8 @@ static int end(struct sr_input *in) flush_output_buffer(in); - if (inc->meta_sent) { - packet.type = SR_DF_END; - sr_session_send(in->sdi, &packet); - } + if (inc->meta_sent) + std_session_send_df_end(in->sdi, LOG_PREFIX); return ret; }