Bug 210235

Summary: sysutils/conky improve chances of getting CPU temperature
Product: Ports & Packages Reporter: walter
Component: Individual Port(s)Assignee: Guido Falsi <madpilot>
Status: Closed FIXED    
Severity: Affects Only Me CC: madpilot, ntarmos
Priority: --- Flags: madpilot: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   

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;
 	(void)fd;
 
-	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

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

  PR:		210235
  Submitted by:	walter@pelissero.de

Changes:
  head/sysutils/conky/Makefile
  head/sysutils/conky/files/patch-src_freebsd.cc
Comment 3 Guido Falsi freebsd_committer 2016-10-04 20:09:39 UTC
Committed! Thanks.