Commit Graph

496 Commits

Author SHA1 Message Date
Clayton Smith 1f724162e1 Add Python bindings
Signed-off-by: Eric Wild <>
2021-01-18 21:16:17 +01:00
Matt Mills f88dc7df2f Fix docstrings in python bindings for gr namespace
Signed-off-by: Eric Wild <>
2021-01-18 21:16:11 +01:00
Matt Mills 0d727b3ef8 Replace swig with pybind11 for gr3.9 master compat
Signed-off-by: Eric Wild <>
2021-01-18 21:16:05 +01:00
Clayton Smith 159885f9e6 Replace boost::shared_ptr with std::shared_ptr
Signed-off-by: Eric Wild <>
2021-01-18 21:15:57 +01:00
Gwenhael Goavec-Merou cffef690f2 lib/xtrx: add missing libraries
Linking to the libxtrx libs got lost while merging
the xtrx support, which led to runtime issues when trying to use it.

Signed-off-by: Gwenhael Goavec-Merou <>
Signed-off-by: Eric Wild <>
2021-01-17 23:08:55 +01:00
Clayton Smith c3187ab875 xtrx: remove BOOST_FOREACH and obsolete API call
All instances of BOOST_FOREACH were removed in an earlier commit, but it
was reintroduced when xtrx support was merged. I removed BOOST_FOREACH
again here.

Also, xtrx support fails to build because it relies on the
xtrx_open_list function, which was removed from the xtrx API in 2019. It
was replaced with xtrx_open_string.

I don't have xtrx hardware, so I've only tested that gr-osmosdr compiles
with these changes.

Signed-off-by: Eric Wild <>
2021-01-10 19:31:59 +01:00
Clayton Smith bc629b03fe hackrf: fix bandwidth setting
The T/R switching code added in ae2253c516
fails to set custom filter bandwidths because it sets bandwidth and
sample rate in the wrong order. As noted in the documentation for
hackrf_set_sample_rate: "If you want to override the baseband filter
selection, you must do so after setting the sample rate."

To solve this problem I moved the set_bandwidth call after
set_sample_rate. It was also necessary to skip the call if a custom
bandwidth was not requested.

Signed-off-by: Eric Wild <>
2021-01-04 22:27:53 +01:00
Adrian Chadd 9b386707d8 Fix hackrf receive hangs by checking before each lock wait
Fix receive path hangs if another thread closes down the hackrf
receive whilst this buffer receive function is waiting to be
woken up.


* Sleep for up to 100ms each time waiting for the cond to be kicked;
* Check whether streaming is still enabled each time rather than
  only when the function is entered.

This fixes hangs where consumers like gqrx via gnuradio
will do a stop_rx/start_rx very quickly to change something, and
the buffer receive path is waiting for a buffer.

Signed-off-by: Eric Wild <>
2020-12-18 13:22:24 +01:00
Csaba Sipos dc82ffd1f8 add xtrx support
Signed-off-by: Eric Wild <>
2020-11-19 01:41:05 +01:00
Clayton Smith fe03d83703 Remove disabled OsmoSDR and MiriSDR code
OsmoSDR and MiriSDR support was disabled in v0.2.1 because the hardware
is rare and obsolete. I think it would be useful to completely remove
the associated code, since this will reduce the future maintenance
burden for gr-osmosdr.

Signed-off-by: Eric Wild <>
2020-11-01 00:12:56 +01:00
Clayton Smith 2d504bde50 rfspace: Remove broken asio code
Asio sockets were replaced with native BSD sockets in
e1b699fda0, and the old code was placed
behind #ifdef USE_ASIO. Subsequent commits soon broke the asio code.
Since it's been broken for a long time, I doubt anyone is using it, so
it makes sense to remove it.

Signed-off-by: Eric Wild <>
2020-11-01 00:06:28 +01:00
Clayton Smith e5bee0820f Replace BOOST_FOREACH with range-based for loops
Range-based for loops are available since C++11. Using them reduces
gr-osmosdr's dependence on Boost. Here I've done the replacement using a
global search-and-replace.

Signed-off-by: Eric Wild <>
2020-11-01 00:04:27 +01:00
Eric Wild 90c3d5b555 fix windows build 2020-10-31 23:56:26 +01:00
Mike Walters bd668e97b6 HackRF: fix hackrf_source signedness
The LUT changes in 2e7d343fed inadvertently started interpreting samples
as unsigned. This change puts it back to signed (and fixes an outdated

Signed-off-by: Eric Wild <>
2020-08-09 14:48:49 +02:00
Eric Wild 911082ff85 disable OsmoSDR as well as MiriSDR device support
The actual osmosdr had only a very limited production run many years
ago and is therefore of little interest to most gr-osmosdr users.
Mirisdr was experimental at best, because the dongles were never
widely avaialble outside of Japan and had multiple unconnected antenna
2020-08-03 02:34:31 +02:00
Eric Wild dadabeceaf cmake: actually make linking work
Appending to lists from subdirs does not work as expected, so work
around that to allow collecting the necessary libs.
2020-08-03 02:20:16 +02:00
Mike Walters 5cf6f4df96 grc: Fix YML block generation
This fixes the template syntax that removes a set of variables from sink
blocks. Previously, this was causing NameErrors when trying to generate
a flowgraph containing a sink block.

Signed-off-by: Eric Wild <>
2020-08-03 01:20:52 +02:00
Wim Lewis ad72126289 Remove unused imports of endian.hpp.
Signed-off-by: Eric Wild <>
2020-08-03 01:20:52 +02:00
Wim Lewis 2e7d343fed HackRF: convert _lut to float[] to reduce size by a factor of 256
Similar to commit 33a8d1c for RTL-SDR, this uses two lookups in a
256-element LUT instead of one lookup in a 65536-element LUT, which
saves a bit of CPU cache. It also eliminates a dependency on the
host's byte ordering.

Signed-off-by: Eric Wild <>
2020-08-03 01:20:52 +02:00
Clayton Smith 800d2eaeaf fcd: restore support for FUNcube Dongle and Pro+
Support for the original FUNcube Dongle used to live in GNU Radio's
gr-fcd module, which was removed in version 3.8. As a result, gr-osmosdr
lost support for both FUNcube Dongle and FUNcube Dongle Pro+.

The gr-fcdproplus out-of-tree module subsequently added support for the
original FUNcube Dongle, meaning that it now supports both types. As a
result, FUNcube support can easily be restored in gr-osmosdr. The

Signed-off-by: Eric Wild <>

2020-08-03 01:20:52 +02:00
Clayton Smith 52fcb0935f A lot of Boost functionality is available in C++11. Since GNU Radio is moving away from Boost, it probably makes sense to do so in gr-osmosdr as well.
This change removes all usage of boost::mutex,
boost::mutex::scoped_lock, boost::unique_lock, and
boost::condition_variable. It also removes usage of boost::shared_ptr
and boost::weak_ptr outside of block definitions (which must continue to
use Boost until GNU Radio 3.9).

Signed-off-by: Eric Wild <>
2020-08-02 23:52:25 +02:00
Anton Blanchard 49f9b2df2a I'm using an Airspy HF+ Discovery with the Soapy driver. Whenever I turn AGC off it stops receiving samples.
On closer inspection, switching AGC off results in samples stalling for
an extended period (hundreds of milliseconds). As such, we hit the
timeout in SoapyAirspyHF::readStream() and return SOAPY_SDR_TIMEOUT

Things go wrong at this point. It takes a long time before readStream()
is called again, presumably because we returned 0 from work(). By this
time our buffers have overflown, readStream() returns SOAPY_SDR_OVERFLOW
(-2) and work() returns 0. We loop forever, continually overflowing

Fix this by looping in soapy_source_c::work() when ->readStream returns
SOAPY_SDR_OVERFLOW so that we consume the buffers straight away.

Signed-off-by: Anton Blanchard <anton at>

Signed-off-by: Eric Wild <>
2020-08-02 23:50:59 +02:00
Clayton Smith 137c568c60 rtl_tcp: Throw an exception if TCP connection fails
Currently, rtl_tcp_source_c repeatedly calls ::connect until it
succeeds. This can result in 100% CPU utilization and/or a lot of
network traffic. In addition, GUI applications like Gqrx freeze up.
To solve these problems, I've changed the code to report an error
if ::connect fails.

Signed-off-by: Eric Wild <>
2020-08-02 23:46:14 +02:00
Piotr Krysik 8cf6840da1 cmake: Go back CMake min ver. 3.8 by removing need for CMP0079
CMake 3.13 is not present in older (~2 years old)
Linux distributions and GNU Radio requires min CMake
version 3.8.

All that is needed in order to avoid bumping CMake version
is to not use 'target_link_libraries' in subdirectories.
Here this is done by creating a list of needed
libraries and adding them for linking at the end (like
it was done in gr-osmosdr before porting to GNU Radio 3.8).

One thing that is lost here is 'PRIVATE' statement in case
of FCD libraries linking.

Signed-off-by: Eric Wild <>
2020-08-02 22:17:05 +02:00
Sylvain Munaut af2fda22b3 cmake: Set CMake min version to 3.13 for CMP0079
Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Sylvain Munaut 77ac70ebc3 apps/osmocom_fft: Handle continuous range for sample rate gracefully
Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Sylvain Munaut 1b827b9913 cmake: Remove the FindGnuradioUHD cmake file
This was missed during the initial cleanup but is no longer necessary
gnuradio-uhd module installs its own version and that should be used

Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Stefan `Sec` Zehl e63b8a7f6f apps: Forward port osmocom_fft to Python 3 and Qt Widget
From: Stefan `Sec` Zehl <>
Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Sylvain Munaut 465d2f433c apps: Initial forward port to Python 3
Both from 2to3 and some manual tweaks from here and there.

Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Sylvain Munaut f609a44177 lib/{source/sink}: Fix the set_sample_rate value return value if no change
Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Clayton Smith 4d1c05e84b hackrf: replace boost::assign with C++11
Since GNU Radio is gradually replacing Boost with C++11, it seemed worth
doing that for the HackRF blocks I was working on. This change removes
all usage of boost::assign.

From: Clayton Smith <>
Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Clayton Smith ae2253c516 hackrf: allow transmit/receive switching
To allow switching between transmit and receive mode within a single
flow graph, I've followed the model used by the BladeRF: I factored
common code into and hackrf_common.h, and created a
"_devs" map there to keep track of which devices have been previously
opened. Shared pointers are used to track how many source & sink blocks
are using a particular device.

Because some properties (center frequency, sample rate, bandwidth, RF
amplifier state, bias tee) are shared between receive and transmit, the
blocks defer setting these until receiving or transmitting is started.
That way a source and sink can safely use different values for these
properties, and the correct values are set during T/R switching.

Because the HackRF driver and/or hardware does not seem to fully
transmit all samples sent to it, the code adds some silence to the end
of transmissions to ensure all samples are transmitted.

I've also replaced boost with C++11 code where possible.

From: Clayton Smith <>
Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Clayton Smith 96dc33adf1 airspy: fix cmake target_link_libraries
From: Clayton Smith <>
Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Alexandru Csete 743cac795e airspyhf: Add initial support for Airspy HF+

From: Alexandru Csete <>
Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Sylvain Munaut 5d59e56ff9 build: Update build system to GR 3.8 standards
Part of GNURadio 3.8 migration

Signed-off-by: Sylvain Munaut <>
2020-02-16 09:52:00 +01:00
Sylvain Munaut e9890283ca grc: Convert XML GRC blocks to YML
Conversion done by Mickey Vänskä <>

Signed-off-by: Sylvain Munaut <>
2020-02-16 09:51:37 +01:00
Sylvain Munaut 982945a477 build: Update CMakeLists.txt copyright header
Part of GNURadio 3.8 migration

Signed-off-by: Sylvain Munaut <>
2020-02-16 09:51:37 +01:00
Sylvain Munaut 8c2f912037 docs: Update docs template to the latest from GNURadio
Part of GNURadio 3.8 migration

Signed-off-by: Sylvain Munaut <>
2020-02-16 09:51:37 +01:00
Sylvain Munaut b9e1ebd9e7 build: Remove cmake modules previously copied from GR tree
Part of GNURadio 3.8 migration

Signed-off-by: Sylvain Munaut <>
2020-02-16 09:51:37 +01:00
Sylvain Munaut a95bbd7418 update version to 0.1.5
Signed-off-by: Sylvain Munaut <>
2019-12-01 03:33:06 +01:00
Robert Ghilduta 4d83c6067f bladerf: update bladerf to catch up with libbladeRF 2018-08-15 19:53:26 +02:00
Rey Tucker c06db96489 bladeRF: add support for biastee on bladeRF micro 2018-08-15 19:53:26 +02:00
Rey Tucker 2e2ff98c83 bladerf: remove vestigial map 2018-08-15 19:53:26 +02:00
Rey Tucker b4e69137f3 bladerf: use bladerf_get_channel_count where available 2018-08-15 19:53:26 +02:00
Rey Tucker bee32d9f0d bladerf: compatibility with older libbladeRF
Implement compatibility with older libbladeRF versions
2018-08-15 19:53:26 +02:00
Rey Tucker 8f8b137cee bladerf: add support for MIMO
Squashed commit of rtucker-bladerf-hierarchy branch:

commit 35442da7d390919f6f9cbae3f69d6dc32ca595bb
commit 9026136cfdbc7116f55af18cb06d1731330fa13f
2018-08-15 19:53:26 +02:00
Rey Tucker c4a0781367 bladerf_common: tweak buffer/transfer settings
Based on experimentation, a good value for transfers seems to be 16, but
more buffers are definitely warranted for an optimal default experience.
2018-08-15 19:53:26 +02:00
Ryan Tucker c8e69edb7b bladerf: add set_rx_mux_mode functionality
Also plumb through as rxmux= device argument
2018-08-15 19:53:26 +02:00
Ryan Tucker 68ba383fd5 bladerf: add firmware loopback mode 2018-08-15 19:53:26 +02:00
Ryan Tucker ea6cc4beb9 bladerf_common: add agc= option to set gain mode 2018-08-15 19:53:26 +02:00