fix: remove stale static cache in find_PlutoSDR#76
Merged
zuckschwerdt merged 1 commit intoMay 18, 2026
Conversation
Static `results` variable caused find_PlutoSDR to return the same device list on every call, ignoring args and preventing detection of connect/disconnect events.
Member
|
Thanks for testing the idea to remove the caching! |
Contributor
Author
Happy to help! Let me know if any changes are needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
find_PlutoSDRfunction used a staticresultsvariable that was populated only once and never invalidated. This caused two issues:enumerate()with a specificurialways returned all devices instead of filtering by the requested one, causingSoapySDR::Device::make()to always open the first discovered device regardless of the provided args.enumerate()calls since the list was never refreshed.Fix
Moved
resultsfrom a static global variable to a local variable insidefind_PlutoSDR. The existing URI filtering logic inside the function now works correctly, and SoapySDR's own enumerate cache (with a 1-second TTL) handles caching at a higher level.Testing
Tested with two PlutoSDR devices connected simultaneously via USB. Both devices are now correctly opened by their respective
uri, and hot-plug/unplug is properly detected on subsequentenumerate()calls.Closes #66