chestm007 / linux_thermaltake_riing

Python driver and daemon to control thermaltake Riing fans and pumps
GNU General Public License v2.0
59 stars 25 forks source link

Thermaltake Toughpower iRGB PLUS 1200W Platinum - TT Premium Edition #8

Open bl4kh4k opened 5 years ago

bl4kh4k commented 5 years ago

Just installed your software... the 2 200mm fans in the front of the case look great now that they are not rainbows.

I do however have a Thermaltake Toughpower iRGB PLUS 1200W Platinum - TT Premium Edition

I don't see it listed as a compatible model. Thermaltake website

I know its Christmas eve so no rush ;)

Cheers.

chestm007 commented 5 years ago

Hi,

Currently not supported but im more then happy to implement it if your willing to be the test pilot :)

Does the PSU connect to a controller like the fans, or does it connect directly via usb?

bl4kh4k commented 5 years ago

I'm happy to be your test pilot!

The PSU connects directly to the USB header on the board. Does not support the fan controllers. From what i can tell they use a completely different program on Windows to control it along with power supply information (which I don't care too much about).

Its also a mini usb into the power supply which i don't believe helps in any way but thought i would mention it.

chestm007 commented 5 years ago

Alright sweet, lets start with some basic info gathering

I'm assuming your running linux so, with the PSU connected to the USB header, do you mind giving me the output of the following command:

$ lsusb -v

also I'm guessing that you have one usb controller running the fans?

bl4kh4k commented 5 years ago

That is correct, fan controller on one header, power supply on another header. lsusb.txt

chestm007 commented 5 years ago

so from what i can see from that the exposed usb device appears to be the same on the interface level - I'll slightly modify the device recognition code so it picks up the PSU's USB controller and lets see how that goes - worst case it will silently fail. I'll let you know when i've done that and which branch to pull to test :)

chestm007 commented 5 years ago

Ok, so if you'd like to pull the irgb-plus branch and pip install it with the following added to your config in the controllers section

controllers:
  ...  # your existing config

  - type: irgbplus
    unit: PSU

and send me back the log's / stack trace that'd be awesome - I am somewhat doubtful this will work first try, but crazier things have happened before.

If this doesn't work, how competent are you at setting up a windows VM, passing through the PSU's USB device, and getting some wire shark captures?

bl4kh4k commented 5 years ago

Sounds good.... I'll test it this evening. I'm perfectly comfortable setting up a vm with usb packet sniffing if first attempt fails :)

bl4kh4k commented 5 years ago

I'll be setting up a VM for you to work with. Doesn't appear to of worked and journalctl didn't log anything but the timestamp of the service being started. Looked at a few of the python files and looks like its outputting to stream. I don't work with python so i'm a bit limited there, assuming it should output to system.

chestm007 commented 5 years ago

yeah i didn't think there was a high chance of it working - was just worth a shot as most of that code will be necessary in the end anyway.

If you can get me a packet capture of a few connection/disconnections and applying some fan / lighting configurations and anything else you have time for i should be able to figure this out.

bl4kh4k commented 5 years ago

Attached a zip with 2 files. the first_connected file is just plugging in the usb. The second one is a very chatty implementation and whoever programmed that thermaltake software for windows.... sigh.

I noticed all of the lengths of the packets were 91 and switching between profiles didn't tell me which packets were which. This file is only containing the first connected, then a switch to RGB and then back to red at ff0000.

Let me know if there is anything else I can try. From what I can tell it looks like the constant chatter with the software contains any messages to be sent to the power supply. I assume the chatter is because the power supply is constantly updating its thermals as well.

Cheers.

wireshark.zip

chestm007 commented 5 years ago

thanks!

