Correct sensor location to use for Temperature Monitor in lxpanel?
Simple solution
1) Run this command to list types of available thermal_zone devices:ls -1 /sys/class/thermal/thermal_zone*/type | xargs -I % sh -c "echo % ; cat %"
You should get output similar to this:
/sys/class/thermal/thermal_zone0/type
acpitz
/sys/class/thermal/thermal_zone1/type
acpitz
/sys/class/thermal/thermal_zone2/type
x86_pkg_temp
2) Find out which one you need, for CPU it should have type similar to x86_pkg_temp
. In my example, if I want to use x86_pkg_temp
I will pick /sys/class/thermal/thermal_zone2/
.
3) Specify it in "Temperature Monitor" settings, make sure it is slash-terminated (enclosed with "/" at the end, just like in my example):
Done, it should work as intended now.
More details and alternative solution
Started using LUbuntu desktop today and found myself looking on same problem.
After poking around and cracking open source code of /plugins/thermal/thermal.c
I found some solutions.
First of all, parameter "Sensor" in options refers to location of it as directory.
Looking on sources it can detect 3 types of sensor directories in automatic mode, and looks for them in /proc/acpi/thermal_zone/
, /sys/class/thermal/
and /sys/class/hwmon/hwmon[i]/
, functions to look for those are called here:
static void
check_sensors( thermal *th )
{
// FIXME: scan in opposite order
find_sensors(th, PROC_THERMAL_DIRECTORY, NULL, proc_get_temperature, proc_get_critical);
find_sensors(th, SYSFS_THERMAL_DIRECTORY, SYSFS_THERMAL_SUBDIR_PREFIX, sysfs_get_temperature, sysfs_get_critical);
if (th->numsensors == 0)
find_hwmon_sensors(th);
g_info("thermal: Found %d sensors", th->numsensors);
}
Now, looking on what happens when you set config, we see this:
if(th->sensor == NULL) th->auto_sensor = TRUE;
if(th->auto_sensor) check_sensors(th);
else if (strncmp(th->sensor, "/sys/", 5) != 0)
add_sensor(th, th->sensor, th->sensor, proc_get_temperature, proc_get_critical);
else if (strncmp(th->sensor, "/sys/class/hwmon/", 17) != 0)
add_sensor(th, th->sensor, th->sensor, sysfs_get_temperature, sysfs_get_critical);
else
add_sensor(th, th->sensor, th->sensor, hwmon_get_temperature, hwmon_get_critical);
From what I understood, th->sensor
is set to what you specify in "Sensor" input field in options.
First there is check if auto_sensor
is set, and if it is not, it will do series of other checks.
Breaking down this part, if your sensor path does not inlude /sys/
in it, it will use proc_get
functions, which is outdated acpi type sensor that is not used in new versions of Ubuntu. Otherwise, if your path includes /sys/class/hwmon
it will use hwmon
functions, and finally if it is other type of /sys/*
, it will use sysfs
type of sensor.
Based on that we can conclude that easiest way would be to specify sensor located in /sys/class/thermal/
, for example /sys/class/thermal/thermal_zone1
. If we would go with /sys/class/hwmon/
, it would not pick right sensor anyway, because there is no way to specify exact temp[i]_input
to be used, and if we would use non /sys/
directory, it would assume we using outdated acpi/thermal_zone
, which is not ideal as well. You could create script that will create fake sensor directory in your home folder with 2 files, trip_points
and temperature
.
trip_points would look like this and does not matter much:
critical (S5): 110 C
passive: 105 C: tc1=2 tc2=10 tsp=100 devices=0xdf72e380
active[0]: 48 C: devices=0xc157fec0
temperature would be one to be read for current temperature and should look like this:
temperature: 49 C
Finally, you would need script to update those files from actual sensor you want to use and schedule it to run each N seconds.
This solution would allow using /sys/class/hwmon/hwmon1
kind of sensors and manually read value to be used by LXpanel thermal indicator. You could also use this method to make this thermal indicator display other kind of indicators, but that seems like waste of effort, considering you could just use another indicator instead. I will update with sample script to do it later, if it will be required\I will make one for myself.
I have the similar problem (my default sensor always shows 40.0°C) and i can't change this sensor in original lxpanel's Temperature Monitor. But there is another solution: lm-sensors LXDE lxpanel plugin.
https://github.com/danamlund/sensors-lxpanel-plugin
It is simple to compile (in lubuntu 16.04 i also used debian install instructions) and simple to use: