jaksi / leviathan

Linux kernel module to control and monitor NZXT liquid coolers
GNU General Public License v2.0
89 stars 14 forks source link

X42 help #7

Closed mo3pheus closed 6 years ago

mo3pheus commented 6 years ago

Hello, I recently installed a kraken x42 cooling solution. https://www.nzxt.com/products/kraken-x42

I am trying to use this repo to control the rgb lighting for the kraken. Unfortunately, there doesn't seem to be a device directory/ file under /sys/bus/usb/drivers/kraken

The kraken works - its cooling the cpu fine, I was able to confirm correct operation using cpu temp info with sensors. But I am unable to locate any of the files that seem to control the functionality.

The following command yeilds no results - locate 'color' | grep 'kraken'

Would you be able to help in any way ? I understand that more information would be required - I would be more than happy to try things and appreciate any help.

brkalmar commented 6 years ago

Hi. As you can see in the README, Kraken x42 is not supported by this repo yet. However, you could give the development branch for the X*2 models in my fork a try. It's not yet been tested with an X42, so I would be grateful for anya testing you could perform if you're up to it. :)

Please note that it's still under active development and it may be unstable or buggy. Read the README and use it at your own risk (although it's very unlikely that it would mess up your computer or your cooler; in the worst case, if it crashes, you only need to restart your computer). Also note that the driver interface is not stable yet and I plan to make changes to it in the future.

The current most recent commit is quite stable so you should use that. Note that you need to install the kraken_x62 driver, not the kraken one; i.e. you need to run

make && sudo insmod kraken_x62.ko

and the driver device directory should be present in /sys/bus/usb/drivers/kraken_x62/.

It would be very helpful to determine if the driver works with your cooler, so I would be grateful if you could check the kernel log (for more detailed info, see the troubleshooting section in the README):

sudo dmesg

and see if you can find two lines similar to

kraken_x62 1-7:1.0: device connected

and

usbcore: registered new interface driver kraken_x62

near the bottom of the logs. Then please copy all lines after and including these, as well as the contents of the /sys/bus/usb/drivers/kraken_x62/ directory.

mo3pheus commented 6 years ago

Hi, thanks for the response, I will definitely try the steps you mention above and report back on this thread.

Thanks.

mo3pheus commented 6 years ago

ok gave it a shot here is the progress so far:

1) Cloned the repository and pulled up to tips for the kraken_x62 branch. After make and install I see the following in /sys/bus/usb/drivers/kraken_x62/ ls -la Output :: total 0 drwxr-xr-x 2 root root 0 Jun 11 20:04 . drwxr-xr-x 12 root root 0 Jun 11 19:52 .. --w------- 1 root root 4096 Jun 11 20:10 bind lrwxrwxrwx 1 root root 0 Jun 11 20:10 module -> ../../../../module/kraken_x62 -rw-r--r-- 1 root root 4096 Jun 11 20:10 new_id -rw-r--r-- 1 root root 4096 Jun 11 20:10 remove_id --w------- 1 root root 4096 Jun 11 20:10 uevent --w------- 1 root root 4096 Jun 11 20:10 unbind

2) sudo dmseg gives following result. Output: sudo: dmseg: command not found

Is this something specific to the flavor of linux ? I thought maybe it doesn't exist for Ubuntu - I know this is used to write messages to the linux kernel. But wanted to ask here first.

3) Tried usage instructions but not sure what the following is supposed to point to : /sys/bus/usb/drivers/$DRIVER/$DEVICE/$ATTRIBUTE

I can't see anything under kraken_x62 that looks like a device.

Please let me know if you need more information or if I am doing something wrong. Thank you.

brkalmar commented 6 years ago

The command is dmesg not dmseg. It's used to retreive the kernel logs :).

mo3pheus commented 6 years ago

Hi - I have the dmesg | grep 'kraken' [ 731.434821] usbcore: registered new interface driver kraken_x62

But no device connected statement. My razer keyboard and mouse show up. But no kraken_x62. I have a gigabyte gaz170n-wifi - you can see it here - https://www.gigabyte.com/us/Motherboard/GA-Z170N-WIFI-rev-20#ov

I have the kraken connected to the usb 2.0 port on the motherboard which you can see on the top right corner of the motherboard. motherboard Connection is circled in red.

