From 4eee15643f2aba9253a6c99f589501c92467e199 Mon Sep 17 00:00:00 2001 From: Marc Lichtman Date: Tue, 5 Nov 2024 00:09:46 -0500 Subject: [PATCH] use new callback signature (#54) --- content/hackrf.rst | 4 ++-- figure-generating-scripts/hackrf.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/content/hackrf.rst b/content/hackrf.rst index 82b40da..8c47213 100644 --- a/content/hackrf.rst +++ b/content/hackrf.rst @@ -120,7 +120,7 @@ If your max is 127 (which means you saturated the ADC) then lower the two gain v Installing the Python API ######################### -Lastly, we must install the HackRF One `Python bindings `_, maintained by `GvozdevLeonid `_. This was tested to work in Ubuntu 22.04 on 10/19/2024. +Lastly, we must install the HackRF One `Python bindings `_, maintained by `GvozdevLeonid `_. This was tested to work in Ubuntu 22.04 on 11/04/2024 using the latest main branch. .. code-block:: bash @@ -220,7 +220,7 @@ After running the code below, if in your time plot, the samples are reaching the samples = np.zeros(num_samples, dtype=np.complex64) last_idx = 0 - def rx_callback(buffer, buffer_length, valid_length): # this callback function always needs to have these three args + def rx_callback(device, buffer, buffer_length, valid_length): # this callback function always needs to have these four args global samples, last_idx accepted = valid_length // 2 diff --git a/figure-generating-scripts/hackrf.py b/figure-generating-scripts/hackrf.py index 6acb904..0049f91 100644 --- a/figure-generating-scripts/hackrf.py +++ b/figure-generating-scripts/hackrf.py @@ -47,6 +47,8 @@ sdr.pyhackrf_set_lna_gain(30) # LNA gain - 0 to 40 dB in 8 dB steps sdr.pyhackrf_set_vga_gain(50) # VGA gain - 0 to 62 dB in 2 dB steps sdr.pyhackrf_close() + + exit() # These settings should match the hackrf_transfer example used in the textbook, and the resulting waterfall should look about the same @@ -80,7 +82,7 @@ samples = np.zeros(num_samples, dtype=np.complex64) last_idx = 0 -def rx_callback(buffer, buffer_length, valid_length): # this callback function always needs to have these three args +def rx_callback(device, buffer, buffer_length, valid_length): # this callback function always needs to have these four args global samples, last_idx accepted = valid_length // 2