Code Monkey home page Code Monkey logo

fan2go's Introduction

GitHub Streak

GitHub stats

Top Langs

fan2go's People

Contributors

dependabot[bot] avatar elais avatar jfroy avatar markusressel avatar mtoohey31 avatar nivekuil avatar shalokshalom avatar smeat avatar ureeves avatar userjhansen avatar zopieux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fan2go's Issues

Sensor detection issue on 0.1.0

This is the new error I get when trying to detect sensors with fan2go detect. My system is Arch Linux and I downloaded the binary and copied it using the commands on the readme. DID NOT USE AUR.

igneel@G3-3590 ~/Downloads> fan2go detect
> acpitz
 Sensors   Index   Label    Value  
           1       hwmon1   25000  

> nvme-pci-0200
 Sensors   Index   Label       Value  
           1       Composite   63850  

  ERROR   File reading error: open /sys/devices/platform/dell_smm_hwmon/hwmon/hwmon4/pwm1_enable: no such file or directory
  FATAL   Cannot read pwm_enable value of 
panic: 

goroutine 1 [running]:
github.com/pterm/pterm.checkFatal(...)
        /go/pkg/mod/github.com/pterm/[email protected]/prefix_printer.go:340
github.com/pterm/pterm.(*PrefixPrinter).Printfln(0xe210c0, 0x9e8958, 0x22, 0xc0000b7248, 0x1, 0x1, 0x3d)
        /go/pkg/mod/github.com/pterm/[email protected]/prefix_printer.go:282 +0x23f
github.com/markusressel/fan2go/internal/ui.Fatal(...)
        /github/workspace/internal/ui/logging.go:36
github.com/markusressel/fan2go/cmd.createFans(0xc000026ac0, 0x31, 0x0, 0x0, 0x0)
        /github/workspace/cmd/detect.go:162 +0x75d
github.com/markusressel/fan2go/cmd.glob..func2(0xe23560, 0xe4d770, 0x0, 0x0)
        /github/workspace/cmd/detect.go:51 +0x38d
github.com/spf13/cobra.(*Command).execute(0xe23560, 0xe4d770, 0x0, 0x0, 0xe23560, 0xe4d770)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xe237e0, 0xe4d56f, 0x9d923b, 0x7)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x35a
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/markusressel/fan2go/cmd.Execute()
        /github/workspace/cmd/root.go:71 +0x2bf
main.main()
        /github/workspace/main.go:25 +0x20
igneel@G3-3590 ~/Downloads [2]> sudo fan2go detect
> acpitz
 Sensors   Index   Label    Value  
           1       hwmon1   25000  

> nvme-pci-0200
 Sensors   Index   Label       Value  
           1       Composite   63850  

  ERROR   File reading error: open /sys/devices/platform/dell_smm_hwmon/hwmon/hwmon4/pwm1_enable: no such file or directory
  FATAL   Cannot read pwm_enable value of 
panic: 

goroutine 1 [running]:
github.com/pterm/pterm.checkFatal(...)
        /go/pkg/mod/github.com/pterm/[email protected]/prefix_printer.go:340
github.com/pterm/pterm.(*PrefixPrinter).Printfln(0xe210c0, 0x9e8958, 0x22, 0xc0000c3248, 0x1, 0x1, 0x3d)
        /go/pkg/mod/github.com/pterm/[email protected]/prefix_printer.go:282 +0x23f
github.com/markusressel/fan2go/internal/ui.Fatal(...)
        /github/workspace/internal/ui/logging.go:36
github.com/markusressel/fan2go/cmd.createFans(0xc0000d0940, 0x31, 0x0, 0x0, 0x0)
        /github/workspace/cmd/detect.go:162 +0x75d
github.com/markusressel/fan2go/cmd.glob..func2(0xe23560, 0xe4d770, 0x0, 0x0)
        /github/workspace/cmd/detect.go:51 +0x38d
github.com/spf13/cobra.(*Command).execute(0xe23560, 0xe4d770, 0x0, 0x0, 0xe23560, 0xe4d770)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xe237e0, 0xe4d56f, 0x9d923b, 0x7)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x35a
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/markusressel/fan2go/cmd.Execute()
        /github/workspace/cmd/root.go:71 +0x2bf
main.main()
        /github/workspace/main.go:25 +0x20
igneel@G3-3590 ~/Downloads [2]> sudo fan2go detect
> acpitz
 Sensors   Index   Label    Value  
           1       hwmon1   25000  

> nvme-pci-0200
 Sensors   Index   Label       Value  
           1       Composite   63850  

  ERROR   File reading error: open /sys/devices/platform/dell_smm_hwmon/hwmon/hwmon4/pwm1_enable: no such file or directory
  FATAL   Cannot read pwm_enable value of 
panic: 

goroutine 1 [running]:
github.com/pterm/pterm.checkFatal(...)
        /go/pkg/mod/github.com/pterm/[email protected]/prefix_printer.go:340
github.com/pterm/pterm.(*PrefixPrinter).Printfln(0xe210c0, 0x9e8958, 0x22, 0xc0000c3248, 0x1, 0x1, 0x3d)
        /go/pkg/mod/github.com/pterm/[email protected]/prefix_printer.go:282 +0x23f
github.com/markusressel/fan2go/internal/ui.Fatal(...)
        /github/workspace/internal/ui/logging.go:36
github.com/markusressel/fan2go/cmd.createFans(0xc0000d0940, 0x31, 0x0, 0x0, 0x0)
        /github/workspace/cmd/detect.go:162 +0x75d
github.com/markusressel/fan2go/cmd.glob..func2(0xe23560, 0xe4d770, 0x0, 0x0)
        /github/workspace/cmd/detect.go:51 +0x38d
github.com/spf13/cobra.(*Command).execute(0xe23560, 0xe4d770, 0x0, 0x0, 0xe23560, 0xe4d770)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xe237e0, 0xe4d56f, 0x9d923b, 0x7)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x35a
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/markusressel/fan2go/cmd.Execute()
        /github/workspace/cmd/root.go:71 +0x2bf
main.main()
        /github/workspace/main.go:25 +0x20

Suggestions

Cheers.

First of all: loverly tool, came here due to problems with fancontrol

since i am not familiar with go (yet) i'd like to add some suggestions (maybe a PR later, when i understand go)

sensor-detect:

  • initially step up in increments by 20 to quickly catch starting PWM
  • also do fans one by one to prevent potential overheating from shutting down all the fans @start

control:

  • it would be really nice to combine sensors in some kind of simple logic (median, max, floor(md5(rand())), ...) to i.e configure case fans to ramp up if either gpu or cpu need more cooling

Fan speeds are not "reset" when exiting fan2go

By @eldorel

From what I can tell, when manually run from a terminal or via init script; Stopping ffan2gan2go is currently not setting the PWM to max when stopped (nor, seemingly, setting PWM_Enable to false) .

The code for responding to SIGTERM is here

This functionality apparently got lost in the recent rewrite and should be added back/fixed to prevent overheating while fan2go is not running (anymore).

dell laptop con fan2go dopo aver caricato i driver riceve un messaggio di errore

Non riesco a rilevare la ventola con i sensori sul mio laptop dell senza caricare il driver, ma dopo aver caricato il driver ed eseguito fan2go detect, il sistema visualizza il seguente messaggio di errore: ERROR File reading error: open /sys/devices/virtual/hwmon/hwmon7/pwm1 _enable: no such file or directory goroutine 1 [running]: github.com/markusressel/fan2go/internal.createFans({0xc00025e240, 0x22}) /home/siezi/Downloads/JD/fan2go-0.0.17/internal/backend.go:600 +0x3c1 github.com/markusressel/fan2go/internal.FindControllers() /home/siezi/Downloads/JD/fan2go-0.0.17/internal/backend.go:547 +0x248 github.com/markusressel/fan2go/internal.Run(0x0) /home/siezi/Downloads/JD/fan2go-0.0.17/internal/backend.go:48 +0xcb github.com/markusressel/fan2go/cmd.glob..func1(0x9f5440, {0x759b45, 0x2, 0x2}) /home/siezi/Downloads/JD/fan2go-0.0.17/cmd/root.go:41 +0x65 github.com/spf13/cobra.(*Command).execute(0x9f5440, {0xc000012190, 0x2, 0x2}) /home/siezi/go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x5f8 github.com/spf13/cobra.(*Command).ExecuteC(0x9f5440) /home/siezi/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x3bc github.com/spf13/cobra.(*Command).Execute(...) /home/siezi/go/pkg/mod/github.com/spf13/[email protected]/command.go:902 github.com/markusressel/fan2go/cmd.Execute() /home/siezi/Downloads/JD/fan2go-0.0.17/cmd/root.go:248 +0x2a6 main.main() /home/siezi/Downloads/JD/fan2go-0.0.17/main.go:25 +0x17
Come devo configurarlo per farlo funzionare correttamente.

OpenRC init script support.

To support Gentoo, we need OpenRC support as well as systemd.
This code works perfectly for me:

#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

command="/usr/bin/fan2go"
command_background=true
required_files="/etc/fan2go/fan2go.yaml"
pidfile="/var/run/fan2go.pid"

depend() {
        need localmount
        use lm_sensors
}

I also have an ebuild + archive with all dependencies, but it's not finished, and anyway, I should push it into Gentoo.

Runtime Error/sigsegv

Describe the bug
Just after the initialisation phase fan2go crashes with a sigsegv error.

 INFO  Using configuration file at: /etc/fan2go/fan2go.yaml
 INFO  Gathering sensor data for top_rad...
 INFO  Gathering sensor data for front_rad_bottom...
 INFO  Gathering sensor data for front_rad_top...
 INFO  Gathering sensor data for rear_fan...
 INFO  Gathering sensor data for pump...
 INFO  Loading fan curve data for fan 'top_rad'...
 INFO  Loading fan curve data for fan 'front_rad_bottom'...
 INFO  Loading fan curve data for fan 'front_rad_top'...
 INFO  Loading fan curve data for fan 'pump'...
 INFO  Loading fan curve data for fan 'rear_fan'...
 WARNING  Fan 'front_rad_bottom' has not yet been analyzed, starting initialization sequence...
 WARNING  Fan 'pump' has not yet been analyzed, starting initialization sequence...
 WARNING  Fan 'front_rad_top' has not yet been analyzed, starting initialization sequence...
 WARNING  Fan 'top_rad' has not yet been analyzed, starting initialization sequence...
 WARNING  Fan 'rear_fan' has not yet been analyzed, starting initialization sequence...
 INFO  Start PWM of front_rad_top: 0
 INFO  Max PWM of front_rad_top: 251
 INFO  Starting controller loop for fan 'front_rad_top'
 INFO  Start PWM of top_rad: 0
 INFO  Max PWM of top_rad: 253
 INFO  Starting controller loop for fan 'top_rad'
 INFO  Start PWM of front_rad_bottom: 0
 INFO  Max PWM of front_rad_bottom: 252
 INFO  Starting controller loop for fan 'front_rad_bottom'
 INFO  Start PWM of rear_fan: 0
 INFO  Max PWM of rear_fan: 251
 INFO  Starting controller loop for fan 'rear_fan'
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x55e06ceec744]

