在Ubuntu或国产操作系统下读取CPU内部温度值
方法一:
root@E2000-Ubuntu:~# cat /sys/class/thermal/thermal_zone0/temp
29
root@E2000-Ubuntu:~# cat /sys/class/thermal/thermal_zone1/temp
31
实测有效,单位是℃。
方法二:
root@E2000-Ubuntu:~# cat /sys/class/hwmon/hwmon0/temp1_input
29
root@E2000-Ubuntu:~# cat /sys/class/hwmon/hwmon0/temp2_input
31
实测有效,单位是℃。
方法三:
安装lm-sensors工具:
root@E2000-Ubuntu:~# sudo apt-get install lm-sensors
root@E2000-Ubuntu:~# sensors
scmi_sensors-virtual-0
Adapter: Virtual device
TS0: +0.0°C
TS1: +0.0°C
读出的温度值是0°C ,看来还不支持该功能,估计与内核驱动有关,待与原厂沟通或获取最新版本内核后再验证。
文章介绍了在Ubuntu或国产操作系统中读取CPU内部温度的三种方法,包括直接访问/sys/class/thermal目录下的thermal_zone文件,查看hwmon下的temp输入,以及使用lm-sensors工具。后两种方法在某些情况下可能不支持或显示0°C,可能需要更新内核驱动。
874

被折叠的 条评论
为什么被折叠?



