Skip to content

Commit

Permalink
Inhibit unnecessary logs to reduce clutter. Update messages wording. …
Browse files Browse the repository at this point in the history
…Addresses IntelRealSense#6351, IntelRealSense#6784

Change-Id: I4831ef6303a33b5326f36f71c97409b5e410ea8f
  • Loading branch information
ev-mp committed Sep 29, 2020
1 parent 7261560 commit 473aae5
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 27 deletions.
25 changes: 13 additions & 12 deletions src/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,18 @@ namespace librealsense
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));

raw_color_ep->try_register_pu(RS2_OPTION_BACKLIGHT_COMPENSATION);
raw_color_ep->try_register_pu(RS2_OPTION_BRIGHTNESS);
raw_color_ep->try_register_pu(RS2_OPTION_CONTRAST);
raw_color_ep->try_register_pu(RS2_OPTION_EXPOSURE);
raw_color_ep->try_register_pu(RS2_OPTION_GAMMA);
raw_color_ep->try_register_pu(RS2_OPTION_HUE);
raw_color_ep->try_register_pu(RS2_OPTION_SATURATION);
raw_color_ep->try_register_pu(RS2_OPTION_SHARPNESS);
raw_color_ep->try_register_pu(RS2_OPTION_WHITE_BALANCE);
raw_color_ep->try_register_pu(RS2_OPTION_ENABLE_AUTO_EXPOSURE);
raw_color_ep->try_register_pu(RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE);
// Third-party UVC cameras with unverified capabilities shall avoid writing to log during dynamic feature identification.
raw_color_ep->try_register_pu(RS2_OPTION_BACKLIGHT_COMPENSATION,false);
raw_color_ep->try_register_pu(RS2_OPTION_BRIGHTNESS, false);
raw_color_ep->try_register_pu(RS2_OPTION_CONTRAST, false);
raw_color_ep->try_register_pu(RS2_OPTION_EXPOSURE, false);
raw_color_ep->try_register_pu(RS2_OPTION_GAMMA, false);
raw_color_ep->try_register_pu(RS2_OPTION_HUE, false);
raw_color_ep->try_register_pu(RS2_OPTION_SATURATION, false);
raw_color_ep->try_register_pu(RS2_OPTION_SHARPNESS, false);
raw_color_ep->try_register_pu(RS2_OPTION_WHITE_BALANCE, false);
raw_color_ep->try_register_pu(RS2_OPTION_ENABLE_AUTO_EXPOSURE, false);
raw_color_ep->try_register_pu(RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE, false);
}

virtual rs2_intrinsics get_intrinsics(unsigned int, const stream_profile&) const
Expand Down Expand Up @@ -362,7 +363,7 @@ namespace librealsense
list.push_back(dev);
}

LOG_INFO( "Found " << list.size() << " RealSense devices (mask " << mask << ")" );
LOG_INFO( "Found " << list.size() << " RealSense devices (mask 0x" << std::hex << mask << std::dec << ")" );
return list;
}

Expand Down
5 changes: 4 additions & 1 deletion src/ds5/ds5-factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,10 @@ namespace librealsense
}
else
{
LOG_WARNING("DS5 group_devices is empty.");
if (!devices.empty())
LOG_INFO("PID: 0x" << std::hex << devices.front().pid << std::dec << " was partially enumerated");
else
LOG_WARNING("DS5 group_devices is empty.");
}
}

