disable bulk read timeouts

ideally, we should calculate them depending on the configured sample
rate
master
Dimitri Stolnikov 13 years ago
parent 1eb1c3e191
commit 20313516cc
  1. 2
      src/main.c
  2. 7
      src/rtl-sdr.c

@ -171,6 +171,8 @@ int main(int argc, char **argv)
#endif #endif
if (do_exit) if (do_exit)
fprintf(stderr, "\nUser cancel, exiting...\n"); fprintf(stderr, "\nUser cancel, exiting...\n");
else
fprintf(stderr, "\nSystem cancel, exiting...\n");
fclose(file); fclose(file);

@ -159,6 +159,7 @@ struct rtlsdr_dev {
#define CTRL_IN (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN) #define CTRL_IN (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN)
#define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT) #define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT)
#define CTRL_TIMEOUT 300 #define CTRL_TIMEOUT 300
#define BULK_TIMEOUT 0
enum usb_reg { enum usb_reg {
USB_SYSCTL = 0x2000, USB_SYSCTL = 0x2000,
@ -836,7 +837,7 @@ int rtlsdr_read_sync(rtlsdr_dev_t *dev, void *buf, int len, int *n_read)
if (!dev) if (!dev)
return -1; return -1;
return libusb_bulk_transfer(dev->devh, 0x81, buf, len, n_read, 3000); return libusb_bulk_transfer(dev->devh, 0x81, buf, len, n_read, BULK_TIMEOUT);
} }
static void LIBUSB_CALL _libusb_callback(struct libusb_transfer *xfer) static void LIBUSB_CALL _libusb_callback(struct libusb_transfer *xfer)
@ -857,7 +858,7 @@ static void LIBUSB_CALL _libusb_callback(struct libusb_transfer *xfer)
int rtlsdr_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx) int rtlsdr_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx)
{ {
rtlsdr_read_async(dev, cb, ctx, 0, 0); return rtlsdr_read_async(dev, cb, ctx, 0, 0);
} }
int rtlsdr_read_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx, int rtlsdr_read_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx,
@ -894,7 +895,7 @@ int rtlsdr_read_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx,
dev->xfer_buf_len, dev->xfer_buf_len,
_libusb_callback, _libusb_callback,
(void *)dev, (void *)dev,
3000); BULK_TIMEOUT);
libusb_submit_transfer(dev->xfer[i]); libusb_submit_transfer(dev->xfer[i]);
} }

Loading…
Cancel
Save