Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different hwmon required #117

Open
Gnarflord opened this issue May 21, 2024 · 1 comment
Open

Different hwmon required #117

Gnarflord opened this issue May 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Gnarflord
Copy link

I'm running fancontrol-gui via the snap package manager and thus need udev rules. The default udev rules from this github assume hwmon7 to be the correct one for PWM control:

SUBSYSTEM=="hwmon", KERNEL=="hwmon7", RUN+="/bin/sh -c '/bin/chmod a+w /sys%p/pwm*'"

My system doesn't even have a folder for hwmon7:

❯ ls /sys/class/hwmon
hwmon0	hwmon1	hwmon2	hwmon3	hwmon4

So I looked into the directories and hwmon1 had 1 PWM controllers and hwmon4 had 7 PWM controllers. These are the controllers from my graphics card (nvidia, so noveau driver) and my motherboard:

❯ /usr/bin/cat /sys/class/hwmon/hwmon1/name
nouveau

❯ /usr/bin/cat /sys/class/hwmon/hwmon4/name
nct6798

Only after adding a line for hwmon1 and hwmon4 in the udev file was I able to control my fans.

I propose two solutions:

  • Add all possible hwmon devices to the udev file

or

  • Run a script to detect which hwmon has PWM controllers and only add those to the udev file

Please note that hwmon numbers will also change upon changing hardware configuration. So after swapping out a graphics card or the motherboard all numbers will be mixed up again (which will also mess with the fancontrol config file...)

@Gnarflord Gnarflord added the bug Something isn't working label May 21, 2024
@wiiznokes
Copy link
Owner

Thanks for bringing that up. Tbh, it seemed odd to me that only hwon7 was useful.

I'm running fancontrol-gui via the snap package manager

Didn't known that was possible. Are you planning to make a snap package or it's just something personal ?

# XXX: Only hwmon7 because it failed on all other number on machine
SUBSYSTEM=="hwmon", KERNEL=="hwmon7", RUN+="/bin/sh -c '/bin/chmod a+w /sys%p/pwm*'"

As the comment say, i specified the 7 because the chmod command was runned for every KERNEL, thus causing errors. It just not nice for logs, but i guess we could wildcard the kernel number (KERNEL=="hwmon[0-99]") or just remove it, and discard any error (command || true).

Please note that hwmon numbers will also change upon changing hardware configuration. So after swapping out a graphics card or the motherboard all numbers will be mixed up again (which will also mess with the fancontrol config file...)

I don't see it as an issue, because it will not make the app crash. The config is sanitized at runtime.

We might be able to play with OWNER, GROUP, MODE and TAG+="uaccess" instead of relying on hacky chmod command (doc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants