Add DSLogic capture, signal conversion and DSView decoders
This commit is contained in:
96
tools/dsview/windows-usb-events.patch
Normal file
96
tools/dsview/windows-usb-events.patch
Normal file
@@ -0,0 +1,96 @@
|
||||
--- a/libsigrok4DSL/hardware/DSL/dslogic.c
|
||||
+++ b/libsigrok4DSL/hardware/DSL/dslogic.c
|
||||
@@ -1316,10 +1316,15 @@
|
||||
{
|
||||
int i;
|
||||
sr_info("%s: remove fds from polling", __func__);
|
||||
+#ifdef _WIN32
|
||||
+ /* Windows libusb has no poll descriptors; remove the timer source. */
|
||||
+ sr_source_remove(-1);
|
||||
+#else
|
||||
/* Remove fds from polling. */
|
||||
for (i = 0; devc->usbfd[i] != -1; i++)
|
||||
sr_source_remove(devc->usbfd[i]);
|
||||
g_free(devc->usbfd);
|
||||
+#endif
|
||||
}
|
||||
|
||||
static void report_overflow(struct DSL_context *devc)
|
||||
@@ -1486,6 +1491,13 @@
|
||||
}
|
||||
|
||||
/* setup callback function for data transfer */
|
||||
+#ifdef _WIN32
|
||||
+ /* libusb_get_pollfds() always returns NULL on Windows. The acquisition
|
||||
+ * thread pumps libusb via receive_data on a bounded timer instead. */
|
||||
+ ret = sr_source_add(-1, 0, 10, receive_data, sdi);
|
||||
+ if (ret != SR_OK)
|
||||
+ return ret;
|
||||
+#else
|
||||
lupfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx);
|
||||
for (i = 0; lupfd[i]; i++);
|
||||
|
||||
@@ -1500,7 +1512,8 @@
|
||||
devc->usbfd[i] = lupfd[i]->fd;
|
||||
}
|
||||
devc->usbfd[i] = -1;
|
||||
- g_free(lupfd);
|
||||
+ libusb_free_pollfds(lupfd);
|
||||
+#endif
|
||||
|
||||
wr_cmd.header.dest = DSL_CTL_START;
|
||||
wr_cmd.header.size = 0;
|
||||
--- a/libsigrok4DSL/hardware/DSL/dscope.c
|
||||
+++ b/libsigrok4DSL/hardware/DSL/dscope.c
|
||||
@@ -1901,10 +1901,15 @@
|
||||
{
|
||||
int i;
|
||||
sr_info("%s: remove fds from polling", __func__);
|
||||
+#ifdef _WIN32
|
||||
+ /* Windows libusb has no poll descriptors; remove the timer source. */
|
||||
+ sr_source_remove(-1);
|
||||
+#else
|
||||
/* Remove fds from polling. */
|
||||
for (i = 0; devc->usbfd[i] != -1; i++)
|
||||
sr_source_remove(devc->usbfd[i]);
|
||||
g_free(devc->usbfd);
|
||||
+#endif
|
||||
}
|
||||
|
||||
static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
|
||||
@@ -2088,6 +2093,13 @@
|
||||
}
|
||||
|
||||
/* setup callback function for data transfer */
|
||||
+#ifdef _WIN32
|
||||
+ /* libusb_get_pollfds() always returns NULL on Windows. The acquisition
|
||||
+ * thread pumps libusb via receive_data on a bounded timer instead. */
|
||||
+ ret = sr_source_add(-1, 0, 10, receive_data, sdi);
|
||||
+ if (ret != SR_OK)
|
||||
+ return ret;
|
||||
+#else
|
||||
lupfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx);
|
||||
for (i = 0; lupfd[i]; i++);
|
||||
|
||||
@@ -2103,7 +2115,8 @@
|
||||
}
|
||||
|
||||
devc->usbfd[i] = -1;
|
||||
- g_free(lupfd);
|
||||
+ libusb_free_pollfds(lupfd);
|
||||
+#endif
|
||||
|
||||
wr_cmd.header.dest = DSL_CTL_START;
|
||||
wr_cmd.header.size = 0;
|
||||
--- a/libsigrok4DSL/session.c
|
||||
+++ b/libsigrok4DSL/session.c
|
||||
@@ -207,7 +207,8 @@
|
||||
sr_dbg("Running...");
|
||||
|
||||
/* Do we have real sources? */
|
||||
- if (session->num_sources == 1 && session->pollfds[0].fd == -1) {
|
||||
+ if (session->num_sources == 1 && session->pollfds[0].fd == -1
|
||||
+ && session->sources[0].timeout == 0) {
|
||||
/* Dummy source, freewheel over it. */
|
||||
while (session->num_sources) {
|
||||
if (session->abort_session) {
|
||||
Reference in New Issue
Block a user