⛏️ index : haiku.git

author Oscar Lesta <oscar.lesta@gmail.com> 2025-10-30 10:39:01.0 -03:00:00
committer waddlesplash <waddlesplash@gmail.com> 2025-11-03 17:39:37.0 +00:00:00
commit
b238dfa0f980a72ed88af8769dbb3fe7ed2f2d2c [patch]
tree
e32ef830cfe2b2250eefb0762196e42d25d9e6a7
parent
abb6b4896eba46a2fbf1b7300bb48698f33f4ad5
download
b238dfa0f980a72ed88af8769dbb3fe7ed2f2d2c.tar.gz

ActivityMonitor: fix Temperature presentation if no sensor is available.

On machines with no acpi_thermal sensor, enabling the thermal readings
was showing the value as "-2.077.252.342 °C".

Let's show "No thermal sensor" / "0 °C" instead.

Change-Id: I4ba74e648b8826635cb4f4145540c833d1058220
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9764
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>

Diff

 src/apps/activitymonitor/DataSource.cpp        | 7 +++++++
 src/apps/activitymonitor/SystemInfoHandler.cpp | 7 +++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/apps/activitymonitor/DataSource.cpp b/src/apps/activitymonitor/DataSource.cpp
index 666788a..4fe3842 100644
--- a/src/apps/activitymonitor/DataSource.cpp
+++ b/src/apps/activitymonitor/DataSource.cpp
@@ -1013,7 +1013,12 @@
ThermalDataSource::NextValue(SystemInfo& info)
{
	fLabel = info.ThermalZone();
	int64 value = (int64)ceilf(info.Temperature() * 1000000);

	float temperature = info.Temperature();
	if (isnan(temperature))
		return 0;

	int64 value = (int64)ceilf(temperature * 1000000);

	if (value > fMaximum)
		SetLimits(0, value);
diff --git a/src/apps/activitymonitor/SystemInfoHandler.cpp b/src/apps/activitymonitor/SystemInfoHandler.cpp
index 7d62b68..4ed242e 100644
--- a/src/apps/activitymonitor/SystemInfoHandler.cpp
+++ b/src/apps/activitymonitor/SystemInfoHandler.cpp
@@ -11,6 +11,7 @@
#include <string.h>
#include <unistd.h>

#include <Catalog.h>
#include <Clipboard.h>
#include <Drivers.h>
#include <Handler.h>
@@ -20,7 +21,10 @@
#include <Messenger.h>
#include <Roster.h>

#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "SystemInfoHandler"


SystemInfoHandler::SystemInfoHandler()
	: BHandler("SystemInfoHandler")
{
@@ -35,6 +39,8 @@
	char buffer[256];
	if ((fThermalFD > 0) && (ioctl(fThermalFD, B_GET_DEVICE_NAME, buffer, sizeof(buffer)) == B_OK))
		fThermalZoneName = buffer;
	else
		fThermalZoneName = B_TRANSLATE("No thermal sensor");
}


@@ -98,7 +104,6 @@
			// to find initial connection count
		}
		// TODO: get initial buffer count
		
	}

	// doesn't work on R5