Bug 210235 - sysutils/conky improve chances of getting CPU temperature
Summary: sysutils/conky improve chances of getting CPU temperature
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Guido Falsi
Depends on:
Reported: 2016-06-12 13:10 UTC by walter
Modified: 2016-10-04 20:09 UTC (History)
2 users (show)

See Also:
madpilot: maintainer-feedback+


Note You need to log in before you can comment on or make changes to this bug.
Description walter 2016-06-12 13:10:44 UTC
conky, at least on my machine, fails to get the CPU temperature.
A change to freebsd.c improves the chances of finding something useful, although possibly not from ACPI:

@@ -419,13 +423,14 @@
 	int temp;
-	if (GETSYSCTL("hw.acpi.thermal.tz0.temperature", temp)) {
-		fprintf(stderr,
-			"Cannot read sysctl \"hw.acpi.thermal.tz0.temperature\"\n");
-		return 0.0;
-	}
-	return KELVTOC(temp);
+	if (0 == GETSYSCTL("hw.acpi.thermal.tz0.temperature", temp))
+		return KELVTOC(temp);
+	if (0 == GETSYSCTL("dev.cpu.0.temperature", temp))
+		return KELVTOC(temp);
+	if (0 == GETSYSCTL("dev.amdtemp.0.core0.sensor0", temp))
+		return KELVTOC(temp);
+	fprintf(stderr, "Cannot read sysctl for temperature\n");
+	return 0.0;
 static void get_battery_stats(int *battime, int *batcapacity, int *batstate, int *ac) {
Comment 1 Guido Falsi freebsd_committer 2016-10-04 16:28:47 UTC
I'm taking this bu report, since I took maintainership of the port.

Thanks for reporting the issue.

I'm going to include this patch after some testing.
Comment 2 commit-hook freebsd_committer 2016-10-04 20:07:43 UTC
A commit references this bug:

Author: madpilot
Date: Tue Oct  4 20:07:15 UTC 2016
New revision: 423301
URL: https://svnweb.freebsd.org/changeset/ports/423301

  Make conky try to get CPU temperature from more than just one sysctl.

  PR:		210235
  Submitted by:	walter@pelissero.de

Comment 3 Guido Falsi freebsd_committer 2016-10-04 20:09:39 UTC
Committed! Thanks.