goroutine 65 [running]:
github.com/markusressel/fan2go/internal/controller.(*fanController).calculateTargetPwm(0xc000388ee0)
        github.com/markusressel/fan2go/internal/controller/controller.go:284 +0x64
github.com/markusressel/fan2go/internal/controller.(*fanController).UpdateFanSpeed(0xc000388ee0)
        github.com/markusressel/fan2go/internal/controller/controller.go:160 +0x37
github.com/markusressel/fan2go/internal/controller.(*fanController).Run.func3()
        github.com/markusressel/fan2go/internal/controller/controller.go:139 +0xfe
github.com/oklog/run.(*Group).Run.func1({0xc000614080, 0x55e06d198910})
        github.com/oklog/[email protected]/group.go:38 +0x2f
created by github.com/oklog/run.(*Group).Run
        github.com/oklog/[email protected]/group.go:37 +0x22f

To Reproduce
Steps to reproduce the behavior:
Remove database file and start fan2go, wait for initialisation, above error will happen. After initialisation fan2go will always produce the above.

Expected behavior
fan2go should start, and take over fan control

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Distro: Manjaro
  • uname -a: Linux 5.16.5-1-MANJARO #1 SMP PREEMPT Tue Feb 1 16:57:14 UTC 2022 x86_64 GNU/Linux
  • sensors -v: sensors version 3.6.0+git with libsensors version 3.6.0+git
  • fan2go version: 0.4.1

Additional context
Not sure if this is a problem with my motherboard or not as the reason I started looking for another fan controller to replace fancontrol(-gui) was a persistent error when trying to set PWM. Will remove 1 fan at a time and see if I can narrow down to anything specific.

fan2go exits when a single fan or sensor is missing

Describe the bug

Fan2go completely fails to start with the error "FATAL: Couldn't find hwmon device with platform " as soon as it reaches the first fan (or sensor) with an incorrect or missing platform.

To Reproduce

  1. Setup fan2go with working config with multiple fans, sensors, and curves.
  2. Modify the 'platform' for the first fan configuration to an incorrect value (add a digit to the end).
  3. Save config
  4. Restart Fan2go
  5. monitor log/journal
  6. Fan2go will exit with "FATAL: Couldn't find hwmon device with platform " despite the other fans and sensors being correctly configured

Expected behavior

Fan2go should alert the user to the broken configuration, but still continue to check {and control} any properly configured fans...

Screenshots

image

Desktop (please complete the following information):

  • Distro: [Arch Linux/EndeavourOS]
  • uname -a: 5.15.7-arch1-1 1 SMP PREEMPT Wed, 08 Dec 2021 14:33:16 +0000 x86_64 GNU/Linux
  • sensors -v: sensors version 3.6.0+git with libsensors version 3.6.0+git
  • fan2go version: 0.2.2

Additional context

So in my case, the USB controller is only running 6 fans out of 12 in this device, and Fan2go is controlling 6 of those.
However Fan2go can control all of them.

Having Fan2go fail to activate half of the fans is a problem, but it failing to control the others when it fully could have done so could have unwanted side effects.

Additional Additional context
Having fan2go ignore and alert on badly configured fans would have provided a quick workaround to a device that keeps alternating between two VERY similar Platform IDs, by duplicating the fan config with both platforms and simply allowing it to control using the platform ID that the module order loaded with while the other 'incorrect' platform failed.

@elais You also might want to double check this on your setup, since you have the same hardware.

Platform is ambiguous for certain devices like GPUs and NVMe drives

Discussed in https://github.com/markusressel/fan2go/discussions/45

Originally posted by snailshoe October 31, 2021
Does this allow control of multiple AMD GPU fans. I have multiple GPU cards and am not sure if it will allow control of each one individually.

Below is the result of my detect. They all seem to have the same index number, but the hwmon number is different for each one. Will this work for that scenario?

Detected Devices:
acpitz
1: hwmon0 (temp1_input): 27800
2: hwmon0 (temp2_input): 29800
amdgpu
1: hwmon2 (pwm1): RPM: 530 PWM: 94 Auto: false
1: edge (temp1_input): 79000
coretemp
1: Package id 0 (temp1_input): 48000
2: Core 0 (temp2_input): 44000
3: Core 1 (temp3_input): 48000
amdgpu
1: hwmon4 (pwm1): RPM: 1153 PWM: 109 Auto: false
1: edge (temp1_input): 53000
amdgpu
1: hwmon5 (pwm1): RPM: 796 PWM: 43 Auto: false
1: edge (temp1_input): 51000

Instead of f.ex. just nvme as a platform, some additional info has to be included to differentiate multiple devices with the same platform. sensors f.ex. uses nvme-pci-0100.

Distinguish between startPwm and minPwm

For most fans there is a difference between

  • the min pwm at which the fan starts to rotate from a stand still
  • and the max pwm at which the fan still rotates when it was rotating previously

where the latter is smaller than the former in most cases.

To be able to securely make a fan start up, we need to know the startPwm value.
To also be able to let the fan run at a lower speed than startPwm (which might be possible or not) we also need to know the minPwm value.

Alternatively we could simply "jumpstart" fans by setting them to 100% for a brief moment, but this would also require knowledge about how long to do this without inducing annoying "ramping" sounds.

Not working after standby

Describe the bug
After a standby/hibernation the fans go back to automatic control and aren't controlled by fan2go anymore
This can be seen in 100% fan usage and logs get spammed with
WARNING: PWM of fan1 was changed by third party! Last set PWM value was: 50 but is now: 250

When fan2go is manually restarted its fine again

To Reproduce
Steps to reproduce the behavior:

  1. Setup fan2go
  2. Hibernate/standby
  3. See logs complaining about not being able to set the fan speed

Expected behavior
fan2go should be able to set the fan speeds after standby without having to manually restart the process

Desktop:

  • Distro: Ubuntu 20.04
  • uname -a: Linux user 5.13.0-22-generic # 22~20.04.1-Ubuntu SMP Tue Nov 9 15:07:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • sensors -v: sensors version 3.6.0 with libsensors version 3.6.0
  • fan2go version: 0.2.5

Additional context
I'm currently trying fan2go (before I used fancontrol) and both seem to suffer from the same issue

For fancontrol there's a working fix mentioned in this german wiki: https://wiki.ubuntuusers.de/L%C3%BCftersteuerung/#Luefter-werden-nach-Ruhezustand-Energiesparmodus-nicht-mehr-angesteuert

In each [loop] interval, the current time is compared with that of the last cycle. If the last cycle was longer than interval * 5 seconds ago, it is assumed that the system was paused and the fans are reinitialized.

Is there a way to implement such a loop or something similar?

detect throws error

Hi, thanks for sharing. I've not used go before, I think I have the dependencies installed but I suspect that I'm missing somthing ovbious. I'm running Arch with Gnome and get this error:
`$ fan2go detect
panic: runtime error: makeslice: len out of range

goroutine 1 [running]:
github.com/asecurityteam/rolling.NewWindow(...)
/go/pkg/mod/github.com/asecurityteam/[email protected]+incompatible/window.go:11
github.com/markusressel/fan2go/internal.createFans(0xc0000b2600, 0x2e, 0x2e, 0x0, 0x0)
/github/workspace/internal/backend.go:489 +0x25d
github.com/markusressel/fan2go/internal.FindControllers(0x8c1d00, 0xc0000a1860, 0x9571ab, 0x7, 0xc0000a3a90)
/github/workspace/internal/backend.go:451 +0x293
github.com/markusressel/fan2go/cmd.glob..func2(0xd2fd60, 0xd55270, 0x0, 0x0)
/github/workspace/cmd/root.go:37 +0x37
github.com/spf13/cobra.(*Command).execute(0xd2fd60, 0xd55270, 0x0, 0x0, 0xd2fd60, 0xd55270)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:854 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xd2fac0, 0xd55088, 0x9571ab, 0x7)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:958 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:895
github.com/markusressel/fan2go/cmd.Execute()
/github/workspace/cmd/root.go:145 +0x27f
main.main()
/github/workspace/main.go:25 +0x20
`

Error notifications

Is your feature request related to a problem? Please describe.

It is very hard to notice when fan2go is having problems, since it usually runs as a daemon.
In the worst case, this can lead to a system crash if fan2go was not even able to restore fan speed control (or set them to full speed) before crashing.

Describe the solution you'd like

The most simple solution would probably be to use the FailureAction of systemd to issue a notify-send command.
However, this is quite limiting in the type of errors that the user can be notified about (only full crashes).

A more complete solution would be to integrate notify-send into fan2go and through that send arbitrary notifications.

Describe alternatives you've considered
N/A

Additional context
Also partly discussed in #70

drivetemp sensors are not uniqe

Describe the bug

When using the drivetemp kernel module to expose drive temperatures via lm-sensors their device names are not uniqe, making it impossible to differentiate between them:

$ fan2go detect
...
> drivetemp
  Sensors  Index  Label                 Value
           1      hwmon9 (temp1_input)  40000

> drivetemp
  Sensors  Index  Label                 Value
           1      hwmon7 (temp1_input)  29000

> drivetemp
  Sensors  Index  Label                 Value
           1      hwmon5 (temp1_input)  39000
...

Expected behavior

Like with f.ex. nct6776-isa-0, add the -scsi-5-0 suffix to the name.

Bolt DB doesn't allow parallel access, not even for reading

The DB used for fan2go bolt, only allows a single process to have the db file open, if this process has it open in read-write mode.
This prevents commands like sudo fan2go curve from working while the fan2go daemon is active in the background.

I am not entirely sure what the best solution to this is, but probably a different way of storing the fan curve data.

Since lm-sensors uses the file system already, it might be a good option to store the fan curve data (or any data for that matter) in simple json files on disk. This would also make it much easier for external programs to have a look at the data.

Print sensor name when using "fan2go detect"

This command is able to read the sensor name, it should be possible to do the same in go:

for i in /sys/class/hwmon/hwmon*/temp*_input; do echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)"; done

Segmentation Fault when there is a typo in the config

I made a typo in the config under fan:sensor: which resulted in a segmentation fault:

 INFO  Starting controller loop for fan 'cpu_fan' (hwmon3, pwm2)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x5a6130]

goroutine 7 [running]:
github.com/markusressel/fan2go/internal.calculateOptimalPwm(...)
	/github/workspace/internal/backend.go:701
