mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-27 17:18:33 +00:00
Try more than one sysctl to get CPU temperature. (#330)
* Try more than one sysctl to get CPU temperature. Suggested by: walter@pelissero.de Reference: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210235 * Added braces and using else ifs.
This commit is contained in:
parent
e51301a0f8
commit
271ca6dc97
@ -426,13 +426,16 @@ double get_acpi_temperature(int fd)
|
|||||||
int temp;
|
int temp;
|
||||||
(void)fd;
|
(void)fd;
|
||||||
|
|
||||||
if (GETSYSCTL("hw.acpi.thermal.tz0.temperature", temp)) {
|
if (GETSYSCTL("hw.acpi.thermal.tz0.temperature", temp) == 0) {
|
||||||
fprintf(stderr,
|
return KELVTOC(temp);
|
||||||
"Cannot read sysctl \"hw.acpi.thermal.tz0.temperature\"\n");
|
} else if (GETSYSCTL("dev.cpu.0.temperature", temp) == 0) {
|
||||||
return 0.0;
|
return KELVTOC(temp);
|
||||||
|
} else if (GETSYSCTL("dev.amdtemp.0.core0.sensor0", temp) == 0) {
|
||||||
|
return KELVTOC(temp);
|
||||||
}
|
}
|
||||||
|
fprintf(stderr, "Cannot get temperature from sysctl\n");
|
||||||
|
|
||||||
return KELVTOC(temp);
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_battery_stats(int *battime, int *batcapacity, int *batstate, int *ac) {
|
static void get_battery_stats(int *battime, int *batcapacity, int *batstate, int *ac) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user