Arnavion / tpfancontrol-rs

Temperature and fan controller for Thinkpads on Linux
27 stars 2 forks source link

Non-hardcoded temperature files #3

Closed smhmd closed 3 years ago

smhmd commented 4 years ago

Invoking sudo tpfancontrol errors out:

Error: sysfs error with /sys/class/hwmon/hwmon2/temp1_input: No such file or directory (os error 2)

I don't understand the function of these monitors, but I'm pretty sure the better way to find these paths is to do:

$ find /sys/devices -type f -name "temp*_input"

In my device, the output is:

/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input
/sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input
/sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp2_input

Thinkfan makes you include these in your config file, for instance. Other tools find them on their own.

My device is a ThinkPad L540 running Artix Linux using runit for init.

Arnavion commented 4 years ago

https://github.com/Arnavion/tpfancontrol-rs/blob/master/README.md

The program reads a config file /etc/tpfancontrol/config.toml for the names of the temperature sensors and for the temperature-to-fan-level mapping. There is an example config.toml.example in this repository.

Arnavion commented 4 years ago

Also,

Error: sysfs error with /sys/class/hwmon/hwmon2/temp1_input: No such file or directory (os error 2)

The hwmon2 part comes from autodetecting whichever hwmon that has name == "thinkpad". But then you say:

/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input

... which implies your hwmon2 identifies as "thinkpad" but hwmon3 is the one with the temp sensors? Or were these two taken across reboots and thus the hwmon numbers changed?

What's the output of:

grep -Hn . /sys/class/hwmon/hwmon*/name

?

Arnavion commented 4 years ago

On top of that, https://github.com/Arnavion/tpfancontrol-rs/issues/2 was also you, and I gave you the same answer that time too.

smhmd commented 4 years ago

On top of that, #2 was also you, and I gave you the same answer that time too.

Hhh, I didn't realize that. If I'm not wrong, at the time I had mid-semester exams. So, I apologize for not going back to you.

$ grep -Hn . /sys/class/hwmon/hwmon*/name
/sys/class/hwmon/hwmon0/name:1:acpitz
/sys/class/hwmon/hwmon1/name:1:ADP1
/sys/class/hwmon/hwmon2/name:1:thinkpad
/sys/class/hwmon/hwmon3/name:1:coretemp

It's hwmon2 as was auto-detected, then. And:

$ ls /sys/class/hwmon/hwmon2
power
device -> ../../../thinkpad_hwmon
fan1_input
name
pwm1
pwm1_enable
subsystem -> ../../../../../class/hwmon
uevent

So, temp1_input does not exist.

smhmd commented 4 years ago

Or were these two taken across reboots and thus the hwmon numbers changed?

No. And since I just booted my PC, here's the output once again:

$ find /sys/devices -type f -name "temp*_input"
/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input
/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input
/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_input
/sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input
/sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp2_input
Arnavion commented 4 years ago
$ ls /sys/class/hwmon/hwmon2
power
device -> ../../../thinkpad_hwmon
fan1_input
name
pwm1
pwm1_enable
subsystem -> ../../../../../class/hwmon
uevent

So your thinkpad_acpi module doesn't report any temp sensors. Not sure if it's just for your particular model, or if there's some config you need to enable in the kernel module for it.

Apart from that, the hwmon3 that's being reported by coretemp is the Intel CPU's own temp sensors. Apparently you have a dual-core, so the three sensors are probably CPU 1, CPU 2 and the package as a whole (look at their corresponding temp*_label files). The hwmon0 that's being reported by acpitz is a generic one probably being reported by the motherboard.

Anyway, tpfancontrol-rs only supports the thinkpad_acpi's hwmon sensors. It could support arbitrary sensors like thinkfan apparently does, but at that point it's kind of not Thinkpad-specific any more. I have been working on another TUI monitor for generic hwmons at https://github.com/Arnavion/hwtop. But that one currently cannot set fan speeds, only monitor them. I want to support setting fan speeds with it but haven't had the time to implement it.

smhmd commented 4 years ago

Thanks for the explanation (hand-holding, if you ask me.)

$ cat /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_label
Package id 0
$ cat /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp2_label
Core 0
$ cat /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_label
Core 1

I want to support setting fan speeds with it but haven't had the time to implement it.

Care to open an issue that I could subscribe to?

Arnavion commented 4 years ago

I want to support setting fan speeds with it but haven't had the time to implement it.

Care to open an issue that I could subscribe to?

https://github.com/Arnavion/hwtop/issues/1