20160718134811_src

brkalmar commented 6 years ago

First, if you think the device might not be properly connected to the motherboard, you can run lsusb and look for a line containing NZXT. It should look like this:

Bus xxx Device yyy: ID 1e71:170e NZXT 

If that's all in order, the issue is probably that another kernel module is already connected to the cooler and the driver cannot connect to it. Try running the following and post the output here:

sudo dmesg | grep -F 'NZXT'

The output from this should indicate which kernel module is the culprit; you need to (after making sure kraken_x62 is not currently loaded) temporarily unload this module, load the kraken_x62 module, and reload this module again.

For example if the above command outputs something similar to:

hid-generic 0003:1E71:170E.0002: [...]

then the culprit is probably module usbhid, and you can run

sudo modprobe -r usbhid && sudo insmod kraken_x62.ko && sudo modprobe usbhid

in order to load kraken_x62 in such a way that it can connect to your cooler.

mo3pheus commented 6 years ago

lsusb Output:: Bus 002 Device 002: ID 0bc2:231a Seagate RSS LLC Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 006: ID 1e71:170e NZXT Bus 001 Device 005: ID 8087:0a2b Intel Corp. Bus 001 Device 004: ID 046d:0825 Logitech, Inc. Webcam C270 Bus 001 Device 003: ID 1532:0043 Razer USA, Ltd Bus 001 Device 002: ID 1532:0216 Razer USA, Ltd Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

mo3pheus commented 6 years ago

sudo dmesg | grep -F 'NZXT' [sudo] password for sanket: [ 2.741045] usb 1-9: Product: NZXT USB Device [ 2.741046] usb 1-9: Manufacturer: NZXT.-Inc. [ 2.741983] hid-generic 0003:1E71:170E.0007: hiddev0,hidraw6: USB HID v1.10 Device [NZXT.-Inc. NZXT USB Device] on usb-0000:00:14.0-9/input0

mo3pheus commented 6 years ago

so looks like my kraken is connected correctly. Would love further feedback to make progress.

brkalmar commented 6 years ago

Alright, it seems from the logs that it's the usbhid module which is connected to the cooler and that's why kraken_x62 cannot connect to it.

So, first make sure that kraken_x62 is not loaded:

sudo rmmod kraken_x62

and then, while in the repo directory, run:

sudo modprobe -r usbhid && sudo insmod kraken_x62.ko && sudo modprobe usbhid

And then check the /sys/bus/usb/drivers/kraken_x62/ directory.

mo3pheus commented 6 years ago

ok followed the steps - here is the output from sudo dmesg

