tylerszabo / RGB-Fusion-Tool

A command line tool for calling Gigabyte's RGB Fusion SDK
GNU General Public License v3.0
184 stars 21 forks source link

Warn if other light-setting tools are running #11

Open tylerszabo opened 6 years ago

tylerszabo commented 6 years ago

Attempt to detect if other tools (like RGBFusion) are running to avoid conflicts.

tylerszabo commented 6 years ago

Process list: SelLed, MBLed, SelLedV2

windows2000bug commented 6 years ago

I did happen to notice that after I shut down my system some LEDs were still on. I am wondering if the on board LEDs might be 5v as when the power is off none of my 12v LEDs attached to the header work. Though I do have 5v analog RGBs that I are connected to the cathodes of the RGB 12v header, while I plug the common anode into the 5v Digital header for power. These stay lit. I do know that the motherboard has 5v supplied to it via the PSU, even with the system is off.

I started to play with it and after a few times I got this again.

RGBFusionTool.exe -c red Usage: RGBFusionTool.exe [OPTION]... Set RGB Fusion motherboard LEDs

Options: -v, --verbose -c, --color, --static=VALUE set static color --cycle, --colorcycle[=SECONDS] cycle colors, changing color every SECONDS -b, --brightness=VALUE brightness (0-100) -l, --list list zones -z, --zone=VALUE set zone -?, -h, --help show help and exit

Error: GLedApiDotNet.Raw.GLedAPIv1_0_0Exception: dllexp_SetLedData returned ERROR_INSUFFICIENT_BUFFER at GLedApiDotNet.Raw.GLedAPIv1_0_0Wrapper.CheckReturn(String apiFunction, UInt32 result) at GLedApiDotNet.Raw.GLedAPIv1_0_0Wrapper.SetLedData(IEnumerable`1 settings) at GLedApiDotNet.RGBFusionMotherboard.MotherboardLedSettingsImpl.WriteToApi(GLedAPIv1_0_0Wrapper api) at GLedApiDotNet.RGBFusionMotherboard.Set(Int32[] divisions) at GLedApiDotNet.RGBFusionMotherboard.SetAll(LedSetting ledSetting) at RGBFusionTool.RGBFusionMain.LazyMotherboard.SetAll(LedSetting ledSetting) at RGBFusionTool.Application.Main(String[] args)

killed SelLedV2 process in TM

ps | select-string -Pattern SelLed, MBLed, SelLedV2

Started RGB Fusion via app manger

ps | select-string -Pattern SelLed, MBLed, SelLedV2 System.Diagnostics.Process (SelLedV2)

LEDs not controllable via RGB Fusion, will kill main power to fix it.

windows2000bug commented 6 years ago

I have been playing with it for the past couple of hours, and it looks like if the commands are executed about a ~1sec or less, then the buffer error comes up. I haven't had the issue with the lights not responding. If I give it enough time it is fine. At the same time I haven't launched the RGB Fusion UI, nor have I killed any processes.

I wrote a quick and dirty power shell script to test the proof of concept of using your *.exe to set the colors based on games. I am not a programmer, though a Linux admin. Please excuse my poor use of powershell. I am not even sure if it is recommended to use it in this way. I noticed that the CPU usage is very low, until it runs the exe to change the lights. I am going to add a few more things into it to improve it. As I do scripting primary, I don't use a repository. Should I do a fork of your tool and add the powershell script to it?

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

}

tylerszabo commented 6 years ago

I'm really excited that you've scripted with it - this is exactly why I wrote this tool. So it sounds like there's a race condition somewhere in Gigabytes API.

I've created issue #16 to track this issue; thanks for getting a repro for it, too.

tylerszabo commented 6 years ago

Not sure if this should be on the 1.0 bar; removing for now.