]> sigrok.org Git - libsigrok.git/commitdiff
kingst-la2016: balance frame begin and frame end emission
authorGerhard Sittig <redacted>
Mon, 31 Jan 2022 22:15:16 +0000 (23:15 +0100)
committerGerhard Sittig <redacted>
Sun, 6 Feb 2022 17:53:54 +0000 (18:53 +0100)
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.

src/hardware/kingst-la2016/protocol.c
src/hardware/kingst-la2016/protocol.h

index 4f11b7d8532ddcd1de0294a24d13dbe6d896c532..de5e1ac747eeba6927a4afe08e41f60f79043bfc 100644 (file)
@@ -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.");
index 11ee28347c19165add79ce3c4955ee79739c497d..5695feaf5a36ddc351576b6670e9124d4e27b6ab 100644 (file)
@@ -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;