[178009.972879] kraken_x62 1-9:1.0: device connected [178009.972929] usbcore: registered new interface driver kraken_x62 [178009.981312] input: Razer Razer BlackWidow X Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/0003:1532:0216.0008/input/input29 [178010.040840] hid-generic 0003:1532:0216.0008: input,hidraw0: USB HID v1.11 Keyboard [Razer Razer BlackWidow X Chroma] on usb-0000:00:14.0-3/input0 [178010.041819] input: Razer Razer BlackWidow X Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1/0003:1532:0216.0009/input/input30 [178010.156920] input: Razer Razer BlackWidow X Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/0003:1532:0216.0008/input/input31 [178010.213010] hid-generic 0003:1532:0216.0009: input,hidraw0: USB HID v1.11 Keyboard [Razer Razer BlackWidow X Chroma] on usb-0000:00:14.0-3/input1 [178010.214023] input: Razer Razer BlackWidow X Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2/0003:1532:0216.000A/input/input32 [178010.273372] razerkbd 0003:1532:0216.0008: input,hidraw1: USB HID v1.11 Keyboard [Razer Razer BlackWidow X Chroma] on usb-0000:00:14.0-3/input0 [178010.337084] hid-generic 0003:1532:0216.000A: input,hidraw0: USB HID v1.11 Mouse [Razer Razer BlackWidow X Chroma] on usb-0000:00:14.0-3/input2 [178010.338828] input: Razer Razer DeathAdder Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:1532:0043.000B/input/input33 [178010.341229] input: Razer Razer BlackWidow X Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.1/0003:1532:0216.0009/input/input34 [178010.416756] hid-generic 0003:1532:0043.000B: input,hidraw0: USB HID v1.11 Mouse [Razer Razer DeathAdder Chroma] on usb-0000:00:14.0-4/input0 [178010.418799] input: Razer Razer DeathAdder Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/0003:1532:0043.000C/input/input35 [178010.421079] input: Razer Razer BlackWidow X Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2/0003:1532:0216.000A/input/input36 [178010.480857] razerkbd 0003:1532:0216.0009: input,hidraw2: USB HID v1.11 Keyboard [Razer Razer BlackWidow X Chroma] on usb-0000:00:14.0-3/input1 [178010.540866] hid-generic 0003:1532:0043.000C: input,hidraw3: USB HID v1.11 Keyboard [Razer Razer DeathAdder Chroma] on usb-0000:00:14.0-4/input1 [178010.542222] input: Razer Razer DeathAdder Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.2/0003:1532:0043.000D/input/input37 [178010.601286] razerkbd 0003:1532:0216.000A: input,hidraw4: USB HID v1.11 Mouse [Razer Razer BlackWidow X Chroma] on usb-0000:00:14.0-3/input2 [178010.688623] input: Razer Razer DeathAdder Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:1532:0043.000B/input/input38 [178010.787381] input: Razer Razer DeathAdder Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/0003:1532:0043.000C/input/input39 [178010.844546] hid-generic 0003:1532:0043.000D: input,hidraw0: USB HID v1.11 Keyboard [Razer Razer DeathAdder Chroma] on usb-0000:00:14.0-4/input2 [178010.844572] usbcore: registered new interface driver usbhid [178010.844572] usbhid: USB HID core driver [178010.904583] razermouse 0003:1532:0043.000B: input,hidraw3: USB HID v1.11 Mouse [Razer Razer DeathAdder Chroma] on usb-0000:00:14.0-4/input0 [178010.964678] razermouse 0003:1532:0043.000C: input,hidraw5: USB HID v1.11 Keyboard [Razer Razer DeathAdder Chroma] on usb-0000:00:14.0-4/input1 [178010.973818] usb 1-9: received invalid status message: 04 1a 09 01 f3 05 1a 00 00 00 ff 02 00 01 08 00 00 [178011.048887] input: Razer Razer DeathAdder Chroma as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.2/0003:1532:0043.000D/input/input40 [178011.112883] razermouse 0003:1532:0043.000D: input,hidraw0: USB HID v1.11 Keyboard [Razer Razer DeathAdder Chroma] on usb-0000:00:14.0-4/input2 [178011.972869] usb 1-9: halting updates: last update failed: 1

mo3pheus commented 6 years ago

sanket@zion-mainframe:/sys/bus/usb/drivers/kraken_x62$ ls -la total 0 drwxr-xr-x 2 root root 0 Jun 13 21:24 . drwxr-xr-x 12 root root 0 Jun 13 21:24 .. lrwxrwxrwx 1 root root 0 Jun 13 21:24 1-9:1.0 -> ../../../../devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9:1.0 --w------- 1 root root 4096 Jun 13 21:24 bind lrwxrwxrwx 1 root root 0 Jun 13 21:24 module -> ../../../../module/kraken_x62 -rw-r--r-- 1 root root 4096 Jun 13 21:24 new_id -rw-r--r-- 1 root root 4096 Jun 13 21:24 remove_id --w------- 1 root root 4096 Jun 13 21:24 uevent --w------- 1 root root 4096 Jun 13 21:24 unbind sanket@zion-mainframe:/sys/bus/usb/drivers/kraken_x62$

mo3pheus commented 6 years ago

