From 44d1b2c6551fa713ae7bb01470e07fa32fc15d97 Mon Sep 17 00:00:00 2001 From: Evgeni Raikhel Date: Tue, 4 Aug 2020 00:43:06 +0300 Subject: [PATCH] Inhibit unnecessary logs to reduce clutter. Update messages wording. Addresses #6351, #6784 Change-Id: I4831ef6303a33b5326f36f71c97409b5e410ea8f --- src/context.cpp | 25 +++++++++++++------------ src/ds5/ds5-factory.cpp | 5 ++++- src/mf/mf-uvc.cpp | 18 +++++++++--------- src/sensor.cpp | 5 +++-- src/sensor.h | 2 +- src/win/win-helpers.cpp | 2 +- src/win/win-helpers.h | 3 ++- 7 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/context.cpp b/src/context.cpp index ad50110b6d..29d10283ec 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -264,17 +264,18 @@ namespace librealsense 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)); - 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 @@ -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; } diff --git a/src/ds5/ds5-factory.cpp b/src/ds5/ds5-factory.cpp index c7fc2e002d..35651b9afa 100644 --- a/src/ds5/ds5-factory.cpp +++ b/src/ds5/ds5-factory.cpp @@ -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."); } } diff --git a/src/mf/mf-uvc.cpp b/src/mf/mf-uvc.cpp index 7d4a1966da..eed58f2375 100644 --- a/src/mf/mf-uvc.cpp +++ b/src/mf/mf-uvc.cpp @@ -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; } @@ -526,7 +526,7 @@ namespace librealsense value = val; - CHECK_HR(hr); + THROW_HR(hr); return true; } } @@ -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) @@ -553,7 +553,7 @@ namespace librealsense if (hr == DEVICE_NOT_READY_ERROR) return false; - CHECK_HR(hr); + THROW_HR(hr); } else { @@ -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; } @@ -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; @@ -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) diff --git a/src/sensor.cpp b/src/sensor.cpp index 7703279f1b..1856e7b69d 100644 --- a/src/sensor.cpp +++ b/src/sensor.cpp @@ -613,7 +613,7 @@ namespace librealsense register_option(id, std::make_shared(*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(*this, id); try @@ -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()); } } diff --git a/src/sensor.h b/src/sensor.h index a4869aad10..ba0abe2045 100644 --- a/src/sensor.h +++ b/src/sensor.h @@ -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 get_configuration() const { return _internal_config; } std::shared_ptr get_uvc_device() { return _device; } diff --git a/src/win/win-helpers.cpp b/src/win/win-helpers.cpp index 643211fb6b..f12cd8eef9 100644 --- a/src/win/win-helpers.cpp +++ b/src/win/win-helpers.cpp @@ -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)) { diff --git a/src/win/win-helpers.h b/src/win/win-helpers.h index cb598717c0..a19ed4c432 100644 --- a/src/win/win-helpers.h +++ b/src/win/win-helpers.h @@ -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);