github.com/markusressel/fan2go/internal.fanController(0xa9d8a0, 0xc00020d440, 0xc0001d2000, 0xc0001e4400, 0xc000420120, 0x1, 0xc000020040)
	/github/workspace/internal/backend.go:340 +0x680
github.com/markusressel/fan2go/internal.Run.func5(0x0, 0x0)
	/github/workspace/internal/backend.go:102 +0x117
github.com/oklog/run.(*Group).Run.func1(0xc000068060, 0xc00034d440, 0xc0003e8640)
	/go/pkg/mod/github.com/oklog/[email protected]/group.go:38 +0x27
created by github.com/oklog/run.(*Group).Run
	/go/pkg/mod/github.com/oklog/[email protected]/group.go:37 +0xbb

Here are the Full Log and Configuration File i used.

fan2go.yml.txt
full.log

Add --verbose flag

fan2go is pretty verbose while running:

Aug 20 00:28:29 Silver fan2go[1165973]: 2021/08/20 00:28:29 Setting in_top_double (pwm3) to 89 (mapped: 103) ...
Aug 20 00:28:29 Silver fan2go[1165973]: 2021/08/20 00:28:29 Setting cpu_fan (pwm2) to 89 (mapped: 67) ...
Aug 20 00:28:30 Silver fan2go[1165973]: 2021/08/20 00:28:30 Setting in_bottom (pwm4) to 43 (mapped: 61) ...
Aug 20 00:28:30 Silver fan2go[1165973]: 2021/08/20 00:28:30 Setting cpu_fan (pwm2) to 90 (mapped: 68) ...
Aug 20 00:28:30 Silver fan2go[1165973]: 2021/08/20 00:28:30 Setting in_top_double (pwm3) to 90 (mapped: 104) ...
Aug 20 00:28:31 Silver fan2go[1165973]: 2021/08/20 00:28:31 Setting in_top_double (pwm3) to 91 (mapped: 105) ...
Aug 20 00:28:31 Silver fan2go[1165973]: 2021/08/20 00:28:31 Setting cpu_fan (pwm2) to 91 (mapped: 69) ...
Aug 20 00:28:32 Silver fan2go[1165973]: 2021/08/20 00:28:32 Setting in_bottom (pwm4) to 44 (mapped: 62) ...
Aug 20 00:28:34 Silver fan2go[1165973]: 2021/08/20 00:28:34 Setting in_bottom (pwm4) to 43 (mapped: 61) ...
Aug 20 00:28:36 Silver fan2go[1165973]: 2021/08/20 00:28:36 Setting in_front (pwm5) to 42 (mapped: 62) ...
Aug 20 00:28:36 Silver fan2go[1165973]: 2021/08/20 00:28:36 Setting in_top_double (pwm3) to 92 (mapped: 106) ...
Aug 20 00:28:37 Silver fan2go[1165973]: 2021/08/20 00:28:37 Setting in_top_double (pwm3) to 93 (mapped: 107) ...
Aug 20 00:28:37 Silver fan2go[1165973]: 2021/08/20 00:28:37 Setting cpu_fan (pwm2) to 93 (mapped: 70) ..
...

Adding a --verbose flag should help minimize logging while also providing the option to print all the things.

Use multiple reads when creating curves and exclude "bad readings"

Hi,

first of all, thank you for the time you spent writing this software. I'm currently evaluating replacing fancontrol with this

Is your feature request related to a problem? Please describe.
When the software creates its DB of curves, it ramps the fan, but sometimes, there are bad readings that should be excluded.

Examples:

First creation :

IN_Front
               
  Start PWM  23
  Max PWM    25

 48214 ┤         ╭╮
 45000 ┤         ││
 41785 ┤         ││
 38571 ┤         ││
 35357 ┤         ││
 32143 ┤        ╭╯│
 28928 ┤        │ │
 25714 ┤        │ │
 22500 ┤        │ │
 19286 ┤        │ │
 16071 ┤        │ │
 12857 ┤        │ │
  9643 ┤        │ │
  6429 ┤        │ │
  3214 ┤        │ │
     0 ┼────────╯ ╰────────────────────────────────────────────────────────────────────────────────────────
                                                     RPM / PWM


OUT_Top
               
  Start PWM  0 
  Max PWM    58

 4917 ┤                      ╭╮
 4589 ┤                      ││
 4261 ┤                      ││
 3933 ┤                      ││
 3606 ┤                      ││
 3278 ┤                      ││
 2950 ┤                      ││
 2622 ┤                      ││
 2294 ┤                      ││
 1967 ┤                      ││
 1639 ┤                      ││
 1311 ┤                      ││
  983 ┤                      ││
  656 ┤                      ││                                           ╭───────────────────────────────
  328 ┤                      ││               ╭───────────────────────────╯
    0 ┼──────────────────────╯╰───────────────╯
                                                    RPM / PWM

Second DB creation (after delete)

IN_Front
               
  Start PWM  23
  Max PWM    25

 29471 ┤        ╭╮
 27506 ┤        ││
 25541 ┤        ││
 23577 ┤        ││
 21612 ┤        ││
 19647 ┤        ││
 17682 ┤        ││
 15718 ┤        ││
 13753 ┤        ││
 11788 ┤        │╰╮
  9824 ┤        │ │
  7859 ┤        │ │
  5894 ┤        │ │
  3929 ┤        │ │
  1965 ┤        │ │
     0 ┼────────╯ ╰────────────────────────────────────────────────────────────────────────────────────────
                                                     RPM / PWM


OUT_Top
                
  Start PWM  0  
  Max PWM    249

 682 ┤                                                                                           ╭───────
 636 ┤                                                                                    ╭──────╯
 591 ┤                                                                             ╭──────╯
 545 ┤                                                                       ╭─────╯
 500 ┤                                                                 ╭─────╯
 454 ┤                                                           ╭─────╯
 409 ┤                                                      ╭────╯
 364 ┤                                                 ╭────╯
 318 ┤                                             ╭───╯
 273 ┤                                          ╭──╯
 227 ┤                                         ╭╯
 182 ┤                                        ╭╯
 136 ┤                                        │
  91 ┤                                       ╭╯
  45 ┤                                       │
   0 ┼───────────────────────────────────────╯
                                                   RPM / PWM

Describe the solution you'd like
I think it could be a solution to read multiple times the speed, with some delay to ensure the fan had time to ramp up, and exclude the min and max

Describe alternatives you've considered
quite the same as above, but doing a comparison with the previous reading, if it was something else than 0, check the diff. but since every fan is different, it's difficult (impossible?) to find the right threshold to apply, even if, in my case, we are talking about difference in the 10's of 1000s RPM difference...

Additional context
I don't know if it make sense, but maybe add an option to rebuild the curve of a specific fan ?
I don't know either if those parameters are applied to the build curve process (or any other from the conf, but the definition of the fan):

rpmPollingRate: 1s
rpmRollingWindowSize: 10

but it sounds like this one

    startPwm: 102

is not.

I hope all of this makes sense and is not due to me not understanding the usage.

Not printing correct fan index

Hi, I am using fan2go on Debian 12 and had no issues getting it installed. I am trying to set up the yaml config but it doesn't seem to be detecting the correct indices for my fans, though every other sensor has a non-zero index aside from the fans.

This is part of the output of fan2go detect:

> nct6798-isa-0
  Fans     Index  Label   RPM  PWM  Auto 
           0      hwmon7  0    137  false
           0      hwmon7  590  93   false
           0      hwmon7  762  90   false
           0      hwmon7  511  53   false
           0      hwmon7  547  101  false

And this is what I get from sensors:

nct6798-isa-0290
Adapter: ISA adapter
fan1:                        0 RPM  (min =    0 RPM)
fan2:                      604 RPM  (min =    0 RPM)
fan3:                      774 RPM  (min =    0 RPM)
fan4:                      512 RPM  (min =    0 RPM)
fan5:                      541 RPM  (min =    0 RPM)
fan7:                        0 RPM  (min =    0 RPM)

Any idea what might be causing this?

Debian 12, kernel 5.18.0-1
Motherboard: Asus ProArt B550

Thank you.

Error "open .: is a directory"

I try to start fan2go with a configuration similar to the default configuration, but just with cpu fan.
fan2go gives me the following output:

 INFO  Using configuration file at: /etc/fan2go/fan2go.yaml
 WARNING  Cannot read pwm_enable value of cpu
 INFO  Gathering sensor data for cpu...
 INFO  Loading fan curve data for fan 'cpu'...
 WARNING  Fan 'cpu' has not yet been analyzed, starting initialization sequence...
  ERROR   Unable to run initialization sequence on cpu: open .: is a directory
 INFO  Fan controller for fan cpu stopped.
panic: open .: is a directory

goroutine 20 [running]:
github.com/markusressel/fan2go/internal.RunDaemon.func5()
	github.com/markusressel/fan2go/internal/backend.go:118 +0xc6
github.com/oklog/run.(*Group).Run.func1({0xc0000b5380?, 0x559b52daafc8?})
	github.com/oklog/[email protected]/group.go:38 +0x2f
created by github.com/oklog/run.(*Group).Run
	github.com/oklog/[email protected]/group.go:37 +0x22a

Configuration file:

# https://github.com/markusressel/fan2go
# The path of the database file
dbPath: "/etc/fan2go/fan2go.db"

# Allow the fan initialization sequence to run in parallel for all configured fans
runFanInitializationInParallel: false
# The maximum difference between consecutive RPM measurements to
# consider a fan speed "settled"
maxRpmDiffForSettledFan: 10

# The rate to poll temperature sensors at
tempSensorPollingRate: 200ms
# The number of temp sensor values to keep in a rolling window array
tempRollingWindowSize: 10

# The rate to poll fan RPM input sensors at
rpmPollingRate: 1s
# The number of rpm sensor values to keep in a rolling window array
rpmRollingWindowSize: 10

# The rate to update fan speed targets at
controllerAdjustmentTickRate: 200ms

# A list of fans to control
fans:
  # A user defined ID.
  # Used for logging only
  - id: cpu
    # The type of fan configuration
    hwmon:
      # The platform of the controller which is
      # connected to this fan (see sensor.platform below)
      platform: coretemp-isa-0
      # The index of this fan as displayed by `fan2go detect`
      index: 1
    # Indicates whether this fan should never stop rotating, regardless of
    # how low the curve value is
    neverStop: yes
    # The curve ID (defined above) that should be used to determine the
    # speed of this fan
    curve: cpu_curve
    # (Optional) Override for the lowest PWM value at which the
    # fan will still be able to start rotating.
    # Note: Settings this to a value that is too small
    #       may damage your fans. Use at your own risk!
    startPwm: 150

# A list of sensors to monitor
sensors:
  # A user defined ID, which is used to reference
  # a sensor in a curve configuration (see below)
  - id: cpu_package
    # The type of sensor configuration
    hwmon:
      # The controller platform as displayed by `fan2go detect`, f.ex.:
      # "nouveau", "coretemp" or "it8620" etc.
      platform: coretemp
      # The index of this sensor as displayed by `fan2go detect`
      index: 1

