>From a1573efe71ab819d1ab8f40464b9514c7b5344e8 Mon Sep 17 00:00:00 2001
From: Alexander Kurpiers <[email protected]>
Date: Thu, 28 Nov 2013 23:40:48 +0100
Subject: [PATCH 2/7] Work around an issue in libusb calling
libusb_submit_transfer() quickly
Introduce a short sleep here - it will prevent a crash if small
buffers are used
Jan 26 2013 SM5BSZ
---
src/librtlsdr.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/librtlsdr.c b/src/librtlsdr.c
index 9a3ebcd..65b77fb 100644
--- a/src/librtlsdr.c
+++ b/src/librtlsdr.c
@@ -1764,6 +1764,13 @@ int rtlsdr_read_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx,
_rtlsdr_alloc_async_buffers(dev);
for(i = 0; i < dev->xfer_buf_num; ++i) {
+ /* Sleep a little here.
+ Will avoid crash in case there are many small buffers. */
+#ifdef _WIN32
+ Sleep(1);
+#else
+ usleep(1000);
+#endif
libusb_fill_bulk_transfer(dev->xfer[i],
dev->devh,
0x81,
--
1.7.9.5