audiohacked / OpenCorsairLink

Linux and Mac OS support for the CorsairLink Devices
GNU General Public License v2.0
705 stars 125 forks source link

Adding support H100i platinum. Only pump works. #214

Closed shadowpho closed 4 years ago

shadowpho commented 4 years ago

Proposed changes

Adds support for H100i platinum. I was trying to change pump speed to get a little bit more perf, and this lets us do this. I can't get lights to work nor any readouts (all read 0.0), but changing pump works (verified on intel afterwords)

Types of changes

Checklist

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Thanks for contributing!

jonasmalacofilho commented 4 years ago

The H100i RGB Platinum is a CoolIT device, no? It's weird that you're using the Asetek driver.

Are you sure that nothing else may be interfering with the pump speed, and thus tricking your "verified on intel afterwords"?

Edit: note that this device doesn't have have OUT endpoint you specify in the binding.


By the way, lsusb data for this device (courtesy of linux-hardware):

Bus 001 Device 005: ID 1b1c:0c18 Corsair 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1b1c Corsair
  idProduct          0x0c18 
  bcdDevice            1.00
  iManufacturer           1 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      27
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               7
shadowpho commented 4 years ago

Sorry by Intel I meant windows (as it has intel). For some reason my head mixed them up :).

What should the device_id be? I see to be getting all 00's when I run the scanner.

Checking USB device (1b1c:0c18)... Corsair product detected. Checking if device is H100i Platinum... Corsair Device has kernel driver attached Detached kernel driver from Corsair Device Claimed Interface on Corsair Device ---- Packet dump: ----------------------------- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -----------------------------------------------

jonasmalacofilho commented 4 years ago

I'm sorry, but I really think your verification method is not sound. How are you doing that exactly?

First, you're using the Asetek driver on a device I think is made by CoolIT. Of course I could be wrong about this first issue, but a second problem is that the device doesn't have the OUT 1 endpoint you specified for writes.

Can you rebase this change on top of the 'testing' branch (I'm not familiar with the 'improved_scan' branch, and I'm not even sure it's fully functional yet) and pass --debug when testing the pump speed changes? I imagine there will be some errors.

For even more debug information, enable LIBUSB debug as well:

sudo LIBUSB_DEBUG=4 OpenCorsairLink.elf --debug <other arguments>
shadowpho commented 4 years ago

Sorry! I did switch it to coolit. My apologies I was going too deep into the code before providing my changes!

I ran the debug tool. Looks like it fails on reading from it.

Let me rebase the files tomorrow to testing branch and test that.

output.txt

shadowpho commented 4 years ago

Thank you! I fixed those changes and rebased to stable/testing (sorry took me a while of figuring out git).

However, there's no changes, it doesn't get any data. Log is identical to previous. I am going to try to gdb a bit :)

jonasmalacofilho commented 4 years ago

You're assuming one of the current OCL drivers will work with these devices, but that might not be the case.

What I would do if I had one of these coolers on hand is capture the USB traffic between it and iCue/CorsairLink and figure out the protocol.

Someone already provided a first capture (see: #146), but it's painful to reverse engineer the protocol when you don't know what's going on at the time of each message. And the raw text output from usbmon is also not super convenient for more complex analyzes, a pcap from Wireshark would be better.

EDIT: the raw/text output of usbmon is great when you already know the structure of what you're looking at. But (personally) I find Wireshark quicker/more convenient when you're completely lost, because it's easier to switch between many different filters and do things like timing analysis.

shadowpho commented 4 years ago

Yeah looks like the current drivers don't work. I will try to gather some wireshark captures. First step is to install the Windows on the PC, and that's almost done. It takes forever with plain old HDDs....

jonasmalacofilho commented 4 years ago

@shadowpho do you need any help capturing and analyzing the USB traffic?

audiohacked commented 4 years ago

I bought a H100i RGB Platinum recently, so as soon as I get it, I'll do some reverse engineering of the protocol.

shadowpho commented 4 years ago

@jonasmalacofilho: still setting up windows + drivers + update + wireshark. I can probably start capturing + labeling it later today.

shadowpho commented 4 years ago

Ok, here's what I got. I named it txt because github wants it to be txt, but it's actually usbpcap capture. test1.txt

For some reason I only get 3 entries that have the right vendor code...

  1. unplug
  2. wait 10 seconds
  3. plug

open icue

FAN#1 379 RPM (balanced) Fan#2 352 RPM (balanced) Pump 2359 RPM Temp 23.9C

  1. change fan1 to ZERO RPM - goes down 0 RPM

  2. change fan2 to ZERO RPM -- goes down to 0 RPM

  3. changed fan2 to extreme -- goes up to 1515 rpm (slowly)

  4. changed fan1 to balanced -- goes up to 373 rpm slowly

  5. change pump to balanced - goes down to 2349 rpm

  6. change pump to quiet (1911 rpm)

  7. change pump to extreme (2856 rpm)

  8. changed everything to balanced (380, 380, 2348)

audiohacked commented 4 years ago

I've done some preliminary reverse engineering of the H100i Platinum, and I think I know how to read the status from the hardware. Still working on figuring out how to set speeds and etc.

jonasmalacofilho commented 4 years ago

That's great @audiohacked!

shadowpho commented 4 years ago

I saw that you added a new branch :). Is it ready for testing? If not, how can we help on this?