# A list of control curves which can be utilized by fans
# or other curves
curves:
  # A user defined ID, which is used to reference
  # a curve in a fan configuration (see above)
  - id: cpu_curve
    # The type of curve configuration, one of: linear | function
    linear:
      # The sensor ID to use as a temperature input
      sensor: cpu_package
      # Steps to define a section-wise defined speed curve function
      steps:
        # Sensor value -> Speed (0-255)
        - 33: 150
        - 40: 180
        - 85: 255

statistics:
  # Whether to enable the prometheus exporter or not
  enabled: false
  # The port to expose the exporter on
  port: 9000

Output of fan2go detect:

> amdgpu-pci-0d500
  Fans     Index  Label   RPM   PWM  Auto
           1      hwmon4  2008  49   true
  Sensors  Index  Label               Value
           1      edge (temp1_input)  59000

> pch_lewisburg-virtual-0
  Sensors  Index  Label                 Value
           1      hwmon2 (temp1_input)  35000

> nvme-pci-010100
  Sensors  Index  Label                    Value
           1      Composite (temp1_input)  38850
           2      Sensor 1 (temp2_input)   38850

> dell_smm-isa-0
  Fans     Index  Label   RPM  PWM  Auto 
           1      hwmon3  0    255  false
           2      hwmon3  0    255  false
           3      hwmon3  698  255  false
> coretemp-isa-0
  Sensors  Index  Label                       Value
           1      Package id 0 (temp1_input)  44000
           2      Core 0 (temp2_input)        40000
           3      Core 1 (temp3_input)        36000
           4      Core 2 (temp4_input)        40000
           5      Core 6 (temp8_input)        38000
           6      Core 12 (temp14_input)      38000
           7      Core 13 (temp15_input)      41000
           8      Core 16 (temp18_input)      37000
           9      Core 18 (temp20_input)      38000
           10     Core 19 (temp21_input)      38000
           11     Core 20 (temp22_input)      38000
           12     Core 21 (temp23_input)      38000
           13     Core 24 (temp26_input)      40000
           14     Core 25 (temp27_input)      35000
           15     Core 26 (temp28_input)      38000
           16     Core 27 (temp29_input)      44000
           17     Core 29 (temp31_input)      39000

**Desktop **

  • Distro: Arch Linux
  • uname -a: Linux 5.16.15-arch1-1 #1 SMP PREEMPT Thu, 17 Mar 2022 00:30:09 +0000 x86_64 GNU/Linux
  • sensors -v:sensors version 3.6.0+git with libsensors version 3.6.0+git
  • fan2go version:0.5.0

StartPWM slowly increases

While #1 was a good idea, it can lead to the startPWM creeping up slowly, if PWM measurements are sporadically 0, since there is currently no way that it will ever decrease (despite a restart of the application).

Solution

Adjusting the startPWM has to be delayed a bit. It should only be adjusted if the RPM is 0 for a longer (configurable) duration (f.ex. 2 seconds). This timer should reset when an adjustment was made, to avoid increasing the startPWM value too much.
Keep RPM values in a window (like other sensor values too) and only adjust startPWM if the full window is 0.

Improve exit behaviour

Currently fan2go doesn't do anything when exiting. This can lead to situations where the fans are "stuck" on a very low PWM level, which is a problem when the load increases without fan2go or a different fan control system running.

Solution

fan2go should try to restore the pwm_enabled value of configured fans to their original value when exiting.
If this is not working for some reason, or the value was 1 (meaning manual control) fan2go should try to set all configured fans to manual and maximum speed (255).

Better terminal output

Integrate pterm (or something similar) and provide a more beautiful interface while running.

Also, add a console parameter -disable-ui (or similar) to disable the fancy UI and use terminal output that is more useful for logging systems like systemd instead.

fan2go doesn't run initial measurement without specifying the config file as argument

A configuration file /etc/fan2go/fan2go.yaml exists.

Expected: Running fan2go should pick up the configuration file and start the initial measurement.

Actual: Error "no valid fan configuration" unless the configuration file path is passed as argument.

Example:

❯ ls /etc/fan2go/
total 76
drwxr-xr-x 1 root  root     90 29. Sep 17:28 .
drwxr-xr-x 1 root  root   4958 29. Sep 15:17 ..
-rw-r--r-- 1 siezi siezi  1754 26. Sep 20:59 fan2go.yaml

❯ sudo fan2go
2021/09/29 17:29:16 File reading error open /sys/devices/platform/f71882fg.656/pwm3_enable: no such file or directory
2021/09/29 17:29:16 Ignoring unconfigured sensor acpitz/temp2_input
2021/09/29 17:29:16 Ignoring unconfigured sensor coretemp/temp2_input
2021/09/29 17:29:16 Ignoring unconfigured sensor coretemp/temp3_input
2021/09/29 17:29:16 Ignoring unconfigured sensor coretemp/temp4_input
2021/09/29 17:29:16 Ignoring unconfigured sensor coretemp/temp5_input
2021/09/29 17:29:16 Ignoring unconfigured sensor f71808a/temp1_input
2021/09/29 17:29:16 Ignoring unconfigured sensor f71808a/temp2_input
2021/09/29 17:29:16 Ignoring unconfigured sensor amdgpu/temp1_input
2021/09/29 17:29:16 Ignoring unconfigured sensor amdgpu/temp2_input
2021/09/29 17:29:16 Ignoring unconfigured sensor amdgpu/temp3_input
2021/09/29 17:29:16 Ignoring unconfigured fan f71808a/pwm1 (f71882fg.656)
2021/09/29 17:29:16 Ignoring unconfigured fan f71808a/pwm2 (f71882fg.656)
2021/09/29 17:29:16 Ignoring unconfigured fan f71808a/pwm3 (f71882fg.656)
2021/09/29 17:29:16 Ignoring unconfigured fan amdgpu/pwm1 (hwmon3)
2021/09/29 17:29:16 No valid fan configurations, exiting.

❯ sudo fan2go -c /etc/fan2go/fan2go.yaml
2021/09/29 17:29:20 File reading error open /sys/devices/platform/f71882fg.656/pwm3_enable: no such file or directory
2021/09/29 17:29:20 Ignoring unconfigured sensor acpitz/temp1_input
2021/09/29 17:29:20 Ignoring unconfigured sensor acpitz/temp2_input
2021/09/29 17:29:20 Ignoring unconfigured sensor coretemp/temp2_input
2021/09/29 17:29:20 Ignoring unconfigured sensor coretemp/temp3_input
2021/09/29 17:29:20 Ignoring unconfigured sensor coretemp/temp4_input
2021/09/29 17:29:20 Ignoring unconfigured sensor coretemp/temp5_input
2021/09/29 17:29:20 Ignoring unconfigured sensor f71808a/temp2_input
2021/09/29 17:29:20 Ignoring unconfigured sensor amdgpu/temp1_input
2021/09/29 17:29:20 Ignoring unconfigured sensor amdgpu/temp2_input
2021/09/29 17:29:20 Ignoring unconfigured sensor amdgpu/temp3_input
2021/09/29 17:29:20 Ignoring unconfigured fan f71808a/pwm3 (f71882fg.656)
2021/09/29 17:29:20 Ignoring unconfigured fan amdgpu/pwm1 (hwmon3)
2021/09/29 17:29:20 Gathering data...
2021/09/29 17:29:20 Gathering data...
...

Not reading PWM values on corsair commander pro fan controller.

Hi. Fan2go is having trouble reading the pwm_enable flag for the corsair commander pro, which I think is leading to it not being able to enable the fan control on the fans connected to the controller. Here's the output of my run.

 INFO  Using configuration file at: /etc/fan2go/fan2go.yaml
 WARNING  Cannot read pwm_enable value of back_top
 WARNING  Cannot read pwm_enable value of back_bottom
 INFO  Gathering sensor data for back_top...
 INFO  Gathering sensor data for back_bottom...
 WARNING  Cannot read pwm_enable value of front_bottom
 INFO  Gathering sensor data for front_bottom...
 WARNING  Cannot read pwm_enable value of front_top
 INFO  Gathering sensor data for front_top...
 INFO  Loading fan curve data for fan 'front_top'...
 INFO  Loading fan curve data for fan 'back_top'...
 INFO  Loading fan curve data for fan 'back_bottom'...
 INFO  Loading fan curve data for fan 'front_bottom'...
 WARNING  No fan curve data found for fan 'front_top', starting initialization sequence...
 WARNING  No fan curve data found for fan 'back_bottom', starting initialization sequence...
 WARNING  Could not enable fan control on front_top, trying to continue anyway...
 WARNING  No fan curve data found for fan 'back_top', starting initialization sequence...
 WARNING  No fan curve data found for fan 'front_bottom', starting initialization sequence...

And the output of Fan2go detect

> amdgpu-pci-0d00
 Fans      Index   Label    RPM   PWM   Auto
           1       hwmon8   0     0     true
 Sensors   Index   Label                    Value
           1       edge (temp1_input)       26000
           2       junction (temp2_input)   29000
           3       mem (temp3_input)        30000

> gigabyte_wmi-virtual-0
 Sensors   Index   Label                  Value
           1       hwmon4 (temp1_input)   41000
           2       hwmon4 (temp2_input)   38000
           3       hwmon4 (temp3_input)   31000
           4       hwmon4 (temp4_input)   20000
           5       hwmon4 (temp5_input)   37000
           6       hwmon4 (temp6_input)   42000

> nvme-pci-0100
 Sensors   Index   Label                     Value
           1       Composite (temp1_input)   52850
           2       Sensor 1 (temp2_input)    52850
           3       Sensor 2 (temp3_input)    70850

> acpitz-acpi-0
 Sensors   Index   Label                  Value
           1       hwmon0 (temp1_input)   16800

> corsaircpro-hid-3-7
 Fans      Index   Label       RPM   PWM   Auto
           1       fan1 4pin   456   10    false
           2       fan2 4pin   834   0     false
           3       fan3 4pin   573   48    false
           4       fan4 4pin   838   0     false
 Sensors   Index   Label                  Value
           1       hwmon7 (temp1_input)   27080

> iwlwifi_1-virtual-0
 Sensors   Index   Label                  Value
           1       hwmon5 (temp1_input)   50000

> k10temp-pci-0c3
 Sensors   Index   Label                 Value
           1       Tctl (temp1_input)    31750
           2       Tccd1 (temp3_input)   31000

> nvme-pci-0800
 Sensors   Index   Label                     Value
           1       Composite (temp1_input)   42850
           2       Sensor 1 (temp2_input)    42850
           3       Sensor 2 (temp3_input)    45850

is there another way to check for a pwm signal that could take into account a controller? pwmconfig detects the pwm values of the fans.

Some additional context:

The commander pro connects via USB header and uses the kernel module corsaircpro. I wonder if there's special logic needed to read from usb devices.

ERROR File reading error: open /sys/devices/

I just wanted to run a calibration on new fans and thought I update to the latest master (c43784e) for prosperity. I currently get:

███████  █████  ███    ██ ██████   ██████   ██████  
██      ██   ██ ████   ██      ██ ██       ██    ██ 
█████   ███████ ██ ██  ██  █████  ██   ███ ██    ██ 
██      ██   ██ ██  ██ ██ ██      ██    ██ ██    ██ 
██      ██   ██ ██   ████ ███████  ██████   ██████  

INFO  Using configuration file at: /etc/fan2go/fan2go.yaml
ERROR   File reading error: open /sys/devices/platform/f71882fg.656/pwm3_enable: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x55eda1]

goroutine 1 [running]:
github.com/markusressel/fan2go/internal.createFans({0xc00025e240, 0x22})
/home/siezi/Downloads/JD/fan2go-0.0.17/internal/backend.go:600 +0x3c1
github.com/markusressel/fan2go/internal.FindControllers()
/home/siezi/Downloads/JD/fan2go-0.0.17/internal/backend.go:547 +0x248
github.com/markusressel/fan2go/internal.Run(0x0)
/home/siezi/Downloads/JD/fan2go-0.0.17/internal/backend.go:48 +0xcb
github.com/markusressel/fan2go/cmd.glob..func1(0x9f5440, {0x759b45, 0x2, 0x2})
/home/siezi/Downloads/JD/fan2go-0.0.17/cmd/root.go:41 +0x65
github.com/spf13/cobra.(*Command).execute(0x9f5440, {0xc000012190, 0x2, 0x2})
/home/siezi/go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x5f8
github.com/spf13/cobra.(*Command).ExecuteC(0x9f5440)
/home/siezi/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
/home/siezi/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/markusressel/fan2go/cmd.Execute()
/home/siezi/Downloads/JD/fan2go-0.0.17/cmd/root.go:248 +0x2a6
main.main()
/home/siezi/Downloads/JD/fan2go-0.0.17/main.go:25 +0x17

Rolling back to to the last known good 7a7260a still works fine.

ls /sys/devices/platform/f71882fg.656/pwm*
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm1
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm1_enable
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm1_interpolate
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_channels_temp
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point1_pwm
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point1_temp
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point1_temp_hyst
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point2_pwm
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point2_temp
-r--r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point2_temp_hyst
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point3_pwm
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point3_temp
-r--r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point3_temp_hyst
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point4_pwm
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point4_temp
-r--r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point4_temp_hyst
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_auto_point5_pwm
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_enable
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm2_interpolate
-rw-r--r-- 1 root root 4096  4. Okt 08:42 /sys/devices/platform/f71882fg.656/pwm3

Pwm3 is a AIO header which can't be controlled by the linux driver, it just exists at always on 100%.

PS: Just as a datapoint, feel free to close. 👍

Increase spindown time on inital measurement

If without active fan-control a fan spins at full speed (BIOS emergency mode) it may take a considerable time to spin down to the minimum speed (or stop). The current time window of 3 seconds is to small for that to happen.

The initial waiting time should be increased to at least 30 seconds, up to a minute would be preferable.

Is it posible to control fan speed depend on two temp sensors?

Subj.
Very often my CPU is cold, and GPU is hot, but only my water cool system sucks fresh air into the case.
If GPU has a high temp my water cool fans also should increase speeds. Basically, it's should calculate separately, but the final speed should be a max of this two.

Fan stop is detected at differrent PWM level than with fancontrol

So I switched from fancontrol to this app and noticed that detected stopping PWM levels for case fans are way higher than before.
fancontrol detected stop level is 30 for both fans while in fan2go it is 169 for the front fan and 151 for the back fan.
Why is there such discrepancy? It is the same for a CPU fan.

pwmconfig script which is used to gather the curve data for fancontrol checks the speed from Max to Min while fan2go does it in the opposite way. IMO, this is the source of problem because it is hard for a fan to start spinning from idle at low PWM levels, when the average fan voltage is too low.

Repeat error message: "PWM of ${FAN_NAME} was changed by third party! Last set PWM value was"

This error seems to be related to a file that LM_Sensors doesn't create for my fan controller (a corsair commander pro), but it seems to also prevent the PWM values from being set to sane values when fan2go is closed or the system reboots.

Here are all of the errors, for just one fan. I have 6 fans on this controller, but the errors are all identical. :

INFO Using configuration file at: /etc/fan2go/fan2go.yaml

WARNING Cannot read pwm_enable value of Front-02
INFO Gathering sensor data for Front-02...
INFO Loading fan curve data for fan 'Front-02'...
INFO Start PWM of Front-02: 0
INFO Max PWM of Front-02: 255
WARNING Could not enable fan control on Front-02, trying to continue anyway...
INFO Starting controller loop for fan 'Front-02'

WARNING PWM of Front-02 was changed by third party! Last set PWM value was: 249 but is now: 250
WARNING PWM of Front-02 was changed by third party! Last set PWM value was: 249 but is now: 250

This error only occurs when the fans are not at 255 PWM or 0 PWM.

[Feature Request] Allow Fan and Sensor to utilise hwmonX/name file value for persistence

Is your feature request related to a problem? Please describe.

Every few reboots, a few of my LM_Sensors/hwmon devices shuffle around thanks to module load order.
In most cases, using 'platform' works fine, but for USB HID devices, the platform data includes the port number and module loading order.

For example: My Corsair comander pro alternates between being identified as "corsaircpro-hid-3-2" and "corsaircpro-hid-3-13"

Describe the solution you'd like
The HWMON spec includes a single file "name" (which is incidentally the only mandatory file in the folders), which should contain the name of the device without the port identifiers.

I would appreciate the ability to set Name as an optional/additional way for Fan2go to identify the correct device.
Since most users only have a single instance of their devices, the name should usually be sufficient, and platform is present for advanced users who have duplicate hardware and need to control those independently.

Describe alternatives you've considered
N/A

How to set you up?

Hello. I can't figure out how to set up fan2go. I am facing an error when I try to execute the `sudo fan2go. Here is what I get in response:

███████  █████  ███    ██ ██████   ██████   ██████  
██      ██   ██ ████   ██      ██ ██       ██    ██ 
█████   ███████ ██ ██  ██  █████  ██   ███ ██    ██ 
██      ██   ██ ██  ██ ██ ██      ██    ██ ██    ██ 
██      ██   ██ ██   ████ ███████  ██████   ██████  

 INFO  Using configuration file at: /etc/fan2go/fan2go.yaml
 INFO  Gathering sensor data for cpu...
 INFO  Loading fan curve data for fan 'cpu'...
 WARNING  Fan 'cpu' has not yet been analyzed, starting initialization sequence...
 WARNING  Cannot read RPM value of fan cpu: read /sys/class/hwmon/hwmon2/fan1_input: no such device or address
 WARNING  Cannot read RPM value of fan cpu: read /sys/class/hwmon/hwmon2/fan1_input: no such device or address
 WARNING  Cannot read RPM value of fan cpu: read /sys/class/hwmon/hwmon2/fan1_input: no such device or address
 WARNING  Cannot read RPM value of fan cpu: read /sys/class/hwmon/hwmon2/fan1_input: no such device or address

A little information.

fan2go detect:

> asus-isa-0
  Fans     Index  Label    RPM  PWM  Auto
           1      cpu_fan  0    0    true
  Sensors  Index  Label                 Value
           1      hwmon2 (temp1_input)  43050

> coretemp-isa-0
  Sensors  Index  Label                       Value
           1      Package id 0 (temp1_input)  45000
           2      Core 0 (temp2_input)        45000
           3      Core 1 (temp3_input)        44000

> acpitz-acpi-0
  Sensors  Index  Label                 Value
           1      hwmon1 (temp1_input)  43000

Configuration file:

# The path of the database file
dbPath: "/etc/fan2go/fan2go.db"

# Allow the fan initialization sequence to run in parallel for all configured fans
runFanInitializationInParallel: false
# The maximum difference between consecutive RPM measurements to
# consider a fan speed "settled"
maxRpmDiffForSettledFan: 10

# The rate to poll temperature sensors at
tempSensorPollingRate: 200ms
# The number of temp sensor values to keep in a rolling window array
tempRollingWindowSize: 10

# The rate to poll fan RPM input sensors at
rpmPollingRate: 1s
# The number of rpm sensor values to keep in a rolling window array
rpmRollingWindowSize: 10

# The rate to update fan speed targets at
controllerAdjustmentTickRate: 200ms

# A list of fans to control
fans:
  # A user defined ID.
  # Used for logging only
  - id: cpu
    # The type of fan configuration
    hwmon:
      # The platform of the controller which is
      # connected to this fan (see sensor.platform below)
      platform: asus-isa-0
      # The index of this fan as displayed by `fan2go detect`
      index: 1
    # Indicates whether this fan should never stop rotating, regardless of
    # how low the curve value is
    neverStop: yes
    # The curve ID (defined above) that should be used to determine the
    # speed of this fan
    curve: cpu_curve
    # (Optional) Override for the lowest PWM value at which the
    # fan will still be able to start rotating.
    # Note: Settings this to a value that is too small
    #       may damage your fans. Use at your own risk!
    startPwm: 30

#  - id: in_front
#    hwmon:
#      platform: it8620
#      index: 4
#    neverStop: yes
#    curve: case_avg_curve

#  - id: out_back
#    hwmon:
#      platform: it8620
#      index: 5
#    neverStop: yes
#    curve: case_avg_curve

# A list of sensors to monitor
sensors:
  # A user defined ID, which is used to reference
  # a sensor in a curve configuration (see below)
  - id: cpu_package
    # The type of sensor configuration
    hwmon:
      # The controller platform as displayed by `fan2go detect`, f.ex.:
      # "nouveau", "coretemp" or "it8620" etc.
      platform: asus-isa-0
      # The index of this sensor as displayed by `fan2go detect`
      index: 1

#  - id: mainboard
#    hwmon:
#      platform: it8620
#      index: 3

#  - id: sata_ssd
#    hwmon:
#      platform: acpitz
#      index: 1

# A list of control curves which can be utilized by fans
# or other curves
curves:
  # A user defined ID, which is used to reference
  # a curve in a fan configuration (see above)
  - id: cpu_curve
    # The type of curve configuration, one of: linear | function
    linear:
      # The sensor ID to use as a temperature input
      sensor: cpu_package
      # Steps to define a section-wise defined speed curve function
      steps:
        # Sensor value -> Speed (0-255)
        - 40: 0
        - 50: 50
        - 80: 255

