Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No SoapySDR API returns the gain values list of RTLSDR dongles. #58

Open
gmbertani opened this issue May 24, 2021 · 0 comments
Open

No SoapySDR API returns the gain values list of RTLSDR dongles. #58

gmbertani opened this issue May 24, 2021 · 0 comments

Comments

@gmbertani
Copy link

The RTL-SDR valid tuner gains values are returned by librtlsdr:rtlsdr_get_tuner_gains().
These values change with the tuner type. For R820T tuner for instance it's a nonlinear list of 29 values:
0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6

The SoapyRTLSDR::SoapyRTLSDR() constructor loads this full list from the dongle but -
since the SoapySDR API getGainRange() returns only a range (3-values tuple) -
only the minimum and maximum of these values, can be read (the third element, step, is zero):

//extract min/max overall gain range

int num_gains = rtlsdr_get_tuner_gains(dev, nullptr);

if (num_gains > 0)
{
    std::vector<int> gains(num_gains);
    rtlsdr_get_tuner_gains(dev, gains.data());
    gainMin = *std::min_element(gains.begin(), gains.end()) / 10.0;
    gainMax = *std::max_element(gains.begin(), gains.end()) / 10.0;
}

So it's matter to make the gains vector a class member and find a way (API) to return its contents to the
application.

@guruofquality guruofquality transferred this issue from pothosware/SoapySDR Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant