Commit Graph

323 Commits

Author SHA1 Message Date
rtlsdrblog
4ff1c4f74f
Enable EEPROM to force direct sampling mode
Re-purpose remote-enabled EEPROM flag to determine if direct sampling mode should be forced ON. Useful for apps that don't have any direct sampling mode settings in their GUI.
2019-11-01 17:34:12 +13:00
rtlsdrblog
4f6c1b2e98
Enable EEPROM to force direct sampling mode
Re-purpose remote-enabled EEPROM flag to determine if direct sampling mode should be forced ON. Useful for apps that don't have any direct sampling mode settings in their GUI.
2019-11-01 17:33:14 +13:00
rtlsdrblog
8a3d6a919f
offset tuning -> bias tee hack
Use the offset tuning button to enable the bias tee on the V3. Offset tuning is not used for the R820T so this is okay and allows us to toggle the bias tee on software that hasn't implemented specific bias tee controls.
2019-11-01 15:42:27 +13:00
rtlsdrblog
6f9efc9343 lband opts 2019-10-18 06:55:36 +01:00
rtlsdrblog
9b900be7c6 fix EEPROM always on bias tee 2019-10-18 05:10:08 +01:00
rtlsdrblog
65ea7235bc add rtl_biast, add biast EEPROM hack 2019-10-17 13:18:24 +01:00
rtlsdrblog
9d3d8a5faf direct sampling added to rtl_tcp 2019-10-11 13:23:38 +01:00
rtlsdrblog
775daa821f
Merge pull request #1 from blinick/wip_rtltcp_ringbuf
Wip rtltcp ringbuf
2019-10-11 19:48:13 +13:00
rtlsdrblog
f26bf11bbd
Max VCO currents
Better L-Band locks
2019-10-11 15:06:50 +13:00
Steve Markgraf
81833a1cf6 lib: disable usbfs zero-copy support by default
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-16 23:49:48 +02:00
Steve Markgraf
be1d1206bf lib: fix memory leak in rtlsdr_open()
Thanks to Vincent Perrier for reporting the bug.
2019-07-16 23:31:31 +02:00
Stephen Blinick
da0c8ea073 Clean out stale data in ring buffer when client disconnects. 2019-02-10 15:23:42 -07:00
Stephen Blinick
d0e7dcde04 Perf: Replace rtl_tcp linked list with ring buffer
Removed the linked list structure, locking, and malloc/free on each USB callback.
Replaced it with a non blocking ring buffer for performance.  This resulted
in a large performance improvement when using an Raspberry Pi or Raspberry Pi Zero W
as a rtl_tcp server.  The sample rate could be doubled and instead of wired ethernet
wifi could be used.  Frequnecy change lag was reduced greatly also.

Signed-off-by: Stephen Blinick <stephen@stesoft.com>
2019-02-10 10:20:48 -07:00
Steve Markgraf
f68bb2fa77 lib: Add workaround for Linux usbfs mmap() bug
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-10-07 01:25:07 +02:00
David Woodhouse
9047eef701 Fix inline functions to use 'static inline'
With just 'inline', if the compiler decides not to inline them, it isn't
required to emit them at all. For some targets with -Os that is causing
build failures, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86360.

Perhaps we might consider using '__attribute__((always_inline))' for
GCC builds, but 'static inline' is a good start.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-07-03 23:59:01 +02:00
Steve Markgraf
5c3073f417 tuner_r82xx: turn off loop-through, remove dead code
As pointed out by Carl Laufer on the mailing list,
turning the loop-through output off reduces the
current consumption by 10-20mA which in turn reduces
the heat a bit. So far there seem to be no devices
that have anything connected to the loop-through output.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-05-25 00:16:38 +02:00
Pete Zaitcev
ce9595ef53 rtl_adsb: fix hanging upon a signal in Fedora 27
This code stayed unchanged for many years, but for some reason
rtl_adsb started hanging upon exit:

*b66116a5164b69281eacc42ae950;
^CSignal caught, exiting!
 <------ hangs here forever

Examining it with gdb reveals that the demod thread waits
peacefully on the condition variable, which we're trying to
destroy. Either the signals killed all threads before, or
condition variables were possible to destroy while other
threads still waited on them.

