Bug 497536 - The CPU temperature shown for FreeBSD is wrong
Summary: The CPU temperature shown for FreeBSD is wrong
Status: RESOLVED FIXED
Alias: None
Product: ksystemstats
Classification: Frameworks and Libraries
Component: General (show other bugs)
Version: 6.2.3
Platform: FreeBSD Ports FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-16 03:44 UTC by Henry Hu
Modified: 2025-01-23 15:31 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: Plasma 6.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Hu 2024-12-16 03:44:51 UTC
SUMMARY

The CPU temperature shown for FreeBSD is wrong.
I believe there's a bug in https://github.com/KDE/ksystemstats/blob/master/plugins/cpu/freebsdcpuplugin.cpp. Specifically, unlike sysctl like 'dev.cpu.0.freq', which is a simple value (2100 for example), the temperature leaf is shown like "32.0C", so it' can't be simply parsed with SysctlSensor class.

STEPS TO REPRODUCE
1. Install plasma 6 (such as 6.2.3)
2. Add 'system monitor' widget to the dock
3. Add 'Max CPU temperature' sensor to the widget

OBSERVED RESULT
CPU temperature shown is extra high; it's reporting 3091C now.

EXPECTED RESULT
A normal CPU temperature, such as 32C

SOFTWARE/OS VERSIONS
FreeBSD 15-CURRENT
KDE Plasma Version:  Plasma 6.2.3
KDE Frameworks Version: KF6 6.9.0
Qt Version: Qt6 6.7.3

ADDITIONAL INFORMATION
Comment 1 Henry Hu 2024-12-16 18:40:54 UTC
I would like to try to create a patch for this, but I can't even login into invent.kde.org, although I can log into KDE Identity.
Comment 2 Nate Graham 2024-12-17 15:41:55 UTC
I'd recommend emailing sysadmin@kde.org for help getting that fixed. Thanks for wanting to submit a patch!
Comment 3 Henry Hu 2024-12-19 03:25:17 UTC
Created a merge request (https://invent.kde.org/plasma/ksystemstats/-/merge_requests/99) for this.
It turns out FreeBSD exports CPU temp as deci-Kelvin (see FreeBSD's sysctl code here: https://github.com/freebsd/freebsd-src/blob/b762b199afc6ed56ac95ca19c7fc29c2927fa85c/sbin/sysctl/sysctl.c#L1231), so 32C is exported as (32 + 273.15) * 10 = 3051.5; thus, we need to convert it back.
Comment 4 Arjen Hiemstra 2025-01-23 15:31:26 UTC
This was fixed with https://invent.kde.org/plasma/ksystemstats/-/merge_requests/101