aboutsummaryrefslogtreecommitdiffstats
path: root/src/librtlsdr.c
AgeCommit message (Collapse)AuthorFilesLines
2023-08-23add rtl-sdr blog v4 supportrtlsdrblog1-1/+23
2022-01-19lib: Stop applying workaround for libusb < 1.0.9Clayton Smith1-6/+0
Librtlsdr has a workaround for libusb versions that lack libusb_handle_events_timeout_completed, which was added in version 1.0.9 (released 2012-04-02). The workaround is always applied unless the HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED macro is set, but the cmake code that sets this macro was removed in 849f8efca42b659bf7e8fe17156ee0aa67b47233. As a result, the workaround is now always applied. This results in an extra 1-second delay whenever a GNU Radio flowgraph containing an RTL-SDR block is stopped, which makes operations like switching between demodulators in Gqrx annoyingly slow. To solve this problem, I've simply removed the workaround, as it should no longer be needed. I wonder if perhaps the workaround recently applied in 2659e2df31e592d74d6dd264a4f5ce242c6369c8 might stem from the same bug.
2022-01-08lib: force wait state after cancel of usb transferjvde.github1-0/+3
..and before handling usb events This avoids an occasional crash when closing the device on Windows. Also see https://github.com/libusb/libusb/issues/1043.
2019-11-12lib: Add GPIO version of the bias tee configuration APIAdrian Chadd1-3/+8
rtl_biast allows for non-default GPIO pins to be used. Add an API call which allows for that.
2019-07-16lib: disable usbfs zero-copy support by defaultSteve Markgraf1-1/+1
Although we added a detection mechanism for the presence of the Kernel bug earlier, reading from the incorrectly mapped memory might cause a bus error on some ARM systems. With the overall performance benefit being rather minimal for the data rates of rtl-sdr, disable zero-copy by default.
2019-07-16lib: fix memory leak in rtlsdr_open()Steve Markgraf1-0/+3
Thanks to Vincent Perrier for reporting the bug.
2018-10-07lib: Add workaround for Linux usbfs mmap() bugSteve Markgraf1-2/+17
The Linux Kernel has a bug on ARM/ARM64 systems where the USB CMA memory is incorrectly mapped to userspace, breaking zerocopy. When the Kernel allocates the memory, it clears it with memset(). If the mapping worked correctly, we should have zeroed out buffers, if it doesn't, we get random Kernel memory. We now check for this, and fall back to buffers in userspace if that's the case. Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-05-01lib: use USB zero-copy transfers if possibleSteve Markgraf1-8/+60
Decreases CPU load especially for embedded machines. Requires Linux >= 4.6 and libusb >= 1.0.21. If this is not the case or the allocation fails, we will fall back to buffers allocated in userspace. Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-18cosmetic: Fix "implicit fall-through" gcc 7.3.0 warningsHarald Welte1-0/+1
2018-02-20lib: fix FC0012 reset GPIOSteve Markgraf1-3/+3
Since a typo in rtlsdr_set_gpio_output() was fixed, FC0012 tuners were not detected anymore, as the reset pin is actually 4, not 5. Thanks to David Basden et al for reporting the bug. Signed-off-by: Steve Markgraf <steve@steve-m.de>
2017-06-09lib: Use GPIO P0 to toggle an (optional) bias-tLucas Teske1-0/+11
At least one distributor of rtl-sdr dongles (rtl-sdr.com) added a bias-t to their dongles which could be toggled via GPIO P0 of the RTL2832U chip. source: http://www.rtl-sdr.com/rtl-sdr-blog-v-3-dongles-user-guide/ Signed-off-by: Steve Markgraf <steve@steve-m.de>
2017-06-09lib: fix direction bit in GPIO codeLucas Teske1-1/+1
source: http://lea.hamradio.si/~s57uuu/mischam/rtlsdr/ports.html * Removed unnecessary comment of old code. Signed-off-by: Fabian P. Schmidt <kerel-fs@gmx.de> Signed-off-by: Steve Markgraf <steve@steve-m.de>
2016-11-27lib: add new HanfTek dongleSteve Markgraf1-0/+1
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2015-06-09lib: check for libusb init failureHoernchen1-6/+16
2015-05-16New functions rtlsdr_set_tuner_bandwidth()Jiří Pinkava1-4/+31
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2015-05-16Allow setting bandwidth for R820TJiří Pinkava1-2/+16
This improves SDR performence for nearby channel interference. As a sideeffect also improves dynamic range becase ADC is not overloaded by onwanted singlas. Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-02-10lib: change default number of transfers to 15Steve Markgraf1-1/+1
So far we had 32 * 256KB which was a bit overkill, 15 are more than enough. 15 was chosen instead of 16 because at least on Linux there seems to be a system-wide limit of 63 transfers (when they are 256KB large), so 4 dongles can be used on a single machine without lowering the default transfer number. Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-02-09lib: handle events after canceling transfersSteve Markgraf1-10/+15
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>
2014-02-04remove unused variables, type fixesSteve Markgraf1-1/+1
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-01-29lib: add missing 'goto' in tuner detection codeDenys Berkovskyy1-0/+1
Add missing ‘goto’ to avoid checks for other tuners when R828D tuner is found. Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-01-24lib/cmake: check for libusb_handle_events_timeout_completed()Steve Markgraf1-0/+8
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>
2014-01-24lib: add SVEON STV27, sort device listSteve Markgraf1-13/+14
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-01-24lib: speed up exiting from async handlerSteve Markgraf1-3/+10
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>
2014-01-05lib: check for validity of sample ratesSteve Markgraf1-8/+10
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>
2014-01-03lib: abort if submitting transfer fails, don't deadlock when cancelling failsSteve Markgraf1-2/+10
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-12-26lib: add yet another Terratec OEM stickSteve Markgraf1-0/+1
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-12-24lib: add OEM versions of Terratec NOXON sticksSteve Markgraf1-3/+6
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-12-16change device name of OEM donglesSteve Markgraf1-1/+1
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-12-08lib: add KWorld KW-UB450-T to device listSteve Markgraf1-0/+1
The TUA9001 tuner it uses is unsupported at the moment, though. Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-12-02lib: use FIR coefficients instead of magic + documentationJiri Pinkava1-10/+56
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-11-16tuner_r82xx: enable multi-byte I2C transfersSteve Markgraf1-1/+1
This should speed some multi register reads up a bit. Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-11-10add Sveon STV21 stick to device listSteve Markgraf1-0/+1
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-11-04lib: declare fir coefficients as constantSteve Markgraf1-1/+1
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-11-04remove e4k-specific I2C functions from librarySteve Markgraf1-11/+0
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-11-04add Astrometa DVB-T/DVB-T2 stickSteve Markgraf1-0/+1
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-11-04add support for R828D tunerSteve Markgraf1-27/+54
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-11-04use new driver for R8XX tunersSteve Markgraf1-16/+43
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-10-12add DigitalNow Quad DVB-T PCI-E cardSteve Markgraf1-0/+1
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-06-12lib: add ASUS U3100MINI_PLUS_V2 to device listSteve Markgraf1-0/+1
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-06-04lib: don't detach kernel driver by defaultSteve Markgraf1-0/+12
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>
2013-03-01lib: add WinFast DTV Dongle mini DSteve Markgraf1-0/+1
Thanks to Alan Beard for reporting. Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-02-26lib: detach and reattach kernel driver if neededSteve Markgraf1-0/+19
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-02-17lib: special handling of dongle disconnect for OS != win32Steve Markgraf1-5/+17
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>
2013-01-29lib: remove "e.g. hama nano" from the default device descriptionSteve Markgraf1-1/+1
This caused some confusion... Signed-off-by: Steve Markgraf <steve@steve-m.de>
2013-01-16exit if our usb device disappearsHoernchen1-11/+20
2013-01-16lib: enable standby mode of e4k and r820t on exitSteve Markgraf1-3/+7
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>
2013-01-13let's not depend on libusb >= 1.0.9, avoid libusb_error_name()Hoernchen1-3/+2
2013-01-13more verbose error message if opening the usb device failsHoernchen1-2/+6
2013-01-10disable force canceling for now to prevent crashesHoernchen1-1/+2
2013-01-04lib: reset device if neededSteve Markgraf1-0/+6
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>