The easiest fix appears to be just cancel the demod thread
and wait for it to exit before proceeding for the door.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-05-23 23:20:26 +02:00
Steve Markgraf
a854ae8b48 lib: use USB zero-copy transfers if possible
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-05-01 14:23:37 +02:00
Steve Markgraf
c403ef0bc1 rtl_test: fix build on Mac OS
Thanks to mot for reporting.
closes #3130

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-04-26 23:51:15 +02:00
Harald Welte
5a9864c56d fix "-Wshift-negative-value" compiler warning on ggc-7.3.0 2018-04-18 23:59:17 +02:00
Harald Welte
e92b11bfb7 cosmetic: Fix "implicit fall-through" gcc 7.3.0 warnings 2018-04-18 23:59:17 +02:00
Steve Markgraf
4520f001d8 lib: fix FC0012 reset GPIO
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>
2018-02-20 22:24:46 +01:00
Kacper Michajłow
a03198c5b7 rtl_test: Support PPM error measurement on Windows.
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2018-02-20 22:24:40 +01:00
hayati ayguen
18bf26989c Add option '-T' for activating bias-T in rtl_(adsb|fm|power|tcp)
* added debug output when activating
Signed-off-by: hayati ayguen <h_ayguen@web.de>
* fixed options argument
Signed-off-by: Fabian P. Schmidt <kerel-fs@gmx.de>
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2017-06-13 01:20:32 +02:00
Dimitri Stolnikov
fa3a113b77 rtl_tcp: add command for bias tee control 2017-06-12 00:04:05 +02:00
Lucas Teske
2be1612e60 lib: Use GPIO P0 to toggle an (optional) bias-t
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-09 15:06:23 +02:00
Lucas Teske
ba64a7459a lib: fix direction bit in GPIO code
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>
2017-06-09 15:06:09 +02:00
Steve Markgraf
e3e6ee23b7 lib: add new HanfTek dongle
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2016-11-27 12:19:44 +01:00
Hoernchen
e3c03f738f lib: check for libusb init failure 2015-06-09 01:53:23 +02:00
Hoernchen
5c376fc79c tools: allow built-in functions for newer versions of MSVC 2015-06-09 01:37:46 +02:00
Steve Markgraf
8b4d755ba1 Merge pull request #20 from lcl7/correct-e4k_reg_write
Correct return code of e4k_reg_write().
2015-05-16 00:48:37 +02:00
Jiří Pinkava
92df068dc5 New functions rtlsdr_set_tuner_bandwidth()
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2015-05-16 00:38:01 +02:00
Jiří Pinkava
d892279085 Allow setting bandwidth for R820T
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>
2015-05-16 00:37:17 +02:00
lcl
c5dc459fc5 Correct return code of e4k_reg_write().
In contradiction with the documentation, e4k_reg_write() was
returning the value 2 upon success (the number of bytes written),
not zero as documented.
Patched to return zero upon success.

As a consequence, this corrects also the return value of
e4k_reg_set_mask() and e4k_dc_offset_calibrate().
2015-05-08 11:10:30 +02:00
Dimitri Stolnikov
d447a2e983 cmake: include resource file for MSVC builds 2014-08-26 21:26:26 +02:00
Steve Markgraf
6ee5573606 rtl_tcp: make all global variables static
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-02-10 23:59:21 +01:00
Steve Markgraf
89f73b183f lib: change default number of transfers to 15
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-10 23:57:19 +01:00
Steve Markgraf
5b0137abaf lib: handle events after canceling transfers
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-09 15:50:32 +01:00
Steve Markgraf
929beafc6e lib: only print to stderr in tuner_r82xx_set_pll()
Found by keenerd.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-02-08 14:48:24 +01:00
Steve Markgraf
50743b1ccb remove unused variables, type fixes
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-02-04 19:53:24 +01:00
Steve Markgraf
0a90c7d417 rtl_test: update copyright header
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-02-04 19:26:40 +01:00
Steve Markgraf
f2be2f945b rtl_sdr: clean up getopt-string
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-02-04 19:16:11 +01:00
Michael Tatarinov
1cc9d64d98 rtl_test: refactoring and optimization for PPM error
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-02-04 19:11:10 +01:00
Denys Berkovskyy
2c171630fa lib: add missing 'goto' in tuner detection code
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-29 00:17:57 +01:00
Steve Markgraf
bf92121aff unbreak 'make distcheck' with automake
Thanks to zecke for pointing this out.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-01-26 13:49:39 +01:00
Steve Markgraf
c25f9cbc38 rtl_tcp: fix warning
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-01-24 14:35:22 +01:00
Steve Markgraf
4f31e5f560 rtl_fm/rtl_test: fix build with MSVC after recent changes
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-01-24 14:05:47 +01:00
Steve Markgraf
a2bc5b5117 lib/cmake: check for libusb_handle_events_timeout_completed()
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-24 03:57:53 +01:00
Steve Markgraf
929972f835 lib: add SVEON STV27, sort device list
Signed-off-by: Steve Markgraf <steve@steve-m.de>
2014-01-24 01:06:55 +01:00
Steve Markgraf
3409c0315f lib: speed up exiting from async handler
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-24 00:44:36 +01:00