#  - id: mainboard_curve
#    linear:
#      sensor: mainboard
      # Sensor input value at which the curve is at minimum speed
#      min: 40
      # Sensor input value at which the curve is at maximum speed
#      max: 80

#  - id: ssd_curve
#    linear:
#      sensor: sata_ssd
#      min: 40
#      max: 70

# - id: case_avg_curve
#    function:
      # Type of aggregation function to use, on of: minimum | maximum | average
#      type: average
      # A list of curve IDs to use
#      curves:
#        - cpu_curve
#        - mainboard_curve
#        - ssd_curve

#statistics:
  # Whether to enable the prometheus exporter or not
#  enabled: false
  # The port to expose the exporter on
#  port: 9000

sudo fan2go config validate

 INFO  Using configuration file at: /etc/fan2go/fan2go.yaml
 SUCCESS  Config looks good! :)

I am using archlinux and fan2go built from the AUR. Please tell me how to fix this?

One of the case fans is not detected

Describe the bug
My PC has 2 case fans - front intake and back outflow but fan2go detect only shows front fan (as well as a CPU fan)

$ fan2go detect --no-color --no-style
> nct6798-isa-0
  Fans     Index  Label   RPM  PWM  Auto 
           1      hwmon3  0    3    false
           2      hwmon3  0    3    false
  Sensors  Index  Label                                   Value 
           1      SYSTIN (temp1_input)                    31000 
           2      CPUTIN (temp2_input)                    36500 
           3      AUXTIN0 (temp3_input)                   25500 
           4      AUXTIN1 (temp4_input)                   7000  
           5      AUXTIN2 (temp5_input)                   -13000
           6      AUXTIN3 (temp6_input)                   25000 
           7      PECI Agent 0 Calibration (temp7_input)  36500 
           8      PCH_CHIP_CPU_MAX_TEMP (temp8_input)     0     
           9      PCH_CHIP_TEMP (temp9_input)             0     
           10     PCH_CPU_TEMP (temp10_input)             0

Where Index #1 is a front fan and #2 is a CPU fan

It is detected by lm_sensors. Case and CPU fans are shown as fan1 and fan2 respectively, other fan is shown as fan4.

To Reproduce
Steps to reproduce the behavior:

  1. run fan2go detect
  2. Scroll down to nct6798
  3. See 2 fans instead of 3

Expected behavior
fan2go detect shows all available fans and allows to control them.

Desktop (please complete the following information):

  • Distro: [Arch Linux]
  • uname -a: Linux linux 5.17.7-zen1-1-zen #1 ZEN SMP PREEMPT Thu, 12 May 2022 18:55:52 +0000 x86_64 GNU/Linux
  • sensors -v: sensors version 3.6.0+git with libsensors version 3.6.0+git
  • fan2go version: dev

Handle pwmX_enable file as optional

ERROR File reading error: open /sys/devices/virtual/hwmon/hwmon4/pwm1_enable: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5a878d]

goroutine 1 [running]:
github.com/markusressel/fan2go/internal.createFans(0xc0000ac810, 0x21, 0x21, 0x0, 0x0)
/github/workspace/internal/backend.go:598 +0x4cd
github.com/markusressel/fan2go/internal.FindControllers(0xc000082900, 0x8f2da0, 0xe185e0, 0x0, 0x0)
/github/workspace/internal/backend.go:545 +0x293
github.com/markusressel/fan2go/cmd.glob..func2(0xe0b280, 0xe35450, 0x0, 0x0)
/github/workspace/cmd/root.go:56 +0xe4
github.com/spf13/cobra.(*Command).execute(0xe0b280, 0xe35450, 0x0, 0x0, 0xe0b280, 0xe35450)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xe0b000, 0xe3524f, 0x9cc8fe, 0x7)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x35a
github.com/spf13/cobra.(*Command).Execute(...)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/markusressel/fan2go/cmd.Execute()
/github/workspace/cmd/root.go:248 +0x382
main.main()
/github/workspace/main.go:25 +0x20

error while loading shared libraries

Describe the bug
I'm not sure if its a bug or just a user error, but I copied the fan2go executable to /bin and while trying to use it this error is printed:
fan2go: error while loading shared libraries: libsensors.so.5: cannot open shared object file: No such file or directory

Desktop :

  • Distro: OpenSuse Tumbleweed KDE
  • uname -a: Linux SFX 5.15.12-1-default #1 SMP Wed Dec 29 14:50:16 UTC 2021 (375fcb8) x86_64 x86_64 x86_64 GNU/Linux
  • sensors -v: sensors version 3.6.0 with libsensors version 3.6.0
  • fan2go version: 0.4.0

Account for weird, capped fan pwm boundaries

When a fan never stops, regardless of the PWM value, but only changes speed at a certain PWM value above 0 (f.ex. 50), the linear interpolation between fan.StartPwm and fan.MaxPwm is off in the area between 0 and 50.

image

There should be another variable, f.ex. fan.MinPwm - extracted from the fan curve data - which indicates this PWM breaking point (f.ex. 50). This variable then has to be considered as the minimum PWM value when interpolating the target PWM for a given fan.

Is it possible to control a fan using multiple sensors?

Just discovered this tool when investigating what options there exist for controlling fans in linux, it looks promising but I haven't tested it out yet.

I do have a question, is it possible to control a fan using multiple sensors? From the README it looks like it is limit to one sensor per fan.

My use case is that I want to control my case fans based on both the CPU or GPU. Right now I'm using the UEFI fan control, which can only monitor the CPU (and the motherboard). It works great when I do CPU heavy tasks. But when I for example game, my CPU is not hit as hard and thus the case fans does not ramp up. Causing my GPU to run its fans higher to compensate.

I'm using a mini-itx case so I've only one fan header for my case fans.

panic: runtime error: invalid memory address or nil pointer dereference

First of all, Dankeschön, for all the hard work

Running on Linux Mint 20.2 (basically a Ubuntu 21.04)
Board is a quite old Intel DQ61-EP
lm-sensors is already the newest version (1:3.6.0-2ubuntu1).

master@tenshi ~ $ fan2go detect
Detected Devices:
amdgpu
  pwm1 (1): RPM: 998 PWM: 61 Auto: false
  temp1_input (1): 45000
coretemp
  temp1_input (1): 50000
  temp2_input (2): 54000
  temp3_input (3): 48000
  temp4_input (4): 47000
  temp5_input (5): 47000
nct6775
  pwm1 (1): RPM: 0 PWM: 255 Auto: false
  pwm2 (2): RPM: 153 PWM: 12 Auto: false
  pwm3 (3): RPM: 958 PWM: 102 Auto: false
  temp1_input (1): 44000
  temp2_input (2): 48000
  temp3_input (3): 50000
  temp6_input (6): 72000
  temp8_input (8): 0
master@tenshi ~ $ 

setup and initial run for the very first Time

master@tenshi ~ $ sudo fan2go
2021/07/26 20:58:14 Ignoring unconfigured sensor amdgpu/temp1_input
2021/07/26 20:58:14 Ignoring unconfigured sensor coretemp/temp2_input
2021/07/26 20:58:14 Ignoring unconfigured sensor coretemp/temp3_input
2021/07/26 20:58:14 Ignoring unconfigured sensor coretemp/temp4_input
2021/07/26 20:58:14 Ignoring unconfigured sensor coretemp/temp5_input
2021/07/26 20:58:14 Ignoring unconfigured sensor nct6775/temp1_input
2021/07/26 20:58:14 Ignoring unconfigured sensor nct6775/temp2_input
2021/07/26 20:58:14 Ignoring unconfigured sensor nct6775/temp6_input
2021/07/26 20:58:14 Ignoring unconfigured sensor nct6775/temp8_input
2021/07/26 20:58:14 Ignoring unconfigured fan amdgpu/pwm1
2021/07/26 20:58:14 Ignoring unconfigured fan nct6775/pwm1
2021/07/26 20:58:14 Ignoring unconfigured fan nct6775/pwm3
2021/07/26 20:58:14 Gathering data...
2021/07/26 20:58:17 Loading fan curve data for fan 'cpu_cooler'...
2021/07/26 20:58:17 No fan curve data found for fan 'cpu_cooler', starting initialization sequence...
2021/07/26 20:58:22 Measuring RPM of cpu_cooler (pwm2) at PWM: 0
2021/07/26 20:58:24 Measuring RPM of cpu_cooler (pwm2) at PWM: 1
2021/07/26 20:58:26 Measuring RPM of cpu_cooler (pwm2) at PWM: 2
2021/07/26 20:58:28 Measuring RPM of cpu_cooler (pwm2) at PWM: 3
....
2021/07/26 21:06:50 Measuring RPM of cpu_cooler (pwm2) at PWM: 254
2021/07/26 21:06:50 Start PWM of cpu_cooler (pwm2): 0
2021/07/26 21:06:50 Max PWM of cpu_cooler (pwm2): 235
2021/07/26 21:06:50 Starting controller loop for fan 'cpu_cooler'
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x55e6c0]

goroutine 21 [running]:
github.com/markusressel/fan2go/internal.calculateTargetSpeed(...)
	/github/workspace/internal/backend.go:411
github.com/markusressel/fan2go/internal.setOptimalFanSpeed(0xc00010be30, 0xc0000e3e48, 0x2)
	/github/workspace/internal/backend.go:404 +0x60
github.com/markusressel/fan2go/internal.fanController(0xa135e0, 0xc000069e00, 0xc0000dac00, 0xc00010be30, 0xc00041e300, 0x0, 0x0)
	/github/workspace/internal/backend.go:318 +0x23c
github.com/markusressel/fan2go/internal.Run.func5(0x0, 0x0)
	/github/workspace/internal/backend.go:99 +0xc9
github.com/oklog/run.(*Group).Run.func1(0xc0003ea000, 0xc0003a82a0, 0xc000113140)
	/go/pkg/mod/github.com/oklog/[email protected]/group.go:38 +0x27
created by github.com/oklog/run.(*Group).Run
	/go/pkg/mod/github.com/oklog/[email protected]/group.go:37 +0xbb
master@tenshi ~ $
master@tenshi ~ $

yaml:

# The path of the database file.
dbPath: "/etc/fan2go/fan2go.db"
# The rate to poll temperature sensors at.
tempSensorPollingRate: 200ms
# The number of sensor items to keep in a rolling window array.
rollingWindowSize: 50
# The rate to poll fan RPM input sensors at.
rpmPollingRate: 1s
# The rate to update fan speed targets at.
controllerAdjustmentTickRate: 200ms

