pothosware / SoapyAirspyHF

SoapySDR plugin to support the Airspy HF+
https://github.com/pothosware/SoapyAirspyHF/wiki
MIT License
24 stars 17 forks source link

Gains disabled incorrectly by version detection #24

Closed willcode closed 1 year ago

willcode commented 1 year ago

The current libairspyhf is v1.7.1. This code https://github.com/pothosware/SoapyAirspyHF/blob/d6825331a6bfc3578dc6fe5091fce3d550b6af3c/Settings.cpp#L29 detects that as being too old to define HASGAINS, so several parameters are disabled.

dlpwx commented 1 year ago

I can reproduce this. With current master Settings.cpp,

SoapySDRUtil --probe="driver=airspyhf"
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Probe device driver=airspyhf

----------------------------------------------------
-- Device identification
----------------------------------------------------
  driver=AirspyHF
  hardware=AirspyHF
  serial=my_ser
----------------------------------------------------
-- Peripheral summary
----------------------------------------------------
  Channels: 1 Rx, 0 Tx
  Timestamps: NO

----------------------------------------------------
-- RX Channel 0
----------------------------------------------------
  Full-duplex: NO
  Supports AGC: YES
  Stream formats: CF32, CS16, CS8, CU16, CU8
  Native format: CF32 [full-scale=1]
  Antennas: RX
  Full gain range: [0, 0] dB
  Full freq range: [0.009, 31], [60, 260] MHz
    RF freq range: [0.009, 31], [60, 260] MHz
  Sample rates: 0.912, 0.768, 0.456, 0.384, 0.256, 0.192 MSps

After changing if AIRSPYHF_VER_MAJOR >= 1 to if AIRSPYHF_VER_MAJOR >= 0 and rebuild for example,

SoapySDRUtil --probe="driver=airspyhf"
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Probe device driver=airspyhf

----------------------------------------------------
-- Device identification
----------------------------------------------------
  driver=AirspyHF
  hardware=AirspyHF
  serial=my_ser

----------------------------------------------------
-- Peripheral summary
----------------------------------------------------
  Channels: 1 Rx, 0 Tx
  Timestamps: NO

----------------------------------------------------
-- RX Channel 0
----------------------------------------------------
  Full-duplex: NO
  Supports AGC: YES
  Stream formats: CF32, CS16, CS8, CU16, CU8
  Native format: CF32 [full-scale=1]
  Antennas: RX
  Full gain range: [0, 54] dB
    LNA gain range: [0, 6, 6] dB
    RF gain range: [-48, 0, 6] dB
  Full freq range: [0.009, 31], [60, 260] MHz
    RF freq range: [0.009, 31], [60, 260] MHz
  Sample rates: 0.912, 0.768, 0.456, 0.384, 0.256, 0.192 MSps
joansola commented 1 year ago

Where can I find airspyhf and libairspyhf sources for version 1.7.1? On github/airspy/airspyhf I only find up to 1.6.8

Also, in conda I can find 1.6.8

I am on MacOS

The issue is that I cannot get the HASGAINS variable to get defined, and therefore the RF and LNA gains are unavailable.

willcode commented 1 year ago

I'm not sure why I wrote 1.7.1. That tag may have been deleted or I may have imagined it. The latest does appear to be 1.6.8, and that version has the required function (airspyhf_set_hf_att) to define HASGAINS on the compile line. I pulled the latest github code from the master branches of both airspyhf and soapyairspyhf.

(edit) in libairspyhf/src/airspyhf.h

#define AIRSPYHF_VERSION "1.7.1"

so that's the version internally. It just hasn't been tagged. In any case, the version doesn't matter now, as the soapyairspyhf code looks for a function instead of trying to match the version.

joansola commented 1 year ago

Thanks.

But then the problem in my case persists. I have 1.6.8., or 1.7.1, whatever the case. I install it with conda:

  Package        Version  Build       Channel                     Size
────────────────────────────────────────────────────────────────────────
  Install:
────────────────────────────────────────────────────────────────────────

  + airspyhf       1.6.8  h3422bc3_0  conda-forge/osx-arm64     Cached
  + libairspyhf    1.6.8  h3422bc3_0  conda-forge/osx-arm64     Cached

But when running cmake, I get this message:

-- Looking for airspyhf_set_hf_att
-- Looking for airspyhf_set_hf_att - not found

and so I get disabled gains.

In case it hellps, here's the full cmake output:

(wolf) jsola@10-192-35-211client build % cmake ..              
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type not specified: defaulting to release.
-- Found PkgConfig: /Users/jsola/mambaforge/envs/wolf/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'libairspyhf'
--   Found libairspyhf, version 1.6
-- Found LIBAIRSPYHF: /Users/jsola/mambaforge/envs/wolf/lib/libairspyhf.dylib  
-- Found Git: /usr/bin/git (found version "2.39.3 (Apple Git-145)") 
-- Module airspyhfSupport configured with version: 0.2.0-a2fd6cf
-- Looking for airspyhf_set_hf_att
-- Looking for airspyhf_set_hf_att - not found
-- Configuring done (0.7s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/jsola/dev/SoapyAirspyHF/build

so libairspyhf is found to be 1.6, but still the function is not found.

any idea?

willcode commented 1 year ago

I don't do builds under conda, but it works fine outside it. In a radioconda install with

$ conda list|grep airspy
airspy                    1.0.10               h7f98852_0    conda-forge
airspyhf                  1.6.8                h7f98852_0    conda-forge
libairspy                 1.0.10               h7f98852_0    conda-forge
libairspyhf               1.6.8                h7f98852_0    conda-forge
soapysdr-module-airspy    0.2.0                hee64af1_0    conda-forge
soapysdr-module-airspyhf  0.2.0                hee64af1_0    conda-forge

the include file and the .so contain the required symbol.

joansola commented 1 year ago

OK I got it to work after installing soapysdr-module-airspyhf also through conda (I did not know the name of the conda package so this one I was installing from source)