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

Function _device_info

python/scripts/camera/orbbec.py:34–57  ·  view source on GitHub ↗
(device: Any, index: int)

Source from the content-addressed store, hash-verified

32
33
34def _device_info(device: Any, index: int) -> DeviceInfo:
35 info_obj = device.get_device_info()
36 out: DeviceInfo = {"backend": "orbbec", "index": str(index)}
37 method_fields = {
38 "name": "get_name",
39 "serial": "get_serial_number",
40 "firmware": "get_firmware_version",
41 "hardware": "get_hardware_version",
42 "uid": "get_uid",
43 "connection_type": "get_connection_type",
44 "min_sdk": "get_supported_min_sdk_version",
45 }
46 for key, method_name in method_fields.items():
47 value = _safe_call(info_obj, method_name)
48 if value:
49 out[key] = value
50 for key, method_name in {"vid": "get_vid", "pid": "get_pid"}.items():
51 value = _safe_call(info_obj, method_name)
52 if value:
53 out[key] = value
54 out[f"{key}_hex"] = f"{int(value):04x}"
55 if out.get("vid_hex") and out.get("pid_hex"):
56 out["usb_id"] = f"{out['vid_hex']}:{out['pid_hex']}"
57 return out
58
59
60def list_devices() -> list[DeviceInfo]:

Callers 1

list_devicesFunction · 0.70

Calls 1

_safe_callFunction · 0.85

Tested by

no test coverage detected