diff --git a/src/freebsd.cc b/src/freebsd.cc index 37be1592..94244d66 100644 --- a/src/freebsd.cc +++ b/src/freebsd.cc @@ -426,13 +426,16 @@ double get_acpi_temperature(int fd) 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; + if (GETSYSCTL("hw.acpi.thermal.tz0.temperature", temp) == 0) { + return KELVTOC(temp); + } else if (GETSYSCTL("dev.cpu.0.temperature", temp) == 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) {