Expand Down
18 changes: 9 additions & 9 deletions src/mf/mf-uvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ namespace librealsense
return false;
value = (opt == RS2_OPTION_EXPOSURE) ? to_100micros(val) : (flags == CameraControl_Flags_Auto);
CHECK_HR(hr);
THROW_HR(hr);
return true;
}
Expand Down Expand Up @@ -526,7 +526,7 @@ namespace librealsense
value = val;
CHECK_HR(hr);
THROW_HR(hr);
return true;
}
}
Expand All @@ -542,7 +542,7 @@ namespace librealsense
if (hr == DEVICE_NOT_READY_ERROR)
return false;
CHECK_HR(hr);
THROW_HR(hr);
return true;
}
if (opt == RS2_OPTION_ENABLE_AUTO_EXPOSURE)
Expand All @@ -553,7 +553,7 @@ namespace librealsense
if (hr == DEVICE_NOT_READY_ERROR)
return false;
CHECK_HR(hr);
THROW_HR(hr);
}
else
{
Expand All @@ -562,13 +562,13 @@ namespace librealsense
if (hr == DEVICE_NOT_READY_ERROR)
return false;
CHECK_HR(hr);
THROW_HR(hr);
hr = get_camera_control()->Set(CameraControl_Exposure, def, CameraControl_Flags_Manual);
if (hr == DEVICE_NOT_READY_ERROR)
return false;
CHECK_HR(hr);
THROW_HR(hr);
}
return true;
}
Expand Down Expand Up @@ -672,7 +672,7 @@ namespace librealsense
long minVal = 0, maxVal = 0, steppingDelta = 0, defVal = 0, capsFlag = 0;
if (opt == RS2_OPTION_EXPOSURE)
{
CHECK_HR(get_camera_control()->GetRange(CameraControl_Exposure, &minVal, &maxVal, &steppingDelta, &defVal, &capsFlag));
THROW_HR(get_camera_control()->GetRange(CameraControl_Exposure, &minVal, &maxVal, &steppingDelta, &defVal, &capsFlag));
long min = to_100micros(minVal), max = to_100micros(maxVal), def = to_100micros(defVal);
control_range result(min, max, min, def);
return result;
Expand All @@ -690,12 +690,12 @@ namespace librealsense
{
if (opt == ct.option)
{
CHECK_HR(get_camera_control()->GetRange(ct.property, &minVal, &maxVal, &steppingDelta, &defVal, &capsFlag));
THROW_HR(get_camera_control()->GetRange(ct.property, &minVal, &maxVal, &steppingDelta, &defVal, &capsFlag));
control_range result(minVal, maxVal, steppingDelta, defVal);
return result;
}
}
throw std::runtime_error("unsupported control");
throw std::runtime_error(to_string() << "unsupported control:" << opt);
}
void wmf_uvc_device::foreach_uvc_device(enumeration_callback action)
Expand Down
5 changes: 3 additions & 2 deletions src/sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ namespace librealsense
register_option(id, std::make_shared<uvc_pu_option>(*this, id));
}

void uvc_sensor::try_register_pu(rs2_option id)
void uvc_sensor::try_register_pu(rs2_option id, bool report_errors)
{
auto opt = std::make_shared<uvc_pu_option>(*this, id);
try
Expand All @@ -629,7 +629,8 @@ namespace librealsense
}
catch (...)
{
LOG_WARNING("Exception was thrown when inspecting " << this->get_info(RS2_CAMERA_INFO_NAME) << " property " << opt->get_description());
if (report_errors)
LOG_WARNING("Exception was thrown when inspecting " << this->get_info(RS2_CAMERA_INFO_NAME) << " property " << opt->get_description());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ namespace librealsense
void stop() override;
void register_xu(platform::extension_unit xu);
void register_pu(rs2_option id);
void try_register_pu(rs2_option id);
void try_register_pu(rs2_option id, bool report_errors=true);

std::vector<platform::stream_profile> get_configuration() const { return _internal_config; }
std::shared_ptr<platform::uvc_device> get_uvc_device() { return _device; }
Expand Down
2 changes: 1 addition & 1 deletion src/win/win-helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace librealsense
return false;
}

bool check(const char * call, HRESULT hr, bool to_throw)
bool check(const char * call, HRESULT hr, bool to_throw, bool sdk_exception)
{
if (FAILED(hr))
{
Expand Down
3 changes: 2 additions & 1 deletion src/win/win-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ namespace librealsense
{
namespace platform
{
bool check(const char * call, HRESULT hr, bool to_throw = true);
bool check(const char * call, HRESULT hr, bool to_throw = true, bool sdk_exception = true);
#define CHECK_HR(x) check(#x, x);
#define LOG_HR(x) check(#x, x, false);
#define THROW_HR(x) check(#x, x, false, false);

std::string win_to_utf(const WCHAR * s);

Expand Down

0 comments on commit 473aae5

Please sign in to comment.