MCPcopy Create free account
hub / github.com/Ar-Ray-code/lingbot-depth-trt / resolve_device

Function resolve_device

python/scripts/camera/realsense.py:46–68  ·  view source on GitHub ↗
(selector: str | None)

Source from the content-addressed store, hash-verified

44
45
46def resolve_device(selector: str | None) -> tuple[str, DeviceInfo]:
47 devices = list_devices()
48 if not devices:
49 raise RuntimeError("No RealSense devices found")
50
51 if selector in (None, "", "auto"):
52 if len(devices) > 1:
53 raise RuntimeError("Multiple RealSense devices found; specify --realsense, --serial, or --usb-id")
54 info = devices[0]
55 return info["serial"], info
56
57 target = str(selector).lower()
58 matches = []
59 for info in devices:
60 searchable = " ".join(str(v) for v in info.values()).lower()
61 if target in searchable:
62 matches.append(info)
63
64 if len(matches) == 1:
65 return matches[0]["serial"], matches[0]
66 if not matches:
67 raise RuntimeError(f"No RealSense device matched target: {selector}")
68 raise RuntimeError(f"Multiple RealSense devices matched target: {selector}")
69
70
71class RealSenseCamera(RgbdCamera):

Callers 1

create_cameraFunction · 0.70

Calls 1

list_devicesFunction · 0.70

Tested by

no test coverage detected