fix(agent): advertise USRP auto-select (identifier=None), not name=
The CLI get_sdr_device path can only open a USB USRP via auto-select: its _create_device_dict matches the identifier against raw device-dict values, but common.py prepends "addr="/"name=" before handing it over, so no prefixed identifier ever matches (this is also why addr=192.168.3.1 failed to match the B210). Advertising name=<name> was therefore unusable. detect_devices() now advertises a single USRP entry with identifier=None (auto-select the sole device), labelled with the serial(s) found. The hub forwards None, so the agent opens USRP() and picks the attached B210. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bf64604bcf
commit
6bead217a3
|
|
@ -84,24 +84,26 @@ def _enumerate_usrp() -> list[dict] | None:
|
||||||
logger.debug("USRP enumeration failed: %s", exc)
|
logger.debug("USRP enumeration failed: %s", exc)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
entries: list[dict] = []
|
if not found:
|
||||||
for dev in found:
|
return []
|
||||||
serial = dev.get("serial") or ""
|
|
||||||
name = dev.get("name") or ""
|
# Addressing reality for the CLI get_sdr_device path: its USRP
|
||||||
product = dev.get("product") or dev.get("type") or "USRP"
|
# _create_device_dict matches the identifier against *raw* device values,
|
||||||
# parse_ident only round-trips IP (bare) or ``name=`` — UHD has no
|
# but common.py prepends "addr="/"name=" before handing it over — so no
|
||||||
# serial= addressing here, so prefer name; otherwise auto-select (None).
|
# prefixed identifier ever matches. The only reliable open for a USB USRP
|
||||||
identifier = f"name={name}" if name else None
|
# (B2x0) is auto-select (identifier=None → first device found). Networked
|
||||||
suffix = serial or name or product
|
# USRPs addressed by IP would need a separate fix and aren't enumerated
|
||||||
entries.append(
|
# distinctly here. So advertise one auto-select entry, labelled with the
|
||||||
|
# serial(s) we saw so the operator still knows what's attached.
|
||||||
|
labels = [dev.get("serial") or dev.get("name") or dev.get("product") or "USRP" for dev in found]
|
||||||
|
return [
|
||||||
{
|
{
|
||||||
"device": "usrp",
|
"device": "usrp",
|
||||||
"identifier": identifier,
|
"identifier": None,
|
||||||
"label": _label_for("usrp", suffix),
|
"label": _label_for("usrp", ", ".join(labels)),
|
||||||
"connected": True,
|
"connected": True,
|
||||||
}
|
}
|
||||||
)
|
]
|
||||||
return entries
|
|
||||||
|
|
||||||
|
|
||||||
# Device types we can cheaply enumerate into concrete instances. Anything not
|
# Device types we can cheaply enumerate into concrete instances. Anything not
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user