Skip to content

fix: remove stale static cache in find_PlutoSDR#76

Merged
zuckschwerdt merged 1 commit into
pothosware:masterfrom
DSR3164:fix-enumerate-stale-results
May 18, 2026
Merged

fix: remove stale static cache in find_PlutoSDR#76
zuckschwerdt merged 1 commit into
pothosware:masterfrom
DSR3164:fix-enumerate-stale-results

Conversation

@DSR3164
Copy link
Copy Markdown
Contributor

@DSR3164 DSR3164 commented May 16, 2026

Problem

The find_PlutoSDR function used a static results variable that was populated only once and never invalidated. This caused two issues:

  • URI filter ignored: calling enumerate() with a specific uri always returned all devices instead of filtering by the requested one, causing SoapySDR::Device::make() to always open the first discovered device regardless of the provided args.
  • Stale results: connect/disconnect events were not reflected in subsequent enumerate() calls since the list was never refreshed.

Fix

Moved results from a static global variable to a local variable inside find_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 subsequent enumerate() calls.

Closes #66

Static `results` variable caused find_PlutoSDR to return the same
device list on every call, ignoring args and preventing detection
of connect/disconnect events.
@zuckschwerdt
Copy link
Copy Markdown
Member

Thanks for testing the idea to remove the caching!

@DSR3164
Copy link
Copy Markdown
Contributor Author

DSR3164 commented May 17, 2026

Thanks for testing the idea to remove the caching!

Happy to help! Let me know if any changes are needed.

@zuckschwerdt zuckschwerdt merged commit 6699d60 into pothosware:master May 18, 2026
5 checks passed
@DSR3164 DSR3164 deleted the fix-enumerate-stale-results branch May 18, 2026 09:13
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

Successfully merging this pull request may close these issues.

SoapySDR Enumerate still finds Pluto after being unplugged

2 participants