Ok looks like I have the installation correct when I go to my device directory I can see the following: root@zion-mainframe:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9:1.0# ls -l total 0 -rw-r--r-- 1 root root 4096 Jun 13 21:33 authorized -r--r--r-- 1 root root 4096 Jun 13 21:33 bAlternateSetting -r--r--r-- 1 root root 4096 Jun 13 21:33 bInterfaceClass -r--r--r-- 1 root root 4096 Jun 13 21:33 bInterfaceNumber -r--r--r-- 1 root root 4096 Jun 13 21:33 bInterfaceProtocol -r--r--r-- 1 root root 4096 Jun 13 21:33 bInterfaceSubClass -r--r--r-- 1 root root 4096 Jun 13 21:33 bNumEndpoints lrwxrwxrwx 1 root root 0 Jun 13 21:33 driver -> ../../../../../../bus/usb/drivers/kraken_x62 drwxr-xr-x 3 root root 0 Jun 13 21:33 ep_01 drwxr-xr-x 3 root root 0 Jun 13 21:33 ep_81 --w------- 1 root root 4096 Jun 13 21:33 fan_percent -r--r--r-- 1 root root 4096 Jun 13 21:33 fan_rpm -r--r--r-- 1 root root 4096 Jun 13 21:33 footer_2 --w------- 1 root root 4096 Jun 13 21:33 led_logo -rw-r--r-- 1 root root 4096 Jun 13 21:33 leds_ring --w------- 1 root root 4096 Jun 13 21:33 leds_sync -r--r--r-- 1 root root 4096 Jun 13 21:33 modalias drwxr-xr-x 2 root root 0 Jun 13 21:33 power --w------- 1 root root 4096 Jun 13 21:33 pump_percent -r--r--r-- 1 root root 4096 Jun 13 21:33 pump_rpm -r--r--r-- 1 root root 4096 Jun 13 21:33 serial_no lrwxrwxrwx 1 root root 0 Jun 13 21:33 subsystem -> ../../../../../../bus/usb -r--r--r-- 1 root root 4096 Jun 13 21:33 supports_autosuspend -r--r--r-- 1 root root 4096 Jun 13 21:33 temp_liquid -rw-r--r-- 1 root root 4096 Jun 13 21:33 uevent -r--r--r-- 1 root root 4096 Jun 13 21:33 unknown_1 -rw-r--r-- 1 root root 4096 Jun 13 21:33 update_interval root@zion-mainframe:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9:1.0#

However, I can not read / modify the leds_ring or leds_logo for different colors - I can read some things such as pump_percent and pump_rpm etc but don't have color control/ mode control yet.

mo3pheus commented 6 years ago

ok echo 'static 1 fixed f00 ff8000 ff0 80ff00 0f0 00ff80 0ff 0080ff' > leds_ring does not throw an error - but doesnot seem to do anything for the colors either.

mo3pheus commented 6 years ago

I have a thought - I could connect the kraken's mini usb cable to a windows laptop I have lying around somewhere and try modifying the parameters through cam - just to set the color - then shut down reconnect the kraken to my motherboard and hope it retains the color config. Its ugly and I'd like to do it in linux without the hassle but I wanted your feedback. Would that work ? I figure as long as it is powered and connected to some fans, windows shouldn't care where the kraken sits.

brkalmar commented 6 years ago

Ok, the installation is indeed correct, but the update cycle is halted because the status message the device sent back was invalid. These lines in the logs tell us this:

[178010.973818] usb 1-9: received invalid status message: 04 1a 09 01 f3 05 1a 00 00 00 ff 02 00 01 08 00 00

[178011.972869] usb 1-9: halting updates: last update failed: 1

That's why the colours are not changed despite the driver being installed correctly.

Thank you for testing this, it appears that the X42 has a slightly different status message footer than the X62. I will open an issue for this on my fork and fix it ASAP.

brkalmar commented 6 years ago

Also, as far as using your laptop to set the colours, I really don't know how safe that would be, but it might work.

brkalmar commented 6 years ago

Here is the new issue I've opened: https://github.com/brkalmar/leviathan/issues/1

Also, if you have anything to add to that issue, or any unrelated issues, please do it on my fork, as they are not really applicable to this repo.

Update: I've hopefully fixed the issue now, try the most recent commit on master.

mo3pheus commented 6 years ago

Hi - couple of things: 1) I tried to update color of the kraken using the a miniusb connected to a windows laptop - and that works - but only as long as the laptop is connected on that line. This obviously isn't a sustainable solution because we can't have the usb tethered.

2) Thank you for the update - I will pull the most recent commit and try. I was wondering should I follow the same process of removing and reinstalling the kraken ?

mo3pheus commented 6 years ago

The latest commit works - thank you so much!! I can not express how amazing it is to be able to keep windows out of this machine!!

If there is anyway I can help you - please let me know. Although I mostly code in java.

Hopefully once I get a good understanding of the attributes, I can write a java application that will provide a gui and generate the modification commands and apply them.