203 Commits

Author SHA1 Message Date
Michael Ossmann
aa0485d4df Revert "Cleanup of host software CMake build system (#664)"
This reverts commit d60fb83320cea49fd20305f22838f948557f1b81.
2021-12-08 16:59:05 -07:00
Jamie Smith
d60fb83320 Cleanup of host software CMake build system (#664)
* Clean up the CMake build system and improve the FindFFTW3 module.

* Fixes for Linux build

* Include winsock.h to get struct timeval

* Couple more fixes for MSVC, also add new FindMath module

* Update host build README for new CMake changes (esp. Windows)

* Try to fix Travis OS X build error

* Add docs about pthread-win32

* Whoops, AppVeyor caught a bug in FindFFTW where the includes not being found weren't generating a fatal error.

* Travis rebuild bump

* One more fix: replace hardcoded include paths with a PATH_SUFFIX to standard include paths

* Invert Windows preprocessor flag so it's only needed when using a static build.  This preserves compatibility with the previous system.

* Fix copy-paste error

* Update cmake modules from amber-cmake upstream, incorporate TryLinkLibrary into FindUSB1

* Fix missing include
2021-12-03 14:11:04 -05:00
Michael Ossmann
0f4f1addd1 libhackrf: document hackrf_transfer struct 2021-11-17 18:38:00 -07:00
Mike Walters
38ed075437 operacake: replace hackrf_set_operacake_ranges with hackrf_set_operacake_freq_ranges 2021-10-15 14:45:38 +01:00
Mike Walters
e41314f130 operacake: add API function to set port dwell times 2021-10-14 14:41:52 +01:00
Mike Walters
c50ebb1a36 operacake: add time switching mode 2021-10-14 14:41:52 +01:00
Mike Walters
790b5d35cf operacake: add get/set switching mode functions 2021-10-14 14:36:18 +01:00
Mike Walters
0293cf23db Opera Cake: use 0-7 instead of I2C addresses & bump USB API version 2021-07-14 18:35:31 +01:00
Michael Ossmann
2a8ed4ec59 increment .so/.pc version number to 0.6 2021-03-17 21:44:34 -06: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
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
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
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
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
82656b8f14 HackRF Opera Cake - GPIO test mode 2018-11-09 22:10:16 -07: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
bfa9f65f4e Try another work around for strdup() 2018-03-26 23:25:31 -06:00
Dominic Spill
936da52169 Third time lucky with definition to remove warning about strdup() 2018-03-26 21:31:56 -06:00
Dominic Spill
e0e02bcd7a Fix bad define (maybe) 2018-03-26 21:16:23 -06:00
Dominic Spill
c8e8d33a59 Silence warning about strdup() being deprecated 2018-03-26 20:59:55 -06:00
Dominic Spill
bb585e40a4 libhackrf: Fix Windows type warnings
MSVC compalins when we mix int and ssize_t
Declaration of hackrf_set_sample_rate_manual differed between .h and .c
2018-03-26 20:35:44 -06:00
Dominic Spill
bac06167f1 Merge branch 'mossmann-master' into multiple_hackrf_stop_rx_issue_463 2018-03-21 16:44:07 -06:00
Dominic Spill
47805d1c3b Set do_exit flag per device rather than globally 2018-03-21 16:43:22 -06:00
Dominic Spill
65c7b5aa24 Open device counting: increment when opening a device
Previously it incremented when the library was initialised, this worked
for GNU Radio flowgraphs, but broke elsewhere
2018-02-27 16:07:04 -07:00
Dominic Spill
d17f091736 libhackrf: stop_tx() put HackRF in to idle mode before killing transfer thread
This is what we do for RX and appears to prevent HackRF remaining in TX
mode. This mirrors commit 693c262
2018-02-17 16:20:08 -07:00
Georg von Zengen
73ca8c09dd libhackrf: counts the open devices, prevents exit if not all closed
fixes #435, osmosdr calls hackrf_exit for the last sink and the last
source. If both are in one flow graph the desctructor of the source
fails as the sink already closed the usb context.
This prevents hackrf_exit to close the context if not all devices are closed
2017-12-07 15:21:29 +01:00
Dominic Spill
5f560d6ad3 Merge branch 'mossmann-master' into flash-investigation 2017-12-05 16:18:19 -07:00
Dominic Spill
3f569a8ad4 hackrf_clock: Allow CLKOUT to be enabled / disabled
hackrf_clock -o 1 / hackrf_clock -o 0
2017-11-07 11:23:48 -07:00
Dominic Spill
c416fa1294 SPI Flash: add function to clear SPI flash status register 2017-11-06 10:42:19 -07:00
Dominic Spill
f20763419f Optional spi flash status read 2017-09-12 18:04:15 -06:00
Dominic Spill
8f544ee60d Add flash status read 2017-09-12 17:52:07 -06:00
Dominic Spill
44333b7635 Include path for hackrf.h is sometimes ambiguous
add both to pkg-config file
 https://github.com/pothosware/homebrew-pothos/issues/12
2017-07-07 10:02:03 -06:00
hayati ayguen
e707e448d3 fix/add missing 'LIBUSB_CALL' at libusb callback 'hackrf_libusb_transfer_callback'
this allows to remove function cast at prepare_transfers()
missing 'LIBUSB_CALL' produced problems in debugger with Visual Studio 2017

Signed-off-by: hayati ayguen <h_ayguen@web.de>
2017-06-18 23:52:23 +02:00
Dominic Spill
8c7941b0ef Opera glasses: allow user specified ranges for operacake ports
- HackRF switches antenna when tuning
 - ports specified using hackrf_operacake cmdline tool
 hackrf_operacake -f 2350:2800:0 -f 0:400:1 -f 400:700:2 -f 700:6000:3
2017-05-16 17:18:54 -06:00
Michael Ossmann
79f95abdb3 correct discrepancy between number of samples and number of bytes in blocks of samples
related to #346
2017-02-16 12:46:17 -07:00
Dominic Spill
a8c1fc92e9 Appveyor config for building hackrf_sweep (#344)
Appveyor builds for hackrf_sweep
2017-02-15 16:44:44 -07:00
Dominic Spill
49257e60e3 Remove Jellybean support from firmware
- nobody has a jellybean board
2017-02-14 21:33:52 -07:00
Michael Ossmann
e6351d7d69 fixed bug that prevented use of num_samples argument to hackrf_init_sweep() 2017-02-10 22:39:25 -07:00
Michael Ossmann
53d0b8b73e set release string in libhackrf and hackrf-tools even if they are built separately 2017-02-08 15:44:21 -07:00
Michael Ossmann
5c196eab4d Merge branch 'master' into sweep-csv 2017-02-07 14:11:22 -07:00