Skip to content

Commit

Permalink
VITIS-8980 Improve sensor reports (#7625)
Browse files Browse the repository at this point in the history
* Refactor error message if no sensors exist for thermal or mechanical reports

Signed-off-by: Daniel Benusovich <[email protected]>

* Refactor error message if no sensors exist for electrical reports

Signed-off-by: Daniel Benusovich <[email protected]>

---------

Signed-off-by: Daniel Benusovich <[email protected]>
  • Loading branch information
dbenusov authored Jul 18, 2023
1 parent 933aefd commit 259e6c7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/runtime_src/core/common/sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -477,7 +479,7 @@ read_thermals(const xrt_core::device * device)
try {
output = xrt_core::device_query<xq::sdm_sensor_info>(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;
}
Expand Down Expand Up @@ -512,7 +514,7 @@ read_mechanical(const xrt_core::device * device)
try {
output = xrt_core::device_query<xq::sdm_sensor_info>(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;
}
Expand Down

0 comments on commit 259e6c7

Please sign in to comment.