10se1ucgo / cue_sdk

Python wrapper for the Corsair Utility Engine SDK
Other
21 stars 2 forks source link

No way to close CUE dll #8

Closed JiFish closed 7 years ago

JiFish commented 7 years ago

Unfortunately, due to corsair's bizarre design decisions, it is impossible to 'free' keys up once set and allow them to be controlled by the CUE software again. The only way to work around this is close the CUE dll itself which will free all keys.

However, this also isn't as easy as it seems. Destroying the cue_sdk object does not close the dll as expected. I have worked around the issue like this: (Where self.cue is the cue_sdk object.)

    def corsair_release(self):
        if (self.cue == None):
            return
        # setup kernel if needed
        if (self.k32 == None):
            import ctypes
            from ctypes import wintypes
            self.k32 = ctypes.WinDLL('kernel32')
            self.k32.FreeLibrary.argtypes = [wintypes.HMODULE]
        handle = self.cue._libcue._handle
        self.k32.FreeLibrary(handle)
        self.cue = None

Is there a better way to do this? Can something like this be implemented in to cue_sdk?

finalised commented 7 years ago

Was this fixed? Or did you end up finding a solution? Don't want to start a project and find out I can't give the CUE application back control.

JiFish commented 7 years ago

This wasn't fixed AFAIK. I continued to use the work-around I posted above.

finalised commented 7 years ago

Cheers mate for the speedy response, especially on such an old thread! I'll give it a go with your fix, or I might try another wrapper. Thanks again!

JiFish commented 7 years ago

If you find a wrapper that has this feature, please let me know!

finalised commented 7 years ago

I have yet to research it further, but I am fairly sure that the CUE.NET library written in C#, has a method CueSDK.Reinitialize(); which does exactly what we're looking for.

finalised commented 7 years ago

Oh! This was fixed. Just use: Corsair.ReleaseControl(CAM.ExclusiveLightingControl)

JiFish commented 7 years ago

Oh nice! Thank you.

10se1ucgo commented 7 years ago

My email is filled with a bunch of crap, I'm sorry I didn't see any of this earlier @_@