| 18 | |
| 19 | |
| 20 | def _device_info(device: Any) -> DeviceInfo: |
| 21 | rs = _rs() |
| 22 | fields = { |
| 23 | "name": rs.camera_info.name, |
| 24 | "serial": rs.camera_info.serial_number, |
| 25 | "firmware": rs.camera_info.firmware_version, |
| 26 | "physical_port": rs.camera_info.physical_port, |
| 27 | "product_id": rs.camera_info.product_id, |
| 28 | "product_line": rs.camera_info.product_line, |
| 29 | "usb_type": rs.camera_info.usb_type_descriptor, |
| 30 | } |
| 31 | out: DeviceInfo = {"backend": "realsense"} |
| 32 | for key, field in fields.items(): |
| 33 | try: |
| 34 | out[key] = str(device.get_info(field)) |
| 35 | except Exception: |
| 36 | pass |
| 37 | return out |
| 38 | |
| 39 | |
| 40 | def list_devices() -> list[DeviceInfo]: |