The DF_END packet was send out after all configured frames were fetched, but
devices may stop the acquisition at any point in time and an DF_END will not be
send out in this case.

Send the DF_END packet inside of acquisition_stop() so this can't happen.
---
 hardware/hameg-hmo/api.c      | 5 +++++
 hardware/hameg-hmo/protocol.c | 2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hardware/hameg-hmo/api.c b/hardware/hameg-hmo/api.c
index 3b47492..9e1d6e1 100644
--- a/hardware/hameg-hmo/api.c
+++ b/hardware/hameg-hmo/api.c
@@ -882,9 +882,14 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, 
void *cb_data)
 {
        struct dev_context *devc;
        struct sr_scpi_dev_inst *scpi;
+       struct sr_datafeed_packet packet;
 
        (void)cb_data;
 
+       packet.type = SR_DF_END;
+       packet.payload = NULL;
+       sr_session_send(sdi, &packet);
+
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
diff --git a/hardware/hameg-hmo/protocol.c b/hardware/hameg-hmo/protocol.c
index 2f7f5ab..f3de763 100644
--- a/hardware/hameg-hmo/protocol.c
+++ b/hardware/hameg-hmo/protocol.c
@@ -621,8 +621,6 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void 
*cb_data)
                        devc->current_probe = devc->current_probe->next;
                        hmo_request_data(sdi);
                } else if (++devc->num_frames == devc->frame_limit) {
-                       packet.type = SR_DF_END;
-                       sr_session_send(sdi, &packet);
                        sdi->driver->dev_acquisition_stop(sdi, cb_data);
                } else {
                        devc->current_probe = devc->enabled_probes;
-- 
1.8.5.3


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to