From f9ff362a8904e815c2d173c7a7398ce4e13f980b Mon Sep 17 00:00:00 2001 From: "Dorodnicov, Sergey" Date: Thu, 5 Mar 2020 00:54:52 -0800 Subject: [PATCH 1/2] Fix metadata enable functionality in the Viewer for Windows Fetch and update each sensor individually instead of once per device --- common/metadata-helper.cpp | 29 ++++++++++++++++++----------- common/model-views.cpp | 5 +++-- src/ds5/ds5-color.cpp | 2 ++ src/ds5/ds5-device.cpp | 3 +++ src/ivcam/sr300.cpp | 4 ++++ src/l500/l500-color.cpp | 2 ++ src/l500/l500-device.cpp | 2 +- 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/common/metadata-helper.cpp b/common/metadata-helper.cpp index d590ea55bc..69cef74439 100644 --- a/common/metadata-helper.cpp +++ b/common/metadata-helper.cpp @@ -43,9 +43,9 @@ namespace rs2 inline bool operator==(const device_id& a, const device_id& b) { return equal(a.pid, b.pid) && - equal(a.guid, b.guid) && - equal(a.mi, b.mi) && - equal(a.sn, b.sn); + equal(a.guid, b.guid) && + equal(a.mi, b.mi) && + equal(a.sn, b.sn); } class windows_metadata_helper : public metadata_helper @@ -70,7 +70,7 @@ namespace rs2 static void foreach_device_path(const std::vector& devices, std::function action) + std::wstring /* registry key of Device Parameters for that device */)> action) { std::map> guid_to_devices; for (auto&& d : devices) @@ -118,7 +118,7 @@ namespace rs2 &cbSecurityDescriptor, // security descriptor &ftLastWriteTime); // last write time - for (int i = 0; iget_info(RS2_CAMERA_INFO_NAME) << "/" << (long long)this; - if (dev.supports(RS2_CAMERA_INFO_PHYSICAL_PORT) && dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE)) + if (s->supports(RS2_CAMERA_INFO_PHYSICAL_PORT) && dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE)) { std::string product = dev.get_info(RS2_CAMERA_INFO_PRODUCT_LINE); - std::string id = dev.get_info(RS2_CAMERA_INFO_PHYSICAL_PORT); + std::string id = s->get_info(RS2_CAMERA_INFO_PHYSICAL_PORT); + bool has_metadata = !rs2::metadata_helper::instance().can_support_metadata(product) || rs2::metadata_helper::instance().is_enabled(id); static bool showed_metadata_prompt = false; diff --git a/src/ds5/ds5-color.cpp b/src/ds5/ds5-color.cpp index e5ea577432..ac434da66a 100644 --- a/src/ds5/ds5-color.cpp +++ b/src/ds5/ds5-color.cpp @@ -78,6 +78,8 @@ namespace librealsense ds5_color_fourcc_to_rs2_stream); color_ep->register_option(RS2_OPTION_GLOBAL_TIME_ENABLED, enable_global_time_option); + color_ep->register_info(RS2_CAMERA_INFO_PHYSICAL_PORT, color_devices_info.front().device_path); + color_ep->register_pu(RS2_OPTION_BRIGHTNESS); color_ep->register_pu(RS2_OPTION_CONTRAST); color_ep->register_pu(RS2_OPTION_SATURATION); diff --git a/src/ds5/ds5-device.cpp b/src/ds5/ds5-device.cpp index 0988cd92b0..51c1936004 100644 --- a/src/ds5/ds5-device.cpp +++ b/src/ds5/ds5-device.cpp @@ -554,6 +554,9 @@ namespace librealsense raw_depth_ep->register_xu(depth_xu); // make sure the XU is initialized every time we power the camera auto depth_ep = std::make_shared(this, raw_depth_ep); + + depth_ep->register_info(RS2_CAMERA_INFO_PHYSICAL_PORT, filter_by_mi(all_device_infos, 0).front().device_path); + depth_ep->register_option(RS2_OPTION_GLOBAL_TIME_ENABLED, enable_global_time_option); depth_ep->register_processing_block(processing_block_factory::create_id_pbf(RS2_FORMAT_Y8, RS2_STREAM_INFRARED, 1)); diff --git a/src/ivcam/sr300.cpp b/src/ivcam/sr300.cpp index c515e90838..92b325ef54 100644 --- a/src/ivcam/sr300.cpp +++ b/src/ivcam/sr300.cpp @@ -102,6 +102,8 @@ namespace librealsense sr300_color_fourcc_to_rs2_format, sr300_color_fourcc_to_rs2_stream); + color_ep->register_info(RS2_CAMERA_INFO_PHYSICAL_PORT, color.device_path); + // register processing blocks color_ep->register_processing_block(processing_block_factory::create_pbf_vector(RS2_FORMAT_UYVY, map_supported_color_formats(RS2_FORMAT_UYVY), RS2_STREAM_COLOR)); color_ep->register_processing_block(processing_block_factory::create_pbf_vector(RS2_FORMAT_YUYV, map_supported_color_formats(RS2_FORMAT_YUYV), RS2_STREAM_COLOR)); @@ -166,6 +168,8 @@ namespace librealsense sr300_depth_fourcc_to_rs2_stream); raw_depth_ep->register_xu(depth_xu); // make sure the XU is initialized everytime we power the camera + depth_ep->register_info(RS2_CAMERA_INFO_PHYSICAL_PORT, depth.device_path); + // register processing blocks factories depth_ep->register_processing_block( { { RS2_FORMAT_INVI } }, diff --git a/src/l500/l500-color.cpp b/src/l500/l500-color.cpp index d488d1447a..3280234a3b 100644 --- a/src/l500/l500-color.cpp +++ b/src/l500/l500-color.cpp @@ -36,6 +36,8 @@ namespace librealsense this); auto color_ep = std::make_shared(this, raw_color_ep, ctx, l500_color_fourcc_to_rs2_format, l500_color_fourcc_to_rs2_stream); + color_ep->register_info(RS2_CAMERA_INFO_PHYSICAL_PORT, color_devices_info.front().device_path); + // processing blocks color_ep->register_processing_block(processing_block_factory::create_pbf_vector(RS2_FORMAT_YUYV, map_supported_color_formats(RS2_FORMAT_YUYV), RS2_STREAM_COLOR)); diff --git a/src/l500/l500-device.cpp b/src/l500/l500-device.cpp index 2a0386dca1..a89da0b925 100644 --- a/src/l500/l500-device.cpp +++ b/src/l500/l500-device.cpp @@ -148,7 +148,7 @@ namespace librealsense depth_ep->register_option(RS2_OPTION_GLOBAL_TIME_ENABLED, enable_global_time_option); depth_ep->get_option(RS2_OPTION_GLOBAL_TIME_ENABLED).set(0); - + depth_ep->register_info(RS2_CAMERA_INFO_PHYSICAL_PORT, filter_by_mi(all_device_infos, 0).front().device_path); auto is_zo_enabled_opt = std::make_shared(); auto weak_is_zo_enabled_opt = std::weak_ptr(is_zo_enabled_opt); From 472bfbd1967d10e7e20f085470a4ccee47ac3b80 Mon Sep 17 00:00:00 2001 From: "Dorodnicov, Sergey" Date: Thu, 5 Mar 2020 01:03:18 -0800 Subject: [PATCH 2/2] Add FOV to rs-enumerate-devices --- tools/enumerate-devices/rs-enumerate-devices.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/enumerate-devices/rs-enumerate-devices.cpp b/tools/enumerate-devices/rs-enumerate-devices.cpp index df38adb48b..af662e5e00 100644 --- a/tools/enumerate-devices/rs-enumerate-devices.cpp +++ b/tools/enumerate-devices/rs-enumerate-devices.cpp @@ -2,6 +2,7 @@ // Copyright(c) 2015 Intel Corporation. All Rights Reserved. #include +#include #include #include #include @@ -94,6 +95,10 @@ void print(const rs2_intrinsics& intrinsics) for (auto i = 0u; i < sizeof(intrinsics.coeffs) / sizeof(intrinsics.coeffs[0]); ++i) ss << "\t" << setprecision(15) << intrinsics.coeffs[i] << " "; + float fov[2]; + rs2_fov(&intrinsics, fov); + ss << endl << left << setw(14) << " FOV (deg): " << "\t" << setprecision(4) << fov[0] << " x " << fov[1]; + cout << ss.str() << endl << endl; }