summaryrefslogtreecommitdiff
path: root/thermal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thermal.cpp')
-rw-r--r--thermal.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/thermal.cpp b/thermal.cpp
index cb379c8..91b976d 100644
--- a/thermal.cpp
+++ b/thermal.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -59,6 +60,13 @@ static const Temperature_1_0 dummy_temp_1_0 = {
.vrThrottlingThreshold = 40,
};
+static const Temperature dummy_temp_2_0 = {
+ .type = TemperatureType::SKIN,
+ .name = "test sensor",
+ .value = 25.0,
+ .throttlingStatus = ThrottlingSeverity::NONE,
+};
+
template <typename A, typename B>
Return<void> exit_hal(A _cb, hidl_vec<B> _data, std::string_view _msg) {
ThermalStatus _status;
@@ -169,9 +177,15 @@ Return<void> Thermal::getCurrentTemperatures(
return exit_hal(_hidl_cb, temperatures,
"ThermalHAL not initialized properly.");
- if (utils.readTemperatures(filterType, type, temperatures) <= 0)
- return exit_hal(_hidl_cb, temperatures,
- "Sensor Temperature read failure.");
+ if (utils.readTemperatures(filterType, type, temperatures) <= 0) {
+ if (filterType && type != dummy_temp_2_0.type) {
+ status.code = ThermalStatusCode::FAILURE;
+ status.debugMessage = "Failed to read dummy temperature value";
+ } else {
+ temperatures = {dummy_temp_2_0};
+ LOG(INFO) << "Returning Dummy Temperature Value" << std::endl;
+ }
+ }
_hidl_cb(status, temperatures);