+ if (devc->dev_state == STOPPING) {
+ /* We've been told to wind up the acquisition. */
+ sr_dbg("Stopping acquisition.");
+ /*
+ * TODO: Doesn't really cancel pending transfers so they might
+ * come in after SR_DF_END is sent.
+ */
+ lupfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx);
+ for (i = 0; lupfd[i]; i++)
+ sr_source_remove(lupfd[i]->fd);
+ free(lupfd);
+
+ packet.type = SR_DF_END;
+ sr_session_send(sdi, &packet);
+
+ devc->dev_state = IDLE;
+
+ return TRUE;
+ }
+