Fix mDNS discovery ambiguity where multiple devices across
different network segments/subnets can advertise the same hostname (e.g.
"ip:pluto.local"), resulting in non-unique or misleading URIs.
Replace unresolved mDNS hostnames with the actual discovered endpoint
reported in the scan description.
- Detect ".local" URIs on IP backend and substitute hostname with
resolved endpoint from libiio scan results.
- Preserve URI semantics:
- Keep backend prefix ("ip:")
- Preserve optional port suffix
- Correctly format IPv6 literals with RFC2732 bracket notation when
required
- Add replaceHostnameWithIP() to perform URI normalization during scan:
- Only applies to IP backend URIs
- Only triggers for mDNS-based ".local" hostnames
- Uses scan-provided endpoint (from description string) as authoritative
address instead of advertised hostname
- Extend scan() to emit both original and resolved URIs for debugging
and verification during device discovery.
This resolves inconsistent device addressing when multiple PlutoSDRs
are accessible via mDNS across different subnets or network segments.
No change to backend enumeration or device identity logic; this only
normalizes .local IP URI resolution at scan time.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Improve PlutoSDR device identity handling to correctly distinguish
multiple libiio backends (IP, USB, etc.) and provide stable grouping
of physically identical hardware in the UI.
- Append backend prefix to scanned device serials to ensure uniqueness
across multiple discovery paths (e.g. "<serial>_ip", "<serial>_usb").
This prevents collisions when the same device is visible through
different transports.
- Add physical serial extraction and grouping logic so that devices
discovered via multiple backends are treated as a single physical
unit for display purposes. This stabilizes UI numbering and avoids
duplicate entries for the same hardware.
- Update enumOriginDevices() to:
- group devices by physical serial rather than scan index
- assign stable per-device indices independent of backend enumeration
- include backend label in the display name to distinguish connection
paths when multiple backends are active
- Introduce helper utilities:
- createBackendSuffix(): extract backend identifier from libiio URI
- getPhysicalSerial(): strip backend suffix for grouping logic
- getBackendLabel(): format backend suffix for user-facing display
These changes ensure:
- unique internal identifiers per backend connection
- consistent grouping per physical device across discovery mechanisms
- improved UI clarity when multiple access paths exist for the same SDR
No change to RF/data path behavior; this is purely a discovery and
presentation-layer refactor.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Convert tab-based indentation to spaces to match the project's
existing coding style. No functional changes.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fixes#681.
Relying on memory allocated by `std::vector` via direct pointers is dangerous,
as vectors may move buffers during resize. This fix puts the `DeviceScan`
allocation into a `str::shared_ptr`, which 1) allocates the memory on heap and
2) keeps track of the memory through reference counting. Thus it is safe to
store the `shared_ptr` across different vectors/maps.