I've got as far as i need too to implement a POC to verify what i currently think might be the protocol as explained below

    possible protocol definition:
        v--30 set/31 get ? wtf does 'fe' mean then???
        |  v--device? (42 appears to be fan LED's)
        |  |  v--lighting mode? (18 aligns with the riing protocol for per led lighting)
        |  |  |  v--possibly command variables similar too riing?
        |  |  |  |  v--parameters
        |  |  |  |  |
        30 42 18 00 ff 00 00 ...

as you can probably tell im not 100% sure but based on what i saw in the packet captures i should possibly be able to get the lighting to work as a start and progress from there

I'll be pushing some new changes to the same branch in the next few hours

chestm007 commented 5 years ago

ok, those changes are now pushed, you will need to modify your config slightly. Instead of listing the PSU in the controllers section of the config - you will need to list it as its own section psus

the config in linux_thermaltake_rgb/assets/config.yml shows what i mean right at the bottom.

if what I've done works, the psu should be illuminated the same as the rest of your fans please try initially using the perled lighting configuration

if you have failures please turn on debug logging and run the daemon in the foreground in a terminal

DEBUG=true linux-thermaltake-rgb

and post the entire output displayed until it becomes repetitive (around 10 seconds or less)

bl4kh4k commented 5 years ago

Added debug logs. rgb.txt

chestm007 commented 5 years ago

it doesnt even appear to be initializing the PSU device... Sorry i must have messed up somewhere, I'll fix it up.

chestm007 commented 5 years ago

i think I've found my mistake, theres a little bit of python black magic that goes into creating the right class for each device, more or less an autoloading factory method. It looks like i forgot to import the PSU class :man_facepalming: I've updated the code, and pushed my changes - I've also added alot more debug logging as it may be useful as well.

If you wouldn't mind testing again and posting the debug logs if it once again fails to work that'd be awesome.

pretty much just execute this line in a terminal

DEBUG=true linux-thermaltake-rgb
bl4kh4k commented 5 years ago

debug.log

Still doesn't look like psu is read.

All I did was pip3 uninstall... then pip3 install... shouldn't make a difference?

chestm007 commented 5 years ago

Thats missing a whole lot of the extra logging...

All I did was pip3 uninstall... then pip3 install... shouldn't make a difference?

if thats from the packages on pypi it wont be getting my latest changes, you'll have to clone this repository, check out the irgb-plus branch, and pip3 install from inside that directory

bl4kh4k commented 5 years ago

debug.log

There we go. Did a search for any missing thermaltake files removed them manually after the uninstall... and redownloaded to a different location incase something was going wrong there but we have new logs now!

chestm007 commented 5 years ago

the code looks right to me, It appears i havent updated the udev rule in this branch either.

can you add the following line too /etc/udev/rules.d/90-linux_thermaltake_rgb.rules

ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="264a", ATTRS{idProduct}=="2329", MODE="660", GROUP="plugdev"

then reboot to ensure the rule takes effect, and attempt to run the controller again?

bl4kh4k commented 5 years ago

Added rule, and rebooted. debug.log

chestm007 commented 5 years ago

That's really strange. I'm going to give up trying to do this remotely as its obviously a bit more involved then i first thought - one of these PSU's is on my shopping list very soon so unless someone picks it up before then i'll Work on implementing this then - I'm sorry for the inconvenience...

MoshiMoshi0 commented 5 years ago

I dont have much to input but from what I've gathered [0xfe, 0x31] is controller init. So you should override init_controller in ThermaltakeiRGBPLUSControllerDriver.

Also it seems to return psu P/N. If you convert 54 50 49 2d 31 32 30 30 46 32 46 44 50 00 in dps_protocol.txt to ASCI you get "TPI-1200F2FDP".

This should be easy to implement since it seems like they just added a Riing Plus fan to a psu. The commands should be very similar if not the same. I would start by creating a super simple script that just tries to initialize the psu controller and maybe get its version by [0x33, 0x50].

MoshiMoshi0 commented 5 years ago

Ok I got almost everything.

https://moshimoshi0.github.io/ttrgbplusapi/controllers/dpsg.html

chestm007 commented 5 years ago

@devcompl looks like the data i was sending in init_controller was wrong :man_facepalming: I might throw together a really quick dummy script to just double check.

chestm007 commented 5 years ago

@bl4kh4k if your still interested, please pull the latest changes from the irgb-plus branch and run python3 tests/scripts/toughpower.py - you may have to adjust that path depending what directory you are in, its relative to the root of the repository.

If it works, it should set your led's to a random colour on the PSU