From 259e6c75e649cb9c6ef71c8059723115d51988f5 Mon Sep 17 00:00:00 2001 From: Daniel Benusovich <94083344+dbenusov-xilinx@users.noreply.github.com> Date: Mon, 17 Jul 2023 21:45:54 -0700 Subject: [PATCH] VITIS-8980 Improve sensor reports (#7625) * Refactor error message if no sensors exist for thermal or mechanical reports Signed-off-by: Daniel Benusovich * Refactor error message if no sensors exist for electrical reports Signed-off-by: Daniel Benusovich --------- Signed-off-by: Daniel Benusovich --- src/runtime_src/core/common/sensor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/runtime_src/core/common/sensor.cpp b/src/runtime_src/core/common/sensor.cpp index 17cff504808..57f2b6bd0dd 100644 --- a/src/runtime_src/core/common/sensor.cpp +++ b/src/runtime_src/core/common/sensor.cpp @@ -445,8 +445,10 @@ read_electrical(const xrt_core::device * device) //Check for any of these data is available if (!current.empty() || !voltage.empty() || !power.empty()) return read_data_driven_electrical(current, voltage, power); - else + else { + sensor_array.put("msg", "No sensors present"); return sensor_array; + } } catch(const xrt_core::query::no_such_key&) { is_data_driven = false; @@ -477,7 +479,7 @@ read_thermals(const xrt_core::device * device) try { output = xrt_core::device_query(device, xq::sdm_sensor_info::sdr_req_type::thermal); if (output.empty()) { - thermal_array.put("error_msg", "Information unavailable"); + thermal_array.put("msg", "No sensors present"); root.add_child("thermals", thermal_array); return root; } @@ -512,7 +514,7 @@ read_mechanical(const xrt_core::device * device) try { output = xrt_core::device_query(device, xq::sdm_sensor_info::sdr_req_type::mechanical); if (output.empty()) { - fan_array.put("error_msg", "Information unavailable"); + fan_array.put("msg", "No sensors present"); root.add_child("fans", fan_array); return root; }