Otherwise the new transfer status does not propagate
into the xfer->status and we try to cancel all transfers
twice.
Also replace the ifdefs with a single macro for backwards
compatibility.
Signed-off-by: Steve Markgraf <steve@steve-m.de>
libusb < 1.0.9 doesn't have libusb_handle_events_timeout_completed(),
but libusb <= 1.0.8 doesn't have version.h, so we need to check
for the function.
The cmake-code was borrowed from UHD, which also checks
for libusb_error_name(), we add that as well since it might come
handy later on.
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Now we're using libusb_handle_events_timeout_completed()
instead of the deprecated libusb_handle_events_timeout(),
and notify our async state machine when rtlsdr_cancel_async()
is called. This speeds up exiting from any program that uses the
device asynchronously.
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Thanks to Joris van Rantwijk for finding what seems to be
a hardware limitation/bug (bit 28 of the rsamp register being
forced to the value of bit 27).
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Since this feature also disconnects running instances
of librtlsdr that claimed the device, it is now disabled
by default and can only be enabled at compile time.
To enable it when building with cmake:
cmake . -DDETACH_KERNEL_DRIVER=ON
To enable it when building with automake:
./configure --enable-driver-detach
Signed-off-by: Steve Markgraf <steve@steve-m.de>
libusb reacts differently to a device loss during runtime,
and sporadic errors can happen when starting a second
instance interfacing another dongle, thus we need to wait
for all transfers to fail before assuming the dongle has
been removed.
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Since the R820T is a power hog and gets quite hot,
this makes sense, especially when being battery-
powered.
Signed-off-by: Steve Markgraf <steve@steve-m.de>
This improves the situation on hosts with flaky host
controllers like the Raspberry Pi and the WR703N.
Signed-off-by: Steve Markgraf <steve@steve-m.de>
This allows to open a device by a name (serial number string)
that has been programmed with rtl_eeprom -s.
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Otherwise the tuner would use the uncorrected xtal value
after enabling and disabling the direct sampling mode
Signed-off-by: Steve Markgraf <steve@steve-m.de>