liquidctl / liquidctl

Cross-platform CLI and Python drivers for AIO liquid coolers and other devices
GNU General Public License v3.0
2.24k stars 225 forks source link

Strange behavior running "status" as regular user #37

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hi, I'm loving the fact that this is Python based (my favorite programming language).

My AIO: Corsair H115i Detected correctly as well:

sudo liquidctl list
Device 0, Corsair Hydro H115i (experimental)

More of a strange bug or strange behavior: when using liquidctl status as normal user, you get the readout/status just fine (might be because of my changes to udev so the aio would be accessible in userspace). But, the fan revs up to max. As soon as I run the same command with sudo, the fan revs back down again.

Also:

liquidctl set fan speed  20 30  30 50  34 80  40 90  50 100
NotImplementedError
jonasmalacofilho commented 5 years ago

Hi!

More of a strange bug or strange behavior: when using liquidctl status as normal user, you get the readout/status just fine. [...] But, the fan revs up to max. As soon as I run the same command with sudo, the fan revs back down again.

This is most likely an issue related to how we work around a limitation of these older Asetek devices: they require sending some sort of configuration change just to read the current status, so we have to store those values somewhere.

My first guesses were either a permission issue or that I had set the path differently for root and regular users, but reviewing the code it doesn't seem that either case fits.

Still, since you haven't reported getting an error message, and the fans are maxing out, I still think the problem is liquidctl not finding the data for the fan speed configuration and thus defaulting to 100%.

Could you post the outputs of both invocations (root and regular user) but with the addition of the --debug flag?


$ liquidctl set fan speed  20 30  30 50  34 80  40 90  50 100
NotImplementedError

I haven't enabled the configuration of fan profiles on the "legacy" Asetek 690LC devices, because it further complicates the quirk I mentioned above (possible ordering issues). In fact, enabling this could be particularly tricky with old Krakens, as mentioned in #35 ("Some Kraken X61 functionality still missing").

But I'm taking a second look at this with more focus on the Corsair coolers, which "quirk-wise" could sit somewhere in between the old Krakens and the new EVGA units. I'll let you know if I come up with anything.

ghost commented 5 years ago

liquidctl_sudo.log liquidctl_userspace.log

Also, here is my UDEV rule for the AIO's USB ctrl:

ACTION=="add", SUBSYSTEMS=="hidraw*", ATTRS{idVendor}=="1b1c", ATTRS{idProduct}=="0c0a", TAG+="uaccess"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b1c", ATTRS{idProduct}=="0c0a", TAG+="uaccess"
#ACTION=="add", SUBSYSTEM=="hidraw", KERNELS=="0005:054C:03D5.*", TAG+="uaccess"
ghost commented 5 years ago

Thanks :)

ghost commented 5 years ago

Btw, it might be a good idea to add to the default output when you don't have any args that to get the full options etc list, you need to use --help

ghost commented 5 years ago

I almost posted a bug post on it after finding the full list in the cli.py file and not testing the --help option first.

jonasmalacofilho commented 5 years ago

liquidctl_sudo.log liquidctl_userspace.log

You forgot to add the --debug flag during the run without sudo.

Can you also check if regular users can read the files in /usr/local/share/liquidctl/1b1c_0c0a_0100/usb1_9/?

Also, here is my UDEV rule for the AIO's USB ctrl:

Thanks! I was going to ask for that too but forgot, so I'm glad that you remembered.


Btw, it might be a good idea to add to the default output when you don't have any args that to get the full options etc list, you need to use --help. I almost posted a bug post on it after finding the full list in the cli.py file and not testing the --help option first.

