Jump to content
Corsair Community

Use iCue logs to control Gigabyte's RGB Fusion?


solarity
 Share

Recommended Posts

I am at work, though I can't look into it now. Though I am thinking about using the iCue log files, if there is any data in there relating to controlling colors/profile, as a way to set the colors on my Gigabyte motherboard.

 

There is a RGB Fusion CLI that was developed by someone with the Gigabyte SDK. https://github.com/tylerszabo/RGB-Fusion-Tool

 

In theory all I would have to do is write a power shell script that would tail the log file for a profile/color trigger, then use the RGB Fusion CLI to change the color. Further customization could be done by setting a config file with mappings of Corsair Profiles to RGB Fusion.

 

1) I know there are log files being generated by iCue and I am guessing it has a higher verbosity, due to the beta nature of this early release.

2) Will have to see what all this CLI can do.

3) Will need to play with Power Shell, I am more of a Perl/Bash scripter.

 

 

This is really more of a hack and I think Corsair will support Motherboard RGB SDKs at some point, though if I can do this easily enough, then I can get what I want now :)

Link to comment
Share on other sites

I took a look at the corsair logs, it looks like the trace logs doesn't contain anything reusable and the only other logs I see relate to the logging of performance data, i.e. temp of cpu at a given time.

 

Is there a way I can adjust the verbosity of the trace log data to get things, such as the profiles loaded, etc?

Link to comment
Share on other sites

No need for powershell or log file if you can keep one key having a unique color and use sdk of Corsair to do something I have it write to a file the name of the current profile when colors match. I am doing it wrong (inefficiently) and it eats a full core full clock but a better programmer could add rational thread sleeps and fix it

 

 

 

