+ if (devc->dev_state == STOPPING) {
+ /* We've been told to wind up the acquisition. */
+ sr_dbg("hantek-dso: stopping acquisition");
+ /* TODO: doesn't really cancel pending transfers so they might
+ * come in after SR_DF_END is sent. */
+ lupfd = libusb_get_pollfds(NULL);
+ 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;
+ }
+