If you can help me with this and other documentation issues (e.g. new docs for the Corsair devices; converting the issue comments for the EVGA CLCs and old Krakens into proper /docs/*.md files) I would very much appreciate it.

jonasmalacofilho commented 5 years ago

Can you give commit 3f004ee3b68bba4b72de947b021bedf2bd320695 ("Add support for setting fan profiles on all legacy 690LC devices") a try?

Since it's a first attempt I imagine there might be some issues left.¹ Hopefully you'll be able to easily fix them or, least, figure out more about what's going on with the --debug flag.

Besides an obvious failure, I would also like to ask you to check for more subtle issues:

In case anything goes bad, reverting to 'master' and re-initializing the device should clear most problems. As a last resort, power cycling it should completely reset it.

¹ You should know I don't have access to these exact devices, so I'm testing this on a similar (but only to a point) cooler.

ghost commented 5 years ago

okay, before doing a pull, here is the missing userspace status with --debug liquidctl_userspace-2.log

ghost commented 5 years ago

after a pull:

source@megumi:liquidctl$ ls -l /usr/local/share/liquidctl/1b1c_0c0a_0100/usb1_9/
total 8
-rw-r--r-- 1 root root 2 sep.  11 07:55 fan_duty
-rw-r--r-- 1 root root 3 sep.   5 21:04 pump_duty
source@megumi:liquidctl$ ls -l /usr/local/share/liquidctl/1b1c_0c0a_0100/
total 4
drwxr-xr-x 2 root root 4096 sep.   3 10:22 usb1_9

There might be something in this, when I look at the output from --debug, it's stating [DEBUG] liquidctl.driver.asetek: data directory for device is /usr/local/share/liquidctl/1b1c_0c0a_0100/usb1_9 as root and [DEBUG] liquidctl.driver.asetek: data directory for device is /usr/share/gnome/liquidctl/1b1c_0c0a_0100/usb1_9 as normal user.

/usr/share/gnome/liquidctl/ does not exist (/usr/share/gnome/ does)

user can read /usr/local/share/liquidctl/1b1c_0c0a_0100/usb1_9/*_duty just fine (at least with cat).

Is the path mismatch the reason the fans go ballistic in userspace ? :D

jonasmalacofilho commented 5 years ago

Is the path mismatch the reason the fans go ballistic in userspace ? :D

Yeap! I just pushed a change to the master branch that should solve this (though you'll need to reconfigure the device).

Another thing: did you get a chance to test the fan profiles from the commit I mentioned before?

Can you give commit 3f004ee ("Add support for setting fan profiles on all legacy 690LC devices") a try?


P.S. Programs running as root are still running in user space. The only things not running in user space are the kernel and its loaded modules.

ghost commented 5 years ago
source@megumi:~$ sudo liquidctl set fan speed  20 30  30 50  34 80  40 90  50 100
NotImplementedError
source@megumi:~$ sudo liquidctl --legacy-690lc set fan speed  20 30  30 50  34 80  40 90  50 100
NotImplementedError
source@megumi:~$ sudo liquidctl --legacy-690lc --device 0 set fan speed  20 30  30 50  34 80  40 90  50 100
NotImplementedError
jonasmalacofilho commented 5 years ago

I don't understand what's going on:

Just as sanity check, can I ask you to confirm that liquidctl is pointing to the correct place (maybe you have multiple installations?) and version (3f004ee)?

If the mystery persists, can you show the output with --debug?

ghost commented 5 years ago

Okay, sorry, I was not on that commit, I am now. there is no error, but the fan will not change its speed at all.

ghost commented 5 years ago
source@megumi:~$ liquidctl --version
liquidctl v1.2.0rc2.dev0
source@megumi:~$ liquidctl status
Device 0, Corsair Hydro H115i (experimental)
Liquid temperature          29.4  °C 
Fan speed                    720  rpm
Pump speed                  3090  rpm
Firmware version         2.8.0.0     

source@megumi:~$ sudo liquidctl --legacy-690lc --device 0 set fan speed  20 30  30 50  34 80  40 90  50 100
[sudo] password for source: 
source@megumi:~$ sudo liquidctl --legacy-690lc --device 0 set fan speed  50^C0  30 50  34 80  55 90  50 100
source@megumi:~$ sudo liquidctl --legacy-690lc --device 0 set fan speed  20 50  30 55  34 80  40 90  50 100
source@megumi:~$ liquidctl status
Device 0, Corsair Hydro H115i (experimental)
Liquid temperature          29.4  °C 
Fan speed                    720  rpm
Pump speed                  3060  rpm
Firmware version         2.8.0.0     

source@megumi:~$ sudo liquidctl --legacy-690lc --device 0 set fan speed  20 100  30 100  34 100  40 90  50 100
source@megumi:~$ sudo liquidctl --device 0 set fan speed  20 100  30 100  34 100  40 90  50 100
source@megumi:~$ liquidctl status
Device 0, Corsair Hydro H115i (experimental)
Liquid temperature          29.4  °C 
Fan speed                    720  rpm
Pump speed                  3030  rpm
Firmware version         2.8.0.0     

source@megumi:~$ sudo liquidctl --device 0 set fan speed  50 50  30 100  34 100  40 90  50 100
source@megumi:~$ liquidctl status
Device 0, Corsair Hydro H115i (experimental)
Liquid temperature          29.3  °C 
Fan speed                    660  rpm
Pump speed                  3090  rpm
Firmware version         2.8.0.0     

source@megumi:~$ sudo liquidctl --device 0 set fan speed  20 50  25 55  30 60  35 65  40 70
source@megumi:~$ liquidctl status
Device 0, Corsair Hydro H115i (experimental)
Liquid temperature          29.3  °C 
Fan speed                    720  rpm
Pump speed                  3090  rpm
Firmware version         2.8.0.0     

source@megumi:~$ sudo liquidctl --device 0 set fan speed  100
source@megumi:~$ sudo liquidctl --legacy-690lc --device 0 set fan speed 100
source@megumi:~$ liquidctl status
Device 0, Corsair Hydro H115i (experimental)
Liquid temperature          29.3  °C 
Fan speed                    720  rpm
Pump speed                  3000  rpm
Firmware version         2.8.0.0     
ghost commented 5 years ago

sorry, forgot the --debug output:

sudo liquidctl --legacy-690lc --device 0 set fan speed 100 --debug
[DEBUG] liquidctl.driver.asetek: data directory for device is /usr/local/share/liquidctl/1b1c_0c0a_0100/usb1_9
[DEBUG] liquidctl.driver.asetek: open device
[INFO] liquidctl.driver.asetek: using a flat profile to set fan to a fixed duty
[INFO] liquidctl.driver.asetek: filling missing 4 PWM points with (60°C, 100%)
[DEBUG] liquidctl.driver.asetek: stored fan_temp0=0
[DEBUG] liquidctl.driver.asetek: stored fan_duty0=100
[DEBUG] liquidctl.driver.asetek: stored fan_temp1=59
[DEBUG] liquidctl.driver.asetek: stored fan_duty1=100
[DEBUG] liquidctl.driver.asetek: stored fan_temp2=60
[DEBUG] liquidctl.driver.asetek: stored fan_duty2=100
[DEBUG] liquidctl.driver.asetek: stored fan_temp3=60
[DEBUG] liquidctl.driver.asetek: stored fan_duty3=100
[DEBUG] liquidctl.driver.asetek: stored fan_temp4=60
[DEBUG] liquidctl.driver.asetek: stored fan_duty4=100
[DEBUG] liquidctl.driver.asetek: stored fan_temp5=60
[DEBUG] liquidctl.driver.asetek: stored fan_duty5=100
[DEBUG] liquidctl.driver.asetek: begin transaction
[DEBUG] liquidctl.driver.asetek: loaded fan_temp0=0 (from cache)
[DEBUG] liquidctl.driver.asetek: loaded fan_duty0=100 (from cache)
[INFO] liquidctl.driver.asetek: setting fan PWM point: (0°C, 100%), device interpolated
[DEBUG] liquidctl.driver.asetek: loaded fan_temp1=59 (from cache)
[DEBUG] liquidctl.driver.asetek: loaded fan_duty1=100 (from cache)
[INFO] liquidctl.driver.asetek: setting fan PWM point: (59°C, 100%), device interpolated
[DEBUG] liquidctl.driver.asetek: loaded fan_temp2=60 (from cache)
[DEBUG] liquidctl.driver.asetek: loaded fan_duty2=100 (from cache)
[INFO] liquidctl.driver.asetek: setting fan PWM point: (60°C, 100%), device interpolated
[DEBUG] liquidctl.driver.asetek: loaded fan_temp3=60 (from cache)
[DEBUG] liquidctl.driver.asetek: loaded fan_duty3=100 (from cache)
[INFO] liquidctl.driver.asetek: setting fan PWM point: (60°C, 100%), device interpolated
[DEBUG] liquidctl.driver.asetek: loaded fan_temp4=60 (from cache)
[DEBUG] liquidctl.driver.asetek: loaded fan_duty4=100 (from cache)
[INFO] liquidctl.driver.asetek: setting fan PWM point: (60°C, 100%), device interpolated
[DEBUG] liquidctl.driver.asetek: loaded fan_temp5=60 (from cache)
[DEBUG] liquidctl.driver.asetek: loaded fan_duty5=100 (from cache)
[INFO] liquidctl.driver.asetek: setting fan PWM point: (60°C, 100%), device interpolated
[DEBUG] liquidctl.driver.asetek: write 11 00 00 3b 3c 3c 3c 3c 64 64 64 64 64 64
[DEBUG] liquidctl.driver.asetek: loaded pump_duty=100
[INFO] liquidctl.driver.asetek: setting pump duty to 100%
[DEBUG] liquidctl.driver.asetek: write 13 64
[DEBUG] liquidctl.driver.asetek: received 02 94 01 2f 00 06 00 da 0c 12 1d 11 00 00 08 f9 00 22 7b 07 1c be 98 02 08 00 00 00 01 29 64 15
[DEBUG] liquidctl.driver.asetek: close device
jonasmalacofilho commented 5 years ago

Oh well, I guess the device doesn't like this approach.

Hm, I see that the firmware version is pretty recent... my EVGA CLC is only on 2.10.0.0, and I'm guessing Asetek uses a global versioning scheme for the 690LC family. You could probably give the "modern" AsetekDriver a try.

First, revert back to the latest version on 'master', and make sure fan and pump speeds are working again. For this you might need to powercycle the device (i.e. the system).

Then, edit liquidctl/driver/asetek.py, moving your device id to the AsetekDriver class. And please let me know how it goes.

ghost commented 5 years ago

My pump and correct description is already in the list: (0x1b1c, 0x0c0a, None, 'Corsair Hydro H115i (experimental)', {}), lsusb: Bus 001 Device 009: ID 1b1c:0c0a Corsair

jonasmalacofilho commented 5 years ago

Oh, did you initialize the device before testing the new code?

The command used specifically for fixed fan speeds overrules any profiles until the device is initialized again (actually I even had to powercycle it once, but maybe that was my fault).

The same will be necessary if you change your device to bind to the modern AsetekDriver, instead of CorsairAsetekDriver.


My pump and correct description is already in the list: (0x1b1c, 0x0c0a, None, 'Corsair Hydro H115i (experimental)', {}),

It's a member of CorsairAsetekDriver (which subclasses the LegacyAsetekDriver), not AsetekDriver.

ghost commented 5 years ago

dooooh...... no I didn't run init :headpalm:

ghost commented 5 years ago

yepp, that worked

ghost commented 5 years ago

btw, is there a discord server I could chat with you in ?

jonasmalacofilho commented 5 years ago

:smiley:

3f004ee or the custom edit?


btw, is there a discord server I could chat with you in ?

Sorry, I stopped using that. We could do Telegram, it that's a thing you use.