int profileGetter(CorsairLedColor ledColor) {
int sendBackProfile = 0;

if (ledColor.r == 20 && ledColor.b == 0)
{
	std::ofstream myfile;
	myfile.open("Profile.txt");
	myfile << "Default";
	sendBackProfile = 0;
	myfile.close();
}

http://smithany.com/register_callback.cpp

Edited by hastegag
Link to comment
Share on other sites

No need for powershell or log file if you can keep one key having a unique color and use sdk of Corsair to do something I have it write to a file the name of the current profile when colors match. I am doing it wrong (inefficiently) and it eats a full core full clock but a better programmer could add rational thread sleeps and fix it

 

 

 

int profileGetter(CorsairLedColor ledColor) {
int sendBackProfile = 0;

if (ledColor.r == 20 && ledColor.b == 0)
{
	std::ofstream myfile;
	myfile.open("Profile.txt");
	myfile << "Default";
	sendBackProfile = 0;
	myfile.close();
}

http://smithany.com/register_callback.cpp

 

I guess that is another way. Thanks for the suggestion. I started playing with the CLE tool and it needs a little work. I managed to fill some buffer and the only way I could clear it out was to power down the machine and kill the switch on the back lol. This some guys pet project on github, it doesn't looks like it gives me the ability to set channels or use the profiles. When I set all things to one color, it looks like that one or two zones doesn't set properly, maybe he has a different board, that is missing that zone.

 

I have a dream that my four peripherals will one day live in a system where the color of their lights will be set by the content of one character

 

Likewise, I hope the software will be corsair's.

Edited by solarity
Link to comment
Share on other sites

No need for powershell or log file if you can keep one key having a unique color and use sdk of Corsair to do something I have it write to a file the name of the current profile when colors match. I am doing it wrong (inefficiently) and it eats a full core full clock but a better programmer could add rational thread sleeps and fix it

 

 

 

int profileGetter(CorsairLedColor ledColor) {
int sendBackProfile = 0;

if (ledColor.r == 20 && ledColor.b == 0)
{
	std::ofstream myfile;
	myfile.open("Profile.txt");
	myfile << "Default";
	sendBackProfile = 0;
	myfile.close();
}

http://smithany.com/register_callback.cpp

 

Forgot to ask, this works fine with iCUE? Also didn't you consider using an environmental variable?, instead of reading/writing to a text file?

 

So what are you using this script to control? I took look at your script and correct me if I am wrong it executes on key press, checks the profile, then sleeps?

Link to comment
Share on other sites

Forgot to ask, this works fine with iCUE? Also didn't you consider using an environmental variable?, instead of reading/writing to a text file?

 

So what are you using this script to control? I took look at your script and correct me if I am wrong it executes on key press, checks the profile, then sleeps?

So I am pretty bootleg at C++ but ultimately it is on my "to do list" to instead of writing to a file (a lot) to just write to a fixed memory location and read it back from there.

 

For me, yes, it is triggered on a keypress and i have a corresponding autohotkey script that reads from the file to confirm the active profile in CUE and then perform different behaviors based on whether the profile is active or not.

 

This is necessary for two reasons, one because in order to have hot key modified Gkey's and Mkeys on the scimitar, you would need to have a bunch of manicured profiles inside of CUE which proved unreliable if you hit a lot of very fast keypresses in photoshop because it has to coordinate lighting and a bunch of other stuff. It also was unreliable if an app stole focus while it was within one modifier-profile and then going back to the app you would have to force it back to the default profile and across many applications, I find it easier to maintain what i want to do in autohotkey along side CUE with one profile per application.

 

The other benefit is I wasnt able to transition from CUE to AHK all at once and still have some binds in there so it is a "double check" on the AHK functions in addition to the active window to make sure they do not stomp each other.

 

Ideally, it should not be writing to a hard drive so many times - I understand pointers well enough, but I am not clear on how to make sure a specific memory location is available and use it for a single session. I'll get there but it hasn't been ultra high on the priority.

 

I am not sure the way I have it now that it "sleeps" at all, that's the other problem it seems to jam a full core on the processor, so very inefficient. I think that is very fixable with thread sleeps but again, i am out of my depth and look forward to fixing it and getting a handle on it.

Link to comment
Share on other sites

whoops so yeah i figured out the jamming up the processor part at least, I just added

 

std::this_thread::sleep_for(2s);

 

after my while(true)

 

statement, which in hindsight was a pretty stupid thing to type.

 

This requires a namespace declaration of

 

using namespace std::chrono_literals;

 

and inclusion of

#include <chrono>

 

At least that way the specific media keys i was sniffing for to do the profile checking only check every 2 seconds...which is plenty. I will get after the next fix regarding the disk write aversion hopefully soon.

 

corrected in the linked code above

Link to comment
Share on other sites

So I am pretty bootleg at C++ but ultimately it is on my "to do list" to instead of writing to a file (a lot) to just write to a fixed memory location and read it back from there.

 

For me, yes, it is triggered on a keypress and i have a corresponding autohotkey script that reads from the file to confirm the active profile in CUE and then perform different behaviors based on whether the profile is active or not.

 

This is necessary for two reasons, one because in order to have hot key modified Gkey's and Mkeys on the scimitar, you would need to have a bunch of manicured profiles inside of CUE which proved unreliable if you hit a lot of very fast keypresses in photoshop because it has to coordinate lighting and a bunch of other stuff. It also was unreliable if an app stole focus while it was within one modifier-profile and then going back to the app you would have to force it back to the default profile and across many applications, I find it easier to maintain what i want to do in autohotkey along side CUE with one profile per application.

 

The other benefit is I wasnt able to transition from CUE to AHK all at once and still have some binds in there so it is a "double check" on the AHK functions in addition to the active window to make sure they do not stomp each other.

 

Ideally, it should not be writing to a hard drive so many times - I understand pointers well enough, but I am not clear on how to make sure a specific memory location is available and use it for a single session. I'll get there but it hasn't been ultra high on the priority.

 

I am not sure the way I have it now that it "sleeps" at all, that's the other problem it seems to jam a full core on the processor, so very inefficient. I think that is very fixable with thread sleeps but again, i am out of my depth and look forward to fixing it and getting a handle on it.

 

whoops so yeah i figured out the jamming up the processor part at least, I just added

 

std::this_thread::sleep_for(2s);

 

after my while(true)

 

statement, which in hindsight was a pretty stupid thing to type.

 

This requires a namespace declaration of

 

using namespace std::chrono_literals;

 

and inclusion of

#include <chrono>

 

At least that way the specific media keys i was sniffing for to do the profile checking only check every 2 seconds...which is plenty. I will get after the next fix regarding the disk write aversion hopefully soon.

 

corrected in the linked code above

 

Is there a function in the SDK to allow for on profile switch or something?

 

Another option, if you are setting profiles by application:

Check the running processes, to see if the application is running and if it is, it could then could switch the my motherboard's.

 

Sudo Code:

#arrays elemen'ts index must match

Array @Process(app1, app2, app3)

Array @Profile(prof1, prof2, prof3)

$x=0

 

#loop through each process

foreach (@Process) {

 

#see if process is running

live = get-process $Process[$x] | limit 1

 

if ($live <> NULL) {

#load profile for motherboard, if it is running.

Invoke-Command /path/to/MB-CLI.exe --passArguements $profile[$x]

sleep 60

}

 

$x++

}

sleep 60

#End Code

 

I am a Linux Admin so I know next to nothing about powershell. This would have to be run as a job that executes every X minutes. I think this would require less overhead than using the CUE SDK as well as it won't require reading/writing to files. The actual implementation of this might be easier to do, if someone is knowledgeable on powershell.

 

I will also need to speak to the person developing the CLI for RGB Fusion to see if he can use profiles that are generated by Fusion. That way you can set a profile in RGB Fusion and have the CLI load the profile. Might be easier for him to do that as I think the profiles are stored as XML.

Link to comment
Share on other sites

"Is there a function in the SDK to allow for on profile switch or something? "

 

There is not currently but you can just poll for things you know would be in effect color wise in that profile, for me i keep a single key on a static lighting (Q).

 

The 'process sniffing' may work but it will be different across vendors and versions and hard to maintain.

 

I would very much like to see a CLI interface or an SDK method with iCUE that will allow us to force a profile switch because there are instances when it gets stuck because of stolen focus and automating it would be nice. In far cry they seemed to be able to activate profiles as needed so that must be a thing already I just dont know how to do it yet.

Link to comment
Share on other sites

Sorry I was thinking a little out of context. As I want different profiles for different games, it is easy enough to link Corsair iCue to the focus of a game. i.e. if Overwatched is on the screen, then the Overwatch Profile will be used, if you alt-tab it will go back to default/previous profile.

 

Maybe instead of trying to get the profile information from iCue, I could just set a powershell script to look at the windows process. Granted this would be complicated if you have multiple matches for process and I didn't see anything in powershell that allows you to determine what app has the focus. It wouldn't work directly with iCue, but you would set to set the program in the script config as well as iCue for it to work together properly.

 

 

In this quick example I am searching for processes: iexplore, firefox, and chrome. It only shows chrome and iexplore as I don't have Firefox running.

 

ps | select-string -Pattern "iexplore","Firefox","Chrome" | unique

System.Diagnostics.Process (chrome)
System.Diagnostics.Process (iexplore)

 

Someone wrote a CLI tool for Gigabyte's Fusion, though it is a bit limited. It can set brightness and color for the whole motherboard, well almost all, slight bug where it doesn't control one zone. Again this is some random guy who put it on github.

 

I might use an Arduino and some multi-channel PWM boards to give me greater control of some analog RGB devices that I have that aren't Corsair.

 

This is what I am thinking:

 

Game Process (Trigger)

-Corsair iCue (sees trigger and control child devices)

--Lighting Node Pro

---HD-120

---RGB Strips

---K70 Lux

-PowerShell Script (sees triggers and controls only child process)

--Aurduino (controls child devices independently, which are analog RGB)

---RGB Fittingsx6

---RGB Res

---RGB CPU Block

---3x no-name Analog RGB fans

--RGB Fusion CLI Tool (controls child device with only brightness and color settings)

---Motherboard

 

Granted this is very complex and the Powershell script will check the processes every minute, while iCue looks at the window focus. So iCue will switch profiles 1-60seconds quicker than the powershell script, unless I lower the polling time, if I can even do it by seconds. There will also be complications if you have a profile for firefox and one for Overwatch, which one will it take? Granted i will do this for games only so that won't be a problem. I think this would work though it is dependent on what your needs are. I like different themes for different games. The limitations will be more on the Aurdino, Fusion CLI tool, and iCue.

 

Let's see if I scared you away with my craziness :)

Link to comment
Share on other sites

Maybe instead of trying to get the profile information from iCue, I could just set a powershell script to look at the windows process. Granted this would be complicated if you have multiple matches for process and I didn't see anything in powershell that allows you to determine what app has the focus.

 

You are correct we were both on slightly different pages but with respect to getting power shell to give you the running process that may work just fine but there are other methods that maybe easier

 

IfWinActive

Both the directive and the conditional in auto hotkey work pretty fantastic in my experience

 

Your mileage in Game may vary, essentially I believe auto hotkey uses the windows API to see the list of active processes check if there’s a matching name then does whatever it needs to to get the process ID and handle and goes from there if need be

 

You could probably do that all in various languages including in poweshell.

 

Autohotkey is pretty manageable

 

Your script could be basically (untested typing on phone from recollection)

IfWinActive ahk_exe chrome

{

Run Mb-cli.exe -argumentsToSwitch chromeProfile

}

Etc

Link to comment
Share on other sites

You are correct we were both on slightly different pages but with respect to getting power shell to give you the running process that may work just fine but there are other methods that maybe easier

 

IfWinActive

Both the directive and the conditional in auto hotkey work pretty fantastic in my experience

 

Your mileage in Game may vary, essentially I believe auto hotkey uses the windows API to see the list of active processes check if there’s a matching name then does whatever it needs to to get the process ID and handle and goes from there if need be

 

You could probably do that all in various languages including in poweshell.

 

Autohotkey is pretty manageable

 

Your script could be basically (untested typing on phone from recollection)

IfWinActive ahk_exe chrome

{

Run Mb-cli.exe -argumentsToSwitch chromeProfile

}

Etc

 

I might have to look into it. I played around with a script and I do need to better understand the syntax/formatting of Powershell. I found it frustrating and stupid, I wish they should have not tried to reinvent the wheel so poorly and just used bash. Then the Windows guys at work could see how much cooler Linux admins are. Only if DirectX/Direct3D never took off, then I might not be having this conversation. Anyway I vented my frustration into a meme.

 

bqzmijptn2t01.png

https://i.redd.it/bqzmijptn2t01.png

Link to comment
Share on other sites

I might have to look into it. I played around with a script and I do need to better understand the syntax/formatting of Powershell....bqzmijptn2t01.png

https://i.redd.it/bqzmijptn2t01.png

That's about right, I never got the hang of it really it is a lot of seemingly proprietary vomit even though it is very powerful especially at mass file manipulation (renaming and permissions etc). Anytime I ever need it thankfully some genius already figured it out! :laughing:

 

Check out Autohotkey though as alongside CUE / iCUE it is definitely going to be able to do what you want.

 

For your purposes it sounds like it will work without the SDK polling the active profile from CUE as you can link it in a similar fashion to the active window or active application and run whatever you need to control other devices.

Link to comment
Share on other sites

Here is a powershell script i wrote for changing the RGB colors based off the game running, still a work in progress. I am using the CLI that someone wrote from the RGB fusion SDK on github:

 


#Zones for Gigabyte Z370 Gaming 7
#0 = VRM
#1 = RAM
#2 = Chepset + Bar
#3 = PCIe
#4 = 12vRGBW Header
#5 = NA
#6 = NA
#7 = Digital LED ?
#8 = Digltal LED ?

$games = "Overwatch","FarCry5"
$path = $PSScriptRoot + "\RGBFusionTool.exe"
$c=0

while ($true) {
$x=0
$z=0
$y=0
ForEach ($check in $games) {
$process = get-process $check -ErrorAction SilentlyContinue

   if ($process -ne $null ) {
       write-host "Game Running, $check"
       if ($check -eq "Overwatch") {
           $colors = "orange","white","orange","blue","blue"
       } ElseIf ($check -eq "FarCry5") {
           $colors = "blue","white","red","white","blue"
       }

       if ($c -eq 0) {
           ForEach ($setColor in $colors) {
               write-host "changing color"
               & $path -c  $setColor -z $z
               $z+=1
               #Sleeping exec commands to quickly can overload the buffer
               sleep 1.25
           }
           $c=1
       }
   } Else {
       $y+=1
   }
   $x+=1
}

if ($x -eq $y ) {
   write-host "No games running"
   $c=0
}

write-host "Sleeping to check for app running"
sleep 3

}

Link to comment
Share on other sites

I just finished the script. You copy RGB profiles from RGB Fusion, put it into the a profiles/ folder in the same directory as the script and make sure each XML files is the name or the process you want it to see to trigger the change. When you launch a game it gets the static color settings and brightness from the XML files that were created, when you made the profile in RGB Fusion. There are some bugs that might need to be sorted out, though that might be upstream of my script.

 

It looks really awesome in Farcry5. I have the Corsair RGB strips, HD-120s and K70 Keyboard go red white and blue. At the same time the RGB lighting in the case matches it. When I load up Overwatch the colors change to orange,white, and blue.

 

This is what I have so far: https://github.com/windows2000bug/RGB-Fusion-Tool-PS

Link to comment
Share on other sites

 Share

×
×
  • Create New...