Skip to content

Commit

Permalink
add 10ms sleep after stop
Browse files Browse the repository at this point in the history
This seems to stop consumers that are doing quick back to back stop/start
(eg gqrx changing decode mode / filter bandwidth) from hanging the
device.

I now don't have any weird hangs on hackrf with gqrx/freebsd/libusb!

When things hang it isn't erroring out in any way; it just doesn't
start receive.  It doesn't look like a libusb issue; I'd have to get
some USB bus sniffing to see what's going on behind the scenes.
  • Loading branch information
Adrian Chadd committed Nov 9, 2020
1 parent 9a278d2 commit 4ae1a96
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions host/libhackrf/src/hackrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI

#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libusb.h>

#ifdef _WIN32
Expand Down Expand Up @@ -1688,6 +1689,7 @@ int ADDCALL hackrf_stop_rx(hackrf_device* device)
return result;
}
result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF);
usleep(10 * 1000);
return result;
}

Expand Down Expand Up @@ -1717,6 +1719,7 @@ int ADDCALL hackrf_stop_tx(hackrf_device* device)
return result;
}
result = hackrf_set_transceiver_mode(device, HACKRF_TRANSCEIVER_MODE_OFF);
usleep(10 * 1000);
return result;
}

Expand Down

0 comments on commit 4ae1a96

Please sign in to comment.