# A list of sensors to monitor.
sensors:
  # A user defined ID, which is used to reference a
  # a sensor in a fan configuration (see below)
  - id: cpu_package
    # The controller platform as displayed by `fan2go detect`, f.ex.:
    # "nouveau", "coretemp" or "it8620" etc.
    platform: coretemp
    # The index of this sensor as displayed by `fan2go detect`.
    index: 1
    # The minimum target temp for this sensor.
    # If the sensor falls below this value, all fans referencing it
    # will run at minimum PWM value.
    min: 40
    # The maximum target temp for this sensor.
    # If the sensor is above this value, all fans referencing it
    # will run at maximum PWM value.
    max: 75

  - id: mainboard
    platform: nct6775
    index: 3
    min: 40
    max: 60


# A list of fans to control.
fans:
  # An user defined ID.
  # Used for logging only.
  - id: cpu_cooler
    # The platform of the controller which is
    # connected to this fan (see sensor.platform above).
    platform: nct6775
    # The index of this fan as displayed by `fan2go detect`.
    fan: 2
    # Indicates whether this fan is allowed to fully stop.
    neverStop: yes
    # The sensor ID (defined above) that should be used to determine the
    # speed of this fan.
    sensor: coretemp

I cannot see where I am wrong ...

Verify that fans don't stop

Currently the fan curve data created on the initial run is used to detect the minimum PWM at which a fan is still running. This works fine in most circumstances, however, I have experienced fans that were not running at that PWM, possibly due to interference with the mainboard controls overriding the speed that was set by fan2go.

Solution

Verify the RPM value of fans at each cycle, making sure it is never 0. If the RPM is below 0, slowly increase the PWM by small increments (+1) above the value saved min PWM value to ensure that the fan is running.

Very slow startup

Describe the bug
Not sure this is a bug or not, but the behavior I am seeing is the following: at boot, the fans are at 100%, then as fan2go is started, they slowly decrease PWM down to 0%, and only then they finally go to the PWM that corresponds to the current control scheme based on temperature. This whole process takes about a minute or two. Not sure if this is intended or not; if it is intended I guess I would like to know the reasoning, if not it should probably be fixed. Note: this does not refer to the very first calibration of the fans, but happens every time at boot when fan2go is started.

To Reproduce
Steps to reproduce the behavior:
Start fan2go.

Expected behavior
My expectation would be that the fans go directly to the PWM set by the control scheme...

Desktop (please complete the following information):

  • Distro: Gentoo
  • uname -a: Linux hyperion 5.15.41-gentoo-x86_64 SMP Mon May 23 09:59:40 CEST 2022 x86_64 AMD Ryzen Threadripper 1950X 16-Core Processor AuthenticAMD GNU/Linux
  • sensors -v: sensors version 3.6.0 with libsensors version 3.6.0
  • fan2go version: 0.7.0 (latest stable)

Use incremental moving average calculation

Currently sensor values are simply stored in a big buffer and the average is fully calculated each time it is needed by accessing and summing up all values in the buffer. This is unnecessarily expensive, since in this scenario the average can be calculated much more easily using this formula:
image
See Wikipedia - Moving average

Since we don't need the individual sensor values anyway, using this formula it should also be possible to remove the buffer altogether, and only store the current moving average.

It might also be interesting to see if a simple moving median is better suited, but it would require more performance and memory.

Cannot run fan2go detect

Whenever I try I get the following output. I can setup fancontrol just fine. But every reboot the hwmon paths change which causes problems.

fan2go detect
  ERROR   File reading error: open /sys/devices/platform/dell_smm_hwmon/hwmon/hwmon4/pwm1_enable: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5a878d]

goroutine 1 [running]:
github.com/markusressel/fan2go/internal.createFans(0xc000026880, 0x31, 0x31, 0x0, 0x0)
        /github/workspace/internal/backend.go:598 +0x4cd
github.com/markusressel/fan2go/internal.FindControllers(0xc000001b00, 0x8f2da0, 0xe185e0, 0x0, 0x0)
        /github/workspace/internal/backend.go:545 +0x293
github.com/markusressel/fan2go/cmd.glob..func2(0xe0b280, 0xe35450, 0x0, 0x0)
        /github/workspace/cmd/root.go:56 +0xe4
github.com/spf13/cobra.(*Command).execute(0xe0b280, 0xe35450, 0x0, 0x0, 0xe0b280, 0xe35450)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xe0b000, 0xe3524f, 0x9cc8fe, 0x7)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x35a
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/markusressel/fan2go/cmd.Execute()
        /github/workspace/cmd/root.go:248 +0x382
main.main()
        /github/workspace/main.go:25 +0x20

Allow N/A values without error/crash

Hello and thank you for creating this software.

I am getting an error when running fan2go detect, any suggestions on the possible problem?

I am attaching the output of lm_sensors followed by that of detect

ucsi_source_psy_USBC000:001-isa-0000
Adapter: ISA adapter
in0:           0.00 V  (min =  +0.00 V, max =  +0.00 V)
curr1:         0.00 A  (max =  +0.00 A)

iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:        +33.0°C  

thinkpad-isa-0000
Adapter: ISA adapter
fan1:           0 RPM
fan2:           0 RPM
CPU:          +36.0°C  
GPU:              N/A  
temp3:         +0.0°C  
temp4:         +0.0°C  
temp5:         +0.0°C  
temp6:         +0.0°C  
temp7:         +0.0°C  
temp8:            N/A  

nvme-pci-0400
Adapter: PCI adapter
Composite:    +31.9°C  (low  =  -0.1°C, high = +79.8°C)
                       (crit = +81.8°C)
Sensor 1:     +30.9°C  (low  = -273.1°C, high = +65261.8°C)

ucsi_source_psy_USBC000:002-isa-0000
Adapter: ISA adapter
in0:           0.00 V  (min =  +0.00 V, max =  +0.00 V)
curr1:         0.00 A  (max =  +0.00 A)

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +36.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +34.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:        +35.0°C  (high = +100.0°C, crit = +100.0°C)
Core 2:        +32.0°C  (high = +100.0°C, crit = +100.0°C)
Core 3:        +32.0°C  (high = +100.0°C, crit = +100.0°C)

BAT0-acpi-0
Adapter: ACPI interface
in0:          15.62 V  

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +36.0°C  (crit = +128.0°C)

Output of the detect command:

Detected Devices:
acpitz
  1: hwmon1 (temp1_input): 35000
nvme
  1: Composite (temp1_input): 32850
  2: Sensor 1 (temp2_input): 31850
thinkpad
  1: hwmon4 (pwm1): RPM: 0 PWM: 255 Auto: false
  1: CPU (temp1_input): 35000
  ERROR   File reading error: read /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp2_input: no such device or address
  2: GPU (temp2_input): -1
  3: hwmon4 (temp3_input): 0
  4: hwmon4 (temp4_input): 0
  5: hwmon4 (temp5_input): 0
  6: hwmon4 (temp6_input): 0
  7: hwmon4 (temp7_input): 0
  ERROR   File reading error: read /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp8_input: no such device or address
  8: hwmon4 (temp8_input): -1
coretemp
  1: Package id 0 (temp1_input): 34000
  2: Core 0 (temp2_input): 33000
  3: Core 1 (temp3_input): 33000
  4: Core 2 (temp4_input): 31000
  5: Core 3 (temp5_input): 31000
iwlwifi_1
  1: hwmon6 (temp1_input): 32000 

Also, please notice the problem with the the repeated index=1 under the thinkpad platform

> Not sure why you would want to have an external software (fan2go) control your fans if you also have a big (and probably expensive) hardware controller in your system to do the same thing

Not sure why you would want to have an external software (fan2go) control your fans if you also have a big (and probably expensive) hardware controller in your system to do the same thing

In my situation I’m watercooling and the hardware controller allows me to attach multiple sensors and devices (fans, pumps, a flow indicator) that I do not have enough headers for fine grained control on my itx board.

What fan2go gives me in this situation is the ability to combine multiple sensors for use in controlling the fans. I want to base my fan curve on the delta between water temp and ambient temp of the room. It’s pure vanity to want this but Fan2go is the best chance I have at getting this*.

As for the warning when it appears it floods out any other message. Especially when running four fans because that means it appears four times at each adjustment interval. I’d rather not flood the logs especially since it means a quick tail command to find a problem from within five minutes ago would involve tailing the last ~1200 log entries and hoping I can grep the right one.

As always thank you for your patience.

* pull request incoming 😉

Originally posted by @elais in #64 (comment)

ERROR: Unable to set Fan Mode

Describe the bug
A clear and concise description of what the bug is:

sudo fan2go
███████  █████  ███    ██ ██████   ██████   ██████  
██      ██   ██ ████   ██      ██ ██       ██    ██ 
█████   ███████ ██ ██  ██  █████  ██   ███ ██    ██ 
██      ██   ██ ██  ██ ██ ██      ██    ██ ██    ██ 
██      ██   ██ ██   ████ ███████  ██████   ██████  

 INFO  Using configuration file at: /etc/fan2go/fan2go.yaml
 WARNING  Cannot read pwm_enable value of in_front
 INFO  Gathering sensor data for in_front...
 WARNING  Cannot read pwm_enable value of cpu_pump
 WARNING  Cannot read pwm_enable value of out_rad1
 WARNING  Cannot read pwm_enable value of out_rad3
 INFO  Gathering sensor data for out_rad1...
 INFO  Gathering sensor data for out_rad3...
 INFO  Gathering sensor data for cpu_pump...
 WARNING  Cannot read pwm_enable value of in_bottom
 INFO  Gathering sensor data for in_bottom...
 WARNING  Cannot read pwm_enable value of out_rad2
 INFO  Gathering sensor data for out_rad2...
 WARNING  Cannot read pwm_enable value of in_back
 INFO  Gathering sensor data for in_back...
 INFO  Loading fan curve data for fan 'out_rad2'...
 INFO  Loading fan curve data for fan 'in_back'...
 INFO  Loading fan curve data for fan 'in_bottom'...
 INFO  Loading fan curve data for fan 'in_front'...
 INFO  Loading fan curve data for fan 'out_rad1'...
 INFO  Loading fan curve data for fan 'out_rad3'...
 INFO  Loading fan curve data for fan 'cpu_pump'...
  ERROR   Unable to set Fan Mode of 'out_rad2' to "1": open /sys/class/hwmon/hwmon3//pwm4_enable: permission denied
  ERROR   Unable to set Fan Mode of 'out_rad2' to "0": open /sys/class/hwmon/hwmon3//pwm4_enable: permission denied
  ERROR   Unable to set Fan Mode of 'out_rad1' to "1": open /sys/class/hwmon/hwmon3//pwm3_enable: permission denied
  ERROR   Unable to set Fan Mode of 'out_rad1' to "0": open /sys/class/hwmon/hwmon3//pwm3_enable: permission denied
  ERROR   Unable to set Fan Mode of 'in_front' to "1": open /sys/class/hwmon/hwmon3//pwm8_enable: permission denied
  ERROR   Unable to set Fan Mode of 'in_front' to "0": open /sys/class/hwmon/hwmon3//pwm8_enable: permission denied
  ERROR   Unable to set Fan Mode of 'out_rad3' to "1": open /sys/class/hwmon/hwmon3//pwm5_enable: permission denied
  ERROR   Unable to set Fan Mode of 'out_rad3' to "0": open /sys/class/hwmon/hwmon3//pwm5_enable: permission denied
  ERROR   Unable to set Fan Mode of 'in_bottom' to "1": open /sys/class/hwmon/hwmon3//pwm6_enable: permission denied
  ERROR   Unable to set Fan Mode of 'in_bottom' to "0": open /sys/class/hwmon/hwmon3//pwm6_enable: permission denied
  ERROR   Unable to set Fan Mode of 'cpu_pump' to "1": open /sys/class/hwmon/hwmon3//pwm2_enable: permission denied
  ERROR   Unable to set Fan Mode of 'cpu_pump' to "0": open /sys/class/hwmon/hwmon3//pwm2_enable: permission denied
  ERROR   Unable to set Fan Mode of 'in_back' to "1": open /sys/class/hwmon/hwmon3//pwm7_enable: permission denied
  ERROR   Unable to set Fan Mode of 'in_back' to "0": open /sys/class/hwmon/hwmon3//pwm7_enable: permission denied

To Reproduce
Steps to reproduce the behavior:

git clone https://github.com/markusressel/fan2go.git
cd fan2go
make build
sudo cp ./bin/fan2go /usr/bin/fan2go
sudo chmod ug+x /usr/bin/fan2go

Desktop:

  • Distro: lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye
  • uname -a: Linux debian-desktop-pc 5.16.0-0.bpo.4-amd64 #1 SMP PREEMPT Debian 5.16.12-1~bpo11+1 (2022-03-08) x86_64 GNU/Linux
  • sensors -v: sensors version 3.6.0 with libsensors version 3.6.0
  • fan2go version: 0.6.2

Additional info:

*truncated* **click to view**

l /sys/class/hwmon/hwmon3/
total 0
lrwxrwxrwx 1 root root    0 May 12 09:37 device -> ../../../nct6687.2592/
-r--r--r-- 1 root root 4.0K May 12 09:37 fan1_input
-r--r--r-- 1 root root 4.0K May 12 09:37 fan1_label
-r--r--r-- 1 root root 4.0K May 12 09:37 fan1_max
-r--r--r-- 1 root root 4.0K May 12 09:37 fan1_min
-r--r--r-- 1 root root 4.0K May 12 09:37 fan2_input
-r--r--r-- 1 root root 4.0K May 12 09:37 fan2_label
-r--r--r-- 1 root root 4.0K May 12 09:37 fan2_max
-r--r--r-- 1 root root 4.0K May 12 09:37 fan2_min
-r--r--r-- 1 root root 4.0K May 12 09:37 fan3_input
-r--r--r-- 1 root root 4.0K May 12 09:37 fan3_label
-r--r--r-- 1 root root 4.0K May 12 09:37 fan3_max
-r--r--r-- 1 root root 4.0K May 12 09:37 fan3_min
-r--r--r-- 1 root root 4.0K May 12 09:37 fan4_input
-r--r--r-- 1 root root 4.0K May 12 09:37 fan4_label
-r--r--r-- 1 root root 4.0K May 12 09:37 fan4_max
-r--r--r-- 1 root root 4.0K May 12 09:37 fan4_min
-r--r--r-- 1 root root 4.0K May 12 09:37 fan5_input
-r--r--r-- 1 root root 4.0K May 12 09:37 fan5_label
-r--r--r-- 1 root root 4.0K May 12 09:37 fan5_max
-r--r--r-- 1 root root 4.0K May 12 09:37 fan5_min
-r--r--r-- 1 root root 4.0K May 12 09:37 fan6_input
-r--r--r-- 1 root root 4.0K May 12 09:37 fan6_label
-r--r--r-- 1 root root 4.0K May 12 09:37 fan6_max
-r--r--r-- 1 root root 4.0K May 12 09:37 fan6_min
-r--r--r-- 1 root root 4.0K May 12 09:37 fan7_input
-r--r--r-- 1 root root 4.0K May 12 09:37 fan7_label
-r--r--r-- 1 root root 4.0K May 12 09:37 fan7_max
-r--r--r-- 1 root root 4.0K May 12 09:37 fan7_min
-r--r--r-- 1 root root 4.0K May 12 09:37 fan8_input
-r--r--r-- 1 root root 4.0K May 12 09:37 fan8_label
-r--r--r-- 1 root root 4.0K May 12 09:37 fan8_max
-r--r--r-- 1 root root 4.0K May 12 09:37 fan8_min
-r--r--r-- 1 root root 4.0K May 12 09:37 in0_input
-r--r--r-- 1 root root 4.0K May 12 09:37 in0_label
-r--r--r-- 1 root root 4.0K May 12 09:37 in0_max
-r--r--r-- 1 root root 4.0K May 12 09:37 in0_min
-r--r--r-- 1 root root 4.0K May 12 09:37 in1_input
-r--r--r-- 1 root root 4.0K May 12 09:37 in1_label
-r--r--r-- 1 root root 4.0K May 12 09:37 in1_max
-r--r--r-- 1 root root 4.0K May 12 09:37 in1_min
-r--r--r-- 1 root root 4.0K May 12 09:37 in2_input
-r--r--r-- 1 root root 4.0K May 12 09:37 in2_label
-r--r--r-- 1 root root 4.0K May 12 09:37 in2_max
-r--r--r-- 1 root root 4.0K May 12 09:37 in2_min
-r--r--r-- 1 root root 4.0K May 12 09:37 in3_input
-r--r--r-- 1 root root 4.0K May 12 09:37 in3_label
-r--r--r-- 1 root root 4.0K May 12 09:37 in3_max
-r--r--r-- 1 root root 4.0K May 12 09:37 in3_min
-r--r--r-- 1 root root 4.0K May 12 09:37 in4_input
-r--r--r-- 1 root root 4.0K May 12 09:37 in4_label
-r--r--r-- 1 root root 4.0K May 12 09:37 in4_max
-r--r--r-- 1 root root 4.0K May 12 09:37 in4_min
-r--r--r-- 1 root root 4.0K May 12 09:37 in5_input
-r--r--r-- 1 root root 4.0K May 12 09:37 in5_label
-r--r--r-- 1 root root 4.0K May 12 09:37 in5_max
-r--r--r-- 1 root root 4.0K May 12 09:37 in5_min
-r--r--r-- 1 root root 4.0K May 12 09:37 in6_input
-r--r--r-- 1 root root 4.0K May 12 09:37 in6_label
-r--r--r-- 1 root root 4.0K May 12 09:37 in6_max
-r--r--r-- 1 root root 4.0K May 12 09:37 in6_min
-r--r--r-- 1 root root 4.0K May 12 09:37 in7_input
-r--r--r-- 1 root root 4.0K May 12 09:37 in7_label
-r--r--r-- 1 root root 4.0K May 12 09:37 in7_max
-r--r--r-- 1 root root 4.0K May 12 09:37 in7_min
-r--r--r-- 1 root root 4.0K May 12 09:37 in8_input
-r--r--r-- 1 root root 4.0K May 12 09:37 in8_label
-r--r--r-- 1 root root 4.0K May 12 09:37 in8_max
-r--r--r-- 1 root root 4.0K May 12 09:37 in8_min
-r--r--r-- 1 root root 4.0K May 12 09:37 name
drwxr-xr-x 2 root root    0 May 12 09:56 power/
-rw-r--r-- 1 root root 4.0K May 12 09:56 pwm1
-rw-r--r-- 1 root root 4.0K May 13 09:47 pwm2
-rw-r--r-- 1 root root 4.0K May 13 09:47 pwm3
-rw-r--r-- 1 root root 4.0K May 13 09:47 pwm4
-rw-r--r-- 1 root root 4.0K May 13 09:47 pwm5
-rw-r--r-- 1 root root 4.0K May 13 09:47 pwm6
-rw-r--r-- 1 root root 4.0K May 13 09:47 pwm7
-rw-r--r-- 1 root root 4.0K May 13 09:47 pwm8
lrwxrwxrwx 1 root root    0 May 12 09:37 subsystem -> ../../../../../class/hwmon/
-r--r--r-- 1 root root 4.0K May 12 09:37 temp1_input
-r--r--r-- 1 root root 4.0K May 12 09:37 temp1_label
-r--r--r-- 1 root root 4.0K May 12 09:37 temp1_max
-r--r--r-- 1 root root 4.0K May 12 09:37 temp1_min
-r--r--r-- 1 root root 4.0K May 12 09:37 temp2_input
-r--r--r-- 1 root root 4.0K May 12 09:37 temp2_label
-r--r--r-- 1 root root 4.0K May 12 09:37 temp2_max
-r--r--r-- 1 root root 4.0K May 12 09:37 temp2_min
-r--r--r-- 1 root root 4.0K May 12 09:37 temp3_input
-r--r--r-- 1 root root 4.0K May 12 09:37 temp3_label
-r--r--r-- 1 root root 4.0K May 12 09:37 temp3_max
-r--r--r-- 1 root root 4.0K May 12 09:37 temp3_min
-r--r--r-- 1 root root 4.0K May 12 09:37 temp4_input
-r--r--r-- 1 root root 4.0K May 12 09:37 temp4_label
-r--r--r-- 1 root root 4.0K May 12 09:37 temp4_max
-r--r--r-- 1 root root 4.0K May 12 09:37 temp4_min
-r--r--r-- 1 root root 4.0K May 12 09:37 temp5_input
-r--r--r-- 1 root root 4.0K May 12 09:37 temp5_label
-r--r--r-- 1 root root 4.0K May 12 09:37 temp5_max
-r--r--r-- 1 root root 4.0K May 12 09:37 temp5_min
-r--r--r-- 1 root root 4.0K May 12 09:37 temp6_input
-r--r--r-- 1 root root 4.0K May 12 09:37 temp6_label
-r--r--r-- 1 root root 4.0K May 12 09:37 temp6_max
-r--r--r-- 1 root root 4.0K May 12 09:37 temp6_min
-r--r--r-- 1 root root 4.0K May 12 09:37 temp7_input
-r--r--r-- 1 root root 4.0K May 12 09:37 temp7_label
-r--r--r-- 1 root root 4.0K May 12 09:37 temp7_max
-r--r--r-- 1 root root 4.0K May 12 09:37 temp7_min
-rw-r--r-- 1 root root 4.0K May 12 09:37 uevent

Make an AUR package?

Hi,

after struggling setting up fans on new Thinkpad T14 Gen to with a new (and newbie) Arch installation (hwmon index changing on reboot for thinkfan as well as fancontrol), I am very happy to have found fan2go!

Could you continue using your skills to make an AUR package and proposing it to the Arch Wiki?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.