X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fasix-sigma%2Fapi.c;h=8e1a490aa345ee6e91ea8a968236d0899c2ad8cf;hb=dde0175d19fe443cf60c3089196364db17cfaa62;hp=042793a8961c8e52c5ee7d1acb094a01ab1c91f9;hpb=379e95c587e1d76eb5d6d1a144b938e6a4916b1f;p=libsigrok.git diff --git a/src/hardware/asix-sigma/api.c b/src/hardware/asix-sigma/api.c index 042793a8..8e1a490a 100644 --- a/src/hardware/asix-sigma/api.c +++ b/src/hardware/asix-sigma/api.c @@ -363,9 +363,20 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) struct dev_context *devc; devc = sdi->priv; - devc->state.state = SIGMA_IDLE; - sr_session_source_remove(sdi->session, -1); + /* + * When acquisition is currently running, keep the receive + * routine registered and have it stop the acquisition upon the + * next invocation. Else unregister the receive routine here + * already. The detour is required to have sample data retrieved + * for forced acquisition stops. + */ + if (devc->state.state == SIGMA_CAPTURE) { + devc->state.state = SIGMA_STOPPING; + } else { + devc->state.state = SIGMA_IDLE; + sr_session_source_remove(sdi->session, -1); + } return SR_OK; }