+ /*
+ * 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);
+ }