Skip to content

Commit

Permalink
Merge pull request IntelRealSense#5977 from dorodnic/development
Browse files Browse the repository at this point in the history
Small fixes
  • Loading branch information
dorodnic authored Mar 10, 2020
2 parents c5a73e1 + 472bfbd commit 7f2474d
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 14 deletions.
29 changes: 18 additions & 11 deletions common/metadata-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -70,7 +70,7 @@ namespace rs2

static void foreach_device_path(const std::vector<device_id>& devices,
std::function<void(const device_id&, /* matched device */
std::wstring /* registry key of Device Parameters for that device */)> action)
std::wstring /* registry key of Device Parameters for that device */)> action)
{
std::map<std::string, std::vector<device_id>> guid_to_devices;
for (auto&& d : devices)
Expand Down Expand Up @@ -118,7 +118,7 @@ namespace rs2
&cbSecurityDescriptor, // security descriptor
&ftLastWriteTime); // last write time

for (int i = 0; i<cSubKeys; i++)
for (int i = 0; i < cSubKeys; i++)
{
TCHAR achKey[MAX_KEY_LENGTH];
DWORD cbName = MAX_KEY_LENGTH;
Expand Down Expand Up @@ -176,7 +176,7 @@ namespace rs2
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&admin_group))
&admin_group))
{
rs2::log(RS2_LOG_SEVERITY_WARN, "Unable to query permissions - AllocateAndInitializeSid failed");
return false;
Expand Down Expand Up @@ -292,14 +292,21 @@ namespace rs2
try
{
rs2::device dev = list[i];
if (dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE) && dev.supports(RS2_CAMERA_INFO_PHYSICAL_PORT))

if (dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE))
{
std::string product = dev.get_info(RS2_CAMERA_INFO_PRODUCT_LINE);
if (can_support_metadata(product))
{
std::string port = dev.get_info(RS2_CAMERA_INFO_PHYSICAL_PORT);
device_id did;
if (parse_device_id(port, &did)) dids.push_back(did);
for (auto sen : dev.query_sensors())
{
if (sen.supports(RS2_CAMERA_INFO_PHYSICAL_PORT))
{
std::string port = sen.get_info(RS2_CAMERA_INFO_PHYSICAL_PORT);
device_id did;
if (parse_device_id(port, &did)) dids.push_back(did);
}
}
}
}
}
Expand Down Expand Up @@ -338,7 +345,7 @@ namespace rs2
};
#endif

metadata_helper& metadata_helper::instance()
metadata_helper& metadata_helper::instance()
{
#ifdef WIN32
static windows_metadata_helper instance;
Expand Down
5 changes: 3 additions & 2 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,10 +1004,11 @@ namespace rs2
<< "/" << s->get_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;
Expand Down
2 changes: 2 additions & 0 deletions src/ds5/ds5-color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/ds5/ds5-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ds5_depth_sensor>(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));
Expand Down
4 changes: 4 additions & 0 deletions src/ivcam/sr300.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,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<uyvy_converter>(RS2_FORMAT_UYVY, map_supported_color_formats(RS2_FORMAT_UYVY), RS2_STREAM_COLOR));
color_ep->register_processing_block(processing_block_factory::create_pbf_vector<yuy2_converter>(RS2_FORMAT_YUYV, map_supported_color_formats(RS2_FORMAT_YUYV), RS2_STREAM_COLOR));
Expand Down Expand Up @@ -179,6 +181,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 } },
Expand Down
2 changes: 2 additions & 0 deletions src/l500/l500-color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace librealsense
this);
auto color_ep = std::make_shared<l500_color_sensor>(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<yuy2_converter>(RS2_FORMAT_YUYV, map_supported_color_formats(RS2_FORMAT_YUYV), RS2_STREAM_COLOR));

Expand Down
2 changes: 1 addition & 1 deletion src/l500/l500-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool_option>();
auto weak_is_zo_enabled_opt = std::weak_ptr<bool_option>(is_zo_enabled_opt);
Expand Down
5 changes: 5 additions & 0 deletions tools/enumerate-devices/rs-enumerate-devices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright(c) 2015 Intel Corporation. All Rights Reserved.

#include <librealsense2/rs.hpp>
#include <librealsense2/rsutil.h>
#include <iostream>
#include <iomanip>
#include <map>
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 7f2474d

Please sign in to comment.