gqrx icon indicating copy to clipboard operation
gqrx copied to clipboard

GQRX freezes with hackRF 2021.03.1 driver

Open Potomac opened this issue 3 years ago • 5 comments

Hello, I use archlinux, recently they have updated hackRF driver 2018 to 2021.03.1 version : https://archlinux.org/packages/community/x86_64/hackrf/

With 2021.3.1 hackrf driver version I notice that GQRX 2.14.4 freezes randomly when I switch several times frequency mode option in the GUI (for example AM to FM, FM to LSB), randomly (30% of the time) GQRX freezes and then I hear no sound from hackRF (a 2014 PCB version),

if I downgrade hackrf driver to 2018 version then all is OK, no random freezes from GQRX when changing frequency mode (AM, FM, LSB etc...), I use 2021-03 firmware.

Thanks.

Potomac avatar Apr 24 '21 22:04 Potomac

If I use the official appimage of Gqrx (last version, same as archlinux package : 2.14.4) then there is no freeze, no bug with hackRF 2021-03-1 driver : https://github.com/csete/gqrx/releases

The bug occurs with the archlinux package of Gqrx. https://archlinux.org/packages/community/x86_64/gqrx/

Potomac avatar Apr 25 '21 01:04 Potomac

But the appimage can also contain hackRF lib in 2018-01 version, that can explain why there is no freeze.

Potomac avatar Apr 25 '21 02:04 Potomac

I made a git bisect and I found the faulty commit in the hackrf lib :

1442014a80b5ce33f16ef665538c2881b37d3a68 is the first bad commit
commit 1442014a80b5ce33f16ef665538c2881b37d3a68
Author: Matioupi <[email protected]>
Date:   Wed Oct 16 12:03:08 2019 +0200

    Modified hackrf_stop_tx and hackrf_stop_rx to first join the transfer thread
    before setting the receiver to OFF mode (cf. issue #650)

 host/libhackrf/src/hackrf.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

https://github.com/mossmann/hackrf/commit/1442014a80b5ce33f16ef665538c2881b37d3a68

This faulty commit triggers crash on GQRX when using a recent hackRF chinese model (bought in april 2021), and for the moment only GQRX is affected.

Reverting this commit should fix the problem.

Full git bisect log :

git bisect start
# good: [cc7f599677e222a19a2ba4336a23e1fb507cf9f6] Pin OS X builds to Xcode 7.3 for now
git bisect good cc7f599677e222a19a2ba4336a23e1fb507cf9f6
# bad: [e6eb4ba29bbe5dc2fcd092e394188bc10a8bad54] Merge pull request #848 from mossmann/pre-release
git bisect bad e6eb4ba29bbe5dc2fcd092e394188bc10a8bad54
# good: [56b3bd0bed544cf40c9287c6d2b1c811608eda57] Merge pull request #546 from dominicgs/operacake_gpio
git bisect good 56b3bd0bed544cf40c9287c6d2b1c811608eda57
# good: [1c7bf39bda81accb67d04c46aa08808d863180b8] Merge branch 'develop'
git bisect good 1c7bf39bda81accb67d04c46aa08808d863180b8
# bad: [92ee1447143aed8d6b7e291e98e4139190206aac] Merge pull request #699 from miek/ui_disable
git bisect bad 92ee1447143aed8d6b7e291e98e4139190206aac
# good: [923f9fe617c9dcf00c97c18f5aa79e51720b9e59] Merge remote-tracking branch 'mossmann/master'
git bisect good 923f9fe617c9dcf00c97c18f5aa79e51720b9e59
# bad: [058276d010d437486c4e0ee4e0b7fe3f3e52f836] Merge pull request #671 from yhetti/acrylic_case
git bisect bad 058276d010d437486c4e0ee4e0b7fe3f3e52f836
# good: [1569737109283ef944c3ae4d803bbcbb3a523fbf] Merge pull request #607 from dominicgs/portapack_ui_opera_cake_coexistence
git bisect good 1569737109283ef944c3ae4d803bbcbb3a523fbf
# bad: [8ff56c615fa8835e8a0db36ed754e2793ada9a9b] Merge pull request #661 from mgesteiro/hackrf_transfer-fix
git bisect bad 8ff56c615fa8835e8a0db36ed754e2793ada9a9b
# bad: [1442014a80b5ce33f16ef665538c2881b37d3a68] Modified hackrf_stop_tx and hackrf_stop_rx to first join the transfer thread before setting the receiver to OFF mode (cf. issue #650)
git bisect bad 1442014a80b5ce33f16ef665538c2881b37d3a68
# good: [208fae75389e1888c6118f12b79c4ac7522fe372] Merge pull request #645 from jboone/master
git bisect good 208fae75389e1888c6118f12b79c4ac7522fe372
# first bad commit: [1442014a80b5ce33f16ef665538c2881b37d3a68] Modified hackrf_stop_tx and hackrf_stop_rx to first join the transfer thread before setting the receiver to OFF mode (cf. issue #650)

Potomac avatar Apr 28 '21 22:04 Potomac

Sadly reverting this commit from hackrf is not enough for solving freezes in Gqrx, as recent commits in hackrf change also start/stop rx, tx functions, 1442014 is just the first bad commit, the problem may be more deep, related to thread management, usb transfert, it will need more debugging for solving this bug.

Potomac avatar Apr 29 '21 02:04 Potomac

The bug is fixed by these commits made by Martinling : https://github.com/greatscottgadgets/hackrf/pull/1029

The bug was due to a race condition triggered by 2021.3 driver and firmware version of hackRF.

Potomac avatar Feb 04 '22 01:02 Potomac

Closing, as the issue appears to have been resolved upstream.

argilo avatar Apr 30 '23 00:04 argilo