From 201695bb67ed90ffcc4b7919057e17b2e23043e0 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 11 Jan 2017 01:21:22 +0100 Subject: [PATCH] HackRF plugins: correct start/stop sequences --- Readme.md | 2 +- plugins/samplesink/bladerfoutput/readme.md | 2 ++ .../samplesink/hackrfoutput/hackrfoutputthread.cpp | 6 +++--- .../samplesource/hackrfinput/hackrfinputthread.cpp | 14 ++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Readme.md b/Readme.md index 21148831d..3d54e7e05 100644 --- a/Readme.md +++ b/Readme.md @@ -30,7 +30,7 @@ From version 2 SDRangel can integrate more than one hardware device running conc From version 3 transmission or signal generation is supported for BladeRF and HackRF (since version 3.1) using a sample sink plugin. These plugins are: - - [BladeRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/bladerfoutput) + - [BladeRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/bladerfoutput) limited support in Windows - [HackRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/hackrfoutput) - [File output or file sink plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/filesink) diff --git a/plugins/samplesink/bladerfoutput/readme.md b/plugins/samplesink/bladerfoutput/readme.md index 9c20967ce..30c7bbe4a 100644 --- a/plugins/samplesink/bladerfoutput/readme.md +++ b/plugins/samplesink/bladerfoutput/readme.md @@ -4,6 +4,8 @@ This output sample sink plugin sends its samples to a [BladeRF device](https://www.nuand.com/). +Warning to Windows users: concurrent use of Rx and Tx does not work correctly hence full duplex is not fully operational. For best results use BladeRF as a half duplex device like HackRF i.e. do not run Tx and Rx concurrently. +

Build

The plugin will be built only if the [BladeRF host library](https://github.com/Nuand/bladeRF) is installed in your system. If you build it from source and install it in a custom location say: `/opt/install/libbladeRF` you will have to add `-DLIBBLADERF_INCLUDE_DIR=/opt/install/libbladeRF/include -DLIBBLADERF_LIBRARIES=/opt/install/libbladeRF/lib/libbladeRF.so` to the cmake command line. diff --git a/plugins/samplesink/hackrfoutput/hackrfoutputthread.cpp b/plugins/samplesink/hackrfoutput/hackrfoutputthread.cpp index 9b2e7f0d1..a5d4b050d 100644 --- a/plugins/samplesink/hackrfoutput/hackrfoutputthread.cpp +++ b/plugins/samplesink/hackrfoutput/hackrfoutputthread.cpp @@ -67,11 +67,11 @@ void HackRFOutputThread::run() { hackrf_error rc; - m_running = true; - m_startWaiter.wakeAll(); - rc = (hackrf_error) hackrf_start_tx(m_dev, tx_callback, this); + m_running = true; + m_startWaiter.wakeAll(); + if (rc != HACKRF_SUCCESS) { qCritical("HackRFOutputThread::run: failed to start HackRF Tx: %s", hackrf_error_name(rc)); diff --git a/plugins/samplesource/hackrfinput/hackrfinputthread.cpp b/plugins/samplesource/hackrfinput/hackrfinputthread.cpp index 02373277a..6b1d37a68 100644 --- a/plugins/samplesource/hackrfinput/hackrfinputthread.cpp +++ b/plugins/samplesource/hackrfinput/hackrfinputthread.cpp @@ -41,13 +41,11 @@ HackRFInputThread::~HackRFInputThread() void HackRFInputThread::startWork() { - //m_startWaitMutex.lock(); - m_running = true; + m_startWaitMutex.lock(); start(); - /* while(!m_running) m_startWaiter.wait(&m_startWaitMutex, 100); - m_startWaitMutex.unlock();*/ + m_startWaitMutex.unlock(); } void HackRFInputThread::stopWork() @@ -76,11 +74,11 @@ void HackRFInputThread::run() { hackrf_error rc; - //m_running = true; - m_startWaiter.wakeAll(); - rc = (hackrf_error) hackrf_start_rx(m_dev, rx_callback, this); + m_running = true; + m_startWaiter.wakeAll(); + if (rc != HACKRF_SUCCESS) { qCritical("HackRFThread::run: failed to start HackRF Rx: %s", hackrf_error_name(rc)); @@ -104,7 +102,7 @@ void HackRFInputThread::run() qDebug("HackRFThread::run: failed to stop HackRF Rx: %s", hackrf_error_name(rc)); } - //m_running = false; + m_running = false; } // Decimate according to specified log2 (ex: log2=4 => decim=16)