EvanMulawski / FanControl.CorsairLink

The unofficial CorsairLink plugin for Fan Control. Adds support for Corsair controllers, liquid coolers, and power supplies. An alternative to iCUE.
150 stars 11 forks source link

Errors when resuming from sleep #178

Open notthatwillsmith opened 4 months ago

notthatwillsmith commented 4 months ago

I'm getting errors on resume from suspend with the CorsairLink plugin pulling pump speed and liquid temperature from my AIO. The AIO is the iCUE Link H150i and all the USB devices between the AIO and the PCI Express bus have the ability to go to sleep to save power disabled in Device Manager.

I'm running v194 of Fan Control and 1.6.0 of the CorsairLink plugin.

I've attached logs below, but the error is :

2024-06-27T06:00:18.5472265Z [WRN] Device Initialization: An error occurred initializing device 'iCUE LINK System Hub (900395E8868AC453ABFC355596C0B961)' (\?\hid#vid_1b1c&pid_0c3f&mi_00#a&11cbf70e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}): 2024-06-27T06:00:18.5472265Z [ERR] Device Initialization: Type: CorsairLink.CorsairLinkDeviceException Message: Operation canceled: The expected data type was not read within the specified time. Source: FanControl.CorsairLink HResult: -2146233088 Stack Trace: at CorsairLink.Devices.ICueLink.ICueLinkHubDevice.SendCommand(ReadOnlySpan1 command, ReadOnlySpan1 data, ReadOnlySpan1 waitForDataType) at CorsairLink.Devices.ICueLink.ICueLinkHubDevice.ReadFromEndpoint(ReadOnlySpan1 endpoint, ReadOnlySpan`1 dataType) at CorsairLink.Devices.ICueLink.ICueLinkHubDevice.RefreshImpl(Boolean initialize) at CorsairLink.Devices.ICueLink.ICueLinkHubDevice.Connect() at FanControl.CorsairLink.CorsairLinkPlugin.FanControl.Plugins.IPlugin.Initialize() Data: command: 0801 data: waitForDataType: 2100

If I refresh sensor detection, Fan Control recovers and works fine, but I often have to reattach the sources that are on the AIO to the appropriate cards on Fan Control. Logs are attached below.

log.zip

EvanMulawski commented 4 months ago

Hi @notthatwillsmith, I was able to reproduce this and I'm currently working on a fix.

EvanMulawski commented 4 months ago

@Rem0o Do you think Fan Control should close plugins on Suspend (and reload them on Resume) in lieu of plugins needing to handle SystemEvents.PowerModeChanged on their own?

Rem0o commented 4 months ago

It does already actually, but you can't "stop" the suspend process to allow code to run until completion, it will do the best it can before the suspend comes into effet, and whatever was not done will be executed on resume. Fun fact, handling sleep in FanControl is the single hardest and most complicated thing in the software to handle.

The most reliable way to deal with this has been to do everything on resume (full refresh, so close + init).

EvanMulawski commented 4 months ago

Fun fact, handling sleep in FanControl is the single hardest and most complicated thing in the software to handle.

Haha - I don't doubt that. Thanks!