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

bladerf_get_gain_modes implemented inconsistently between bladeRF1 and bladeRF2. #968

Open
antiduh opened this issue May 10, 2024 · 0 comments

Comments

@antiduh
Copy link

antiduh commented May 10, 2024

The documentation for bladerf_get_gain_modes says that you can pass in NULL so you can query the size of the mode list before you call it again:

https://www.nuand.com/libbladeRF-doc/v2.5.0/group___f_n___g_a_i_n.html#ga5350f1868a06dc92bef4ea0f07914f42

"This function may be called with NULL for modes to determine the number of gain modes supported."

And indeed this is how it's implemented for bladeRF1:

static int bladerf1_get_gain_modes(struct bladerf *dev,
                                   bladerf_channel ch,
                                   struct bladerf_gain_modes const **modes)
{
...
    if (modes != NULL) {
        *modes = mode_infos;
    }

However, bladeRF2 does not work this way. The first thing the function does is a null check, so the function stops immediately with an error code instead:

static int bladerf2_get_gain_modes(struct bladerf *dev,
                                   bladerf_channel ch,
                                   struct bladerf_gain_modes const **modes)
{
    NULL_CHECK(modes);
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