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>
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>
During "make uninstall", the documentatin was not deleted properly,
if DESTDIR was used. The existing commands expanded to:
make[3]: Entering directory '/home/osmocom-build/jenkins/workspace/master-rtl-sdr/a1/default/a2/default/a3/default/label/osmocom-master-debian9/librtlsdr-0.5.4.5-5c30/_build/sub'
cd /tmp/am-dc-24621/ && rm -rf /home/osmocom-build/jenkins/workspace/master-rtl-sdr/a1/default/a2/default/a3/default/label/osmocom-master-debian9/librtlsdr-0.5.4.5-5c30/_inst/share/doc/librtlsdr/librtlsdr-0.5.4.5-5c30/html
This fixes the "make distcheck" step of rtl-sdr, and hence should also
fix the long-standing jenkins build verification for rtl-sdr
at https://jenkins.osmocom.org/jenkins/job/master-rtl-sdr/
Signed-off-by: Harald Welte <laforge@gnumonks.org>
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>
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>
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>
This fixes the following error during "make distcheck":
echo 0.5.3.24-2a36 > ../../.version-t && mv ../../.version-t ../../.version
/bin/sh: ../../.version-t: Permission denied
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>
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>
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>
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().
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>
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>