;; Using a git commit because there have been many many commits
;; since the relase two years ago, but no sign of a promised
;; release for many months now.
(let ((commit "43e6f99fe8543094d18ff3a6550ed2066c398862")
(version (git-version "2018.01.1" revision commit))
(origin (method git-fetch)
(file-name (git-file-name name version))
(assoc-ref %outputs "out")
(add-before 'configure 'enter-source-directory
(lambda _ (chdir "host") #t))
(add-before 'install-license-files 'leave-source-directory
(lambda _ (chdir "..") #t)))
#:tests? #f)) ; no test suite
(synopsis "User-space library and utilities for HackRF SDR")
"Command line utilities and a C library for controlling the HackRF
Software Defined Radio (SDR) over USB. Installing this package installs
the userspace hackrf utilities and C library. To install the hackrf
udev rules, you must add this package as a system service via
(udev-service-type config =>
(udev-configuration (inherit config)
(rules (cons hackrf
However, I have not submitted it as a patch yet, as I wanted to test it with my HackRF SDR first, and that let me down a rabbit trail on how to install udev rules in Guix. I’m about out of time for this project for today, so I’ll finish this up next week, God willing.
I spent quite a while troubleshooting a bug in which RX would mysteriously not restart, if you did a hackrf-stop-rx followed by another hackrf-start-rx. The problem actually was not in my code, but due to some old libhackrf bugs that had not been patched in the old Debian 9 version of libhackrf which I am using.
This is a serious enough annoyance that you won’t want to be using HackRF Shell with the unpatched version. So, I added instructions to my git repo (debian9-libhackrf-patch directory, see commit 346c50e) on how to get a patched version of the Debian 9 packages. I think that the Debian 10 library version is actually not new enough to avoid all the bugs, either, so the info I have provided might be of value to Debian 10 users as well.
I would like to switch my home system from Debian to Gnu Guix, and use Guix package management for development, but I’m not sure how soon that will happen.
I added in the baseband-filter-bandwidth control procedure, which is something I forgot to do earlier. This was critical for picking up the weaker stations, such as KJNP 100.3Mhz, which is around 20 or 30 miles away, I think. I coded some simple helper functions (in Scheme) to start and stop receiving data according to time parameters, which I will use to record my favorite radio program each morning. This example records data for one minute from 8:43pm to 8:44pm (code checkout a992f67).
scheme@(guile-user)> (define d (hackrf-open))
scheme@(guile-user)> (load "hackrf-shell-lib.scm")
scheme@(guile-user)> (hackrf-sensible-defaults d)
scheme@(guile-user)> (hackrf-set-baseband-filter-bandwidth d 2000000)
scheme@(guile-user)> (hackrf-enable-amp d)
scheme@(guile-user)> (timed-read d "out.bin" 20 43 20 44)
This still just dumps the floating point signal data to a file, rather that doing any demodulation, so the file size is very large, and I must feed it into GnuRadio. Yet, it is progress.
I need to go over the RX start/stop code again as I get an error if I try to start RX again after stopping it. I coded that part of the device management rather quickly so I am not surprised.
I started playing around with merging in FFT functionality. I added an fft-512 procedure which does FFT on a 512 byte buffer using libfftwf. I think it works, but I haven’t added any procedures yet to do anything useful with fft-512 so I don’t really know yet. I was going to code something which feeds data to GnuPlot for a spectrum analysis display, in the usual fashion like all the SDR software does:
I have been learning a lot lately about Fourier transform and DFT (Discrete Fourier Transform) and I think I have a mostly clear understanding of the basic math and concepts involved now. For fun, I did a DFT operation manually in Emacs Calc on a length 8 data sample, and the results came out making sense. This article is a nice introduction to the Fourier transform, though you need to have a good understanding of complex numbers to fully grasp the DFT equation: