X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fasix-sigma%2Fprotocol.c;h=94fd8de044356a9a999b9a32cea11cd8c998f3ae;hb=edec0436db2a73b545f5d4db0c1635d6c67ff45c;hp=e2c34e5c9169699df381d5b8fecbbab3e8685849;hpb=8ebad343709aad6ef4d5aa83a2633690ef313de5;p=libsigrok.git diff --git a/src/hardware/asix-sigma/protocol.c b/src/hardware/asix-sigma/protocol.c index e2c34e5c..94fd8de0 100644 --- a/src/hardware/asix-sigma/protocol.c +++ b/src/hardware/asix-sigma/protocol.c @@ -1017,6 +1017,7 @@ static int download_capture(struct sr_dev_inst *sdi) return FALSE; sr_info("Downloading sample data."); + devc->state.state = SIGMA_DOWNLOAD; /* * Ask the hardware to stop data acquisition. Reception of the @@ -1097,13 +1098,13 @@ static int download_capture(struct sr_dev_inst *sdi) dl_lines_done += dl_lines_curr; } + g_free(dram_line); std_session_send_df_end(sdi); + devc->state.state = SIGMA_IDLE; sr_dev_acquisition_stop(sdi); - g_free(dram_line); - return TRUE; } @@ -1146,6 +1147,14 @@ SR_PRIV int sigma_receive_data(int fd, int revents, void *cb_data) if (devc->state.state == SIGMA_IDLE) return TRUE; + /* + * When the application has requested to stop the acquisition, + * then immediately start downloading sample data. Otherwise + * keep checking configured limits which will terminate the + * acquisition and initiate download. + */ + if (devc->state.state == SIGMA_STOPPING) + return download_capture(sdi); if (devc->state.state == SIGMA_CAPTURE) return sigma_capture_mode(sdi);