From: Gerhard Sittig Date: Mon, 31 Jan 2022 22:15:16 +0000 (+0100) Subject: kingst-la2016: balance frame begin and frame end emission X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=96a405ab4f997a369dba6a47587f906a2c93df49;p=libsigrok.git kingst-la2016: balance frame begin and frame end emission Track when frame begin was sent to the session, to conditionally send frame end only when begin was sent. This is useful because frame markers get deferred for quite some time when triggers are involved. Acquisition stop may occur before the start of a capture was seen or processed. --- diff --git a/src/hardware/kingst-la2016/protocol.c b/src/hardware/kingst-la2016/protocol.c index 4f11b7d8..de5e1ac7 100644 --- a/src/hardware/kingst-la2016/protocol.c +++ b/src/hardware/kingst-la2016/protocol.c @@ -1203,6 +1203,7 @@ SR_PRIV int la2016_receive_data(int fd, int revents, void *cb_data) /* Initiate the download of acquired sample data. */ std_session_send_df_frame_begin(sdi); + devc->frame_begin_sent = TRUE; ret = la2016_start_download(sdi, receive_transfer); if (ret != SR_OK) { sr_err("Cannot start acquisition data download."); @@ -1228,7 +1229,10 @@ SR_PRIV int la2016_receive_data(int fd, int revents, void *cb_data) feed_queue_logic_flush(devc->feed_queue); feed_queue_logic_free(devc->feed_queue); devc->feed_queue = NULL; - std_session_send_df_frame_end(sdi); + if (devc->frame_begin_sent) { + std_session_send_df_frame_end(sdi); + devc->frame_begin_sent = FALSE; + } std_session_send_df_end(sdi); sr_dbg("Download finished, done post processing."); diff --git a/src/hardware/kingst-la2016/protocol.h b/src/hardware/kingst-la2016/protocol.h index 11ee2834..5695feaf 100644 --- a/src/hardware/kingst-la2016/protocol.h +++ b/src/hardware/kingst-la2016/protocol.h @@ -129,6 +129,7 @@ struct dev_context { /* Internal acquisition and download state. */ gboolean trigger_involved; + gboolean frame_begin_sent; gboolean completion_seen; gboolean download_finished; uint32_t packets_per_chunk;