662 Commits

Author SHA1 Message Date
Demetri Maltsiniotis
e664321cc6 Adding call to _setmode for Windows only to specify binary stdout output piping. 2021-04-07 15:11:44 -05:00
Yan
ab4498f8ac hackrf_sweep: exit early from rx_callback if do_exit set
Sometimes, if a small frequency interval is scanned, the callback is
triggered even though we already have the number of sweeps we want, and
sweep_count gets increased, showing the wrong "Total sweeps".
2021-03-20 10:07:51 +01:00
Yan
4c46fc74b3 hackrf_sweep: speed up ending by removing unnecessary code
hackrf_stop_rx() is handled in hackrf_close(), so there seems to be no need
to call it separately.  Furthermore, if hackrf_stop() is called separately,
it causes hackrf_close() to take more than half a second longer.
2021-03-19 16:31:37 +01:00
Yan
2ef7995763 hackrf_sweep: flush output earlier
Gives listener access to complete data faster.
Otherwise the data might be delayed until the whole closing procedure is done.
2021-03-19 16:29:21 +01:00
Michael Ossmann
e6eb4ba29b Merge pull request #848 from mossmann/pre-release
Pre release
2021-03-18 14:36:50 -06:00
Mike Walters
5361b3a7f4 hackrf_sweep: switch main loop timing back to 1Hz
fixes #850
fixes #851
2021-03-18 19:48:53 +00:00
Michael Ossmann
2a8ed4ec59 increment .so/.pc version number to 0.6 2021-03-17 21:44:34 -06:00
Michael Ossmann
2ca991e1df Flush output streams. Do not fclose stdout/stdin. 2021-01-27 12:12:45 -07:00
Michael Ossmann
a6fa7876cb Give descriptive names to streams.
They were previously given the confusing name of fd even though they are
not file descriptors.
2021-01-27 11:59:29 -07:00
Michael Ossmann
8fead43cf2 Merge pull request #748 from ggatis/patch-1
Update hackrf_sweep.c
2021-01-27 11:38:45 -07:00
adrian chadd
61a06b904d Handle hackrf_close() being called without TX or RX being started.
My previous commits didn't handle the specific case of hackrf_close()
being called without the transfers being active.

In this instance the transfers haven't been setup, so calling
cancel_transfers() returned an error.

Instead:

* refactor out the tx/rx stop command from canceling transfers
* send the tx/rx stop command without canceling transfers, since ..
* ... we can then destroy the transfer thread.

I may also need to put an explicit cancel_transfers() before the
call to send the tx/rx stop commands; I'll look at doing that
in a subsequent commit.
2020-12-10 15:57:54 -08:00
Adrian Chadd
b4ea51a36b add 10ms sleep after stop
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.
2020-11-09 10:40:44 -08:00
Adrian Chadd
9a278d267a Fix streaming hangs in consumers
* Update device->streaming to reflect whether we're streaming data,
  rather than just whether the streaming thread is active.
  The streaming thread is now always active!
2020-11-09 09:42:34 -08:00
Adrian Chadd
0961a76f26 Fix libusb usage for at least freebsd around the worker thread and transfer cancellation
On at least freebsd-13 trying to cancel a transfer whilst the libusb thread
is not running results in the transfers not completing cancellation.
The next time they're attempted to be re-added the libusb code thinks
they're still active, and returns BUSY on the buffers.

This causes gqrx to error out when one makes DSP changes or stops/starts it.
You have to restart gqrx to fix it.

After digging into it a bit, the libusb code expects that you're actively
running the main loop in order to have some deferred actions run in the
context of said main loop thread.  This includes processing cancelled
transfers - the callbacks have to be run (if they exist) before the
buffers are properly cancelled and have their tracking metadata (a couple of
private pointers and state) removed from inside of libusb.

This patch does the following:

* separate out adding and cancelling transfers from the libusb worker thread
  create/destroy path
* create the libusb worker thread when opening the device
* destroy the libusb worker thread when closing the device
* only add and cancel transfers when starting and stopping tx/rx
* handle cancelled transfers gracefully in the USB callback

Whilst here, also make the libusb device memory zeroed by using
calloc instead of malloc.

This fixes all of the weird libusb related buffer management problems
on FreeBSD.
2020-11-08 21:38:39 -08:00
Michael Ossmann
451873d616 Merge pull request #716 from Jakub6/master
fix _FILE_OFFSET_BITS 64 position in hackrf_transfer.c
2020-07-26 07:39:17 -06:00
ggatis
38f6d4c828 Update hackrf_sweep.c
change if ( fd != NULL ) to if ( ( fd != NULL ) && ( fd != stdout ) )
before fclose( fd );
2020-06-16 13:55:50 +03:00
jaj
a9f6cbc367 fix _FILE_OFFSET_BITS 64 position in hackrf_transfer.c (must be included before <sys/stat.h>) 2020-03-16 13:16:15 +01:00
Mike Walters
1c091a10bf libhackrf: Zero-out initial transfer buffers 2020-02-12 18:53:59 +00:00
Michael Ossmann
c0aed2edb7 firmware: clean up transceiver modes 2020-02-11 16:59:59 +00:00
Mike Walters
4aac303480 Add option to disable HackRF UI
Fixes #608
2020-01-22 21:23:30 +00:00
Michael Ossmann
ecd82e81c1 remove specific sample rate recommendations
HackRF One supports arbitrary sample rates from 2 Msps to 20 Msps.  In
early development we had ideas about preferred sample rates that we no
longer consider valid.
2020-01-22 06:39:08 -07:00
Michael Ossmann
8ff56c615f Merge pull request #661 from mgesteiro/hackrf_transfer-fix
FIXED: remove garbage at the end when capturing to stdout ('-r -')
2020-01-06 16:43:14 -07:00
Matioupi
1442014a80 Modified hackrf_stop_tx and hackrf_stop_rx to first join the transfer thread
before setting the receiver to OFF mode (cf. issue #650)
2020-01-06 16:37:05 -07:00
Michael Ossmann
208fae7538 Merge pull request #645 from jboone/master
Sync up PortaPack UI changes.
2020-01-06 16:31:28 -07:00
Michael Ossmann
1569737109 Merge pull request #607 from dominicgs/portapack_ui_opera_cake_coexistence
Allow portapack and opera cake to coexist and still enable the PP UI
2020-01-06 16:28:58 -07:00
Mike Walters
dcb98f7f51 Get FFTW library dir 2019-12-10 18:46:51 +00:00
Mike Walters
d9897e03b1 Fix FFTW include dir 2019-12-10 18:46:51 +00:00
mgesteiro
c2d2492d41 FIXED: remove garbage at the end when capturing to stdout ('-r -') 2019-11-12 09:03:51 +01:00
Jared Boone
ef5b907295 CPLD: Remove checksum function from libhackrf and hackrf_info.
The checksum calculation process was causing the CPLD configuration to reload from flash. With the new SRAM loading mechanism, flash contents may not be up to date, so the CPLD bitstream may regress to the point of not working or not working correctly. This commit is a short-term fix for mossmann/hackrf issue #609.
2019-03-27 12:16:39 -07:00
Dominic Spill
b701579906 Allow portapack and opera cake to coexist and still enable the PP UI
The side effect of this is to disable GPIO mode for OC, but I2C still
works
Using both addons together is super unlikely
2019-02-01 12:04:40 -07:00
Jared Boone
fa2a9acd1a USB: initial CPLD checksum API support. 2019-01-31 21:19:21 +00:00
Jared Boone
8721fe606a Host: Add USB request ordinal for WCID 2019-01-09 15:07:08 -08:00
Dominic Spill
847d00d770 Fix typo in still in use error message 2018-12-18 14:42:41 -07:00
Michael Ossmann
74ef45a0dd Merge pull request #558 from dominicgs/multiple_hackrf_stop_rx_issue_463
Fix multiple hackrf stop rx
2018-12-06 15:48:53 -07:00
Dominic Spill
56b3bd0bed Merge pull request #546 from dominicgs/operacake_gpio
HackRF Opera Cake - GPIO test mode
2018-11-30 05:07:31 +11:00
w0xel
20b351916e Fix compile with fftw3f not in system dir 2018-11-19 16:04:27 +01:00
Dominic Spill
82656b8f14 HackRF Opera Cake - GPIO test mode 2018-11-09 22:10:16 -07:00
Dominic Spill
b02a8f2e8d Merge pull request #545 from GravesJake/sweep_n
Add limited sweep mode
2018-11-07 11:48:51 -07:00
GravesJake
c47f2b1162 Add cross-platform support for sleeping for milliseconds 2018-11-07 11:35:04 -07:00
GravesJake
39062a7a7b Remove usleep (incompatible with Windows) 2018-11-07 11:24:13 -07:00
GravesJake
982770b25b Add limited sweep mode 2018-11-07 10:49:49 -07:00
Dominic Spill
4e881efa7b match opera cake port designations to silkscreen - closed #531 2018-10-03 14:13:59 -06:00
Dominic Spill
4c2146aa7a Clean up opera cake range parsing code and improve error handling 2018-10-03 11:58:15 -06:00
bl4krat
540f86a5b0 Fixed operation of switch --list 2018-09-07 04:25:19 +01:00
Arnout Vandecappelle (Essensium/Mind)
a6284cb9ed Don't require a C++ compiler
By default, CMake assumes that the project is using both C and C++.  By
explicitly passing 'C' as argument of the project() macro, we tell CMake
that only C is used, which prevents CMake from erroring out if a C++
compiler doesn't exist.
2018-03-31 22:50:37 +02:00
Michael Ossmann
5fbd75ef94 Merge pull request #468 from dominicgs/appveyor
Appveyor
2018-03-28 09:15:11 -06:00
Dominic Spill
bde5ca9f58 DFU serial number - avoid reading serial from flash chip
Set a DFU mode specific serial number
2018-03-27 18:08:49 -06:00
Dominic Spill
cf4b3ae7f4 Cast all the things 2018-03-27 14:30:41 -06:00
Dominic Spill
e384a2d2b7 Explicitly cast variables to silence Windows build warnings 2018-03-27 14:11:51 -06:00
Dominic Spill
d4d74db27c Add helper functions for parsing frequency arguments 2018-03-27 11:57:52 -06:00