Rem0o / FanControl.IntelCtlLibrary

5 stars 1 forks source link

Initialization failed #1

Open characharm opened 3 months ago

characharm commented 3 months ago

image

04.04.2024 16:03:04: System.Exception: Initialization was called twice. в FanControl.Domain.ComputerAccessLayer.Initialize() в FanControl.Domain.ComputerAccessLayer.<>c__DisplayClass11_0.<b__0>d.MoveNext() 04.04.2024 16:03:04: Initialization failed.

Version 186 (NET 4.8 - 8 tried both)

Rem0o commented 3 months ago

Will be net 8 version only for now. Pushed a commit, try the new build.

characharm commented 3 months ago

image

error log 04.04.2024 23:17:19: System.TypeInitializationException: The type initializer for 'CtlLibraryBindings.CtlLibraryPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..ctor() at CtlLibraryBindings.CtlLibraryPINVOKE..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.create_Init_Args() at CtlLibraryBindings.CtlLibrary.create_Init_Args() at FanControl.IntelCtlLibraryPlugin.IntelCtlLibraryPlugin.Initialize() in C:\projects\fancontrol-intelctllibrary\IntelCtlLibraryPlugin.cs:line 29 at FanControl.Domain.BackendProviders.Plugin.PluginBackendProvider.Open() 04.04.2024 23:17:19: System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..ctor() at CtlLibraryBindings.CtlLibraryPINVOKE..cctor() 04.04.2024 23:17:19: System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() 04.04.2024 23:17:20: System.TypeInitializationException: The type initializer for 'CtlLibraryBindings.CtlLibraryPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..ctor() at CtlLibraryBindings.CtlLibraryPINVOKE..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.create_Init_Args() at CtlLibraryBindings.CtlLibrary.create_Init_Args() at FanControl.IntelCtlLibraryPlugin.IntelCtlLibraryPlugin.Initialize() in C:\projects\fancontrol-intelctllibrary\IntelCtlLibraryPlugin.cs:line 29 at FanControl.Domain.BackendProviders.Plugin.PluginBackendProvider.Open() 04.04.2024 23:17:20: System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..ctor() at CtlLibraryBindings.CtlLibraryPINVOKE..cctor() 04.04.2024 23:17:20: System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() 04.04.2024 23:17:21: IntelCtlLibrary could not initialize or has no sensors. 04.04.2024 23:17:58: System.TypeInitializationException: The type initializer for 'CtlLibraryBindings.CtlLibraryPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..ctor() at CtlLibraryBindings.CtlLibraryPINVOKE..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.create_Init_Args() at CtlLibraryBindings.CtlLibrary.create_Init_Args() at FanControl.IntelCtlLibraryPlugin.IntelCtlLibraryPlugin.Initialize() in C:\projects\fancontrol-intelctllibrary\IntelCtlLibraryPlugin.cs:line 29 at FanControl.Domain.BackendProviders.Plugin.PluginBackendProvider.Open() 04.04.2024 23:17:58: System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..ctor() at CtlLibraryBindings.CtlLibraryPINVOKE..cctor() 04.04.2024 23:17:58: System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() 04.04.2024 23:18:07: System.TypeInitializationException: The type initializer for 'CtlLibraryBindings.CtlLibraryPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..ctor() at CtlLibraryBindings.CtlLibraryPINVOKE..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.create_Init_Args() at CtlLibraryBindings.CtlLibrary.create_Init_Args() at FanControl.IntelCtlLibraryPlugin.IntelCtlLibraryPlugin.Initialize() in C:\projects\fancontrol-intelctllibrary\IntelCtlLibraryPlugin.cs:line 29 at FanControl.Domain.BackendProviders.Plugin.PluginBackendProvider.Open() 04.04.2024 23:18:07: System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor() --- End of inner exception stack trace --- at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..ctor() at CtlLibraryBindings.CtlLibraryPINVOKE..cctor() 04.04.2024 23:18:07: System.DllNotFoundException: Unable to load DLL 'CtlLibraryCSharpBind' or one of its dependencies: The specified module could not be found. (0x8007007E) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CtlLibrary(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at CtlLibraryBindings.CtlLibraryPINVOKE.SWIGExceptionHelper..cctor()
Rem0o commented 3 months ago

Did you put "CtlLibraryCSharpBind.dll" in your plugin folder also? Not just the plugin's dll ?

characharm commented 3 months ago

CtlLibraryCSharpBind.dll

I suspect that this library is not in the archive

Rem0o commented 3 months ago

CtlLibraryCSharpBind.dll

I suspect that this library is not in the archive

Yup you are right the copyTooutput somehow didn't do its job, should be included now.

characharm commented 3 months ago

The program crashes without any error messages or entries in the log

Rem0o commented 3 months ago

Nothing even in EventViewer?

characharm commented 3 months ago

P1: FanControl.exe P2: 186.0.0.0 P3: 65cd0000 P4: StackHash_3049 P5: 10.0.22621.3374 P6: eae8eecc P7: c0000374 P8: PCH_38_FROM_ntdll+0x000000000009FEB4 P9: P10:

Faulting application name: FanControl.exe, version: 186.0.0.0, timestamp: 0x65cd0000 Faulting module name: ntdll.dll, version: 10.0.22621.3374, timestamp: 0xeae8eecc Exception code: 0xc0000374 Fault offset: 0x000000000010c169 Faulting process ID: 0x332C Faulting application start time: 0x1DA86C39AE784FD Faulting application path: S:\Applications\Fan Control\FanControl.exe Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll Report ID: 28a1ffeb-b213-4684-af59-bd4c7b92487a Faulting package full name: Faulting application-related package code:

Rem0o commented 3 months ago

CtlLibraryCSharpWrapper.zip

Will be hard to debug this from FanControl.

Made a simple console app that goes through the process of loading the CtlLibrary and testing its features. Code is here: https://github.com/Rem0o/drivers.gpu.control-library.bindings/blob/master/CtlLibraryCSharpWrapper/Program.cs

If you could run the exe and tell me how far it goes, would help.

characharm commented 3 months ago

image

Rem0o commented 3 months ago

It just get stuck there? No exception, no throws, nothing?

characharm commented 3 months ago

It does nothing, and after a minute, the program closes on its own.

Rem0o commented 3 months ago

In my case as I don't have the drivers, I get the following: image

characharm commented 3 months ago

Faulting application name: CtlLibraryCSharpWrapper.exe, version: 1.0.0.0, timestamp: 0x65cd0000 Faulting module name: coreclr.dll, version: 8.0.324.11423, timestamp: 0x65cd500d Exception code: 0xc0000005 Fault offset: 0x00000000001cc972 Faulting process ID: 0x4D34 Faulting application start time: 0x1DA86C71BBECDFB Faulting application path: S:\LocalLLMA\Vulkan\fan\CtlLibraryCSharpWrapper.exe Faulting module path: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.3\coreclr.dll Report ID: ca6cfd82-623c-45ff-a135-bb90044a4bab Faulting package full name: Faulting application-related package code:

Rem0o commented 3 months ago

We could go back and forth, but ideally can you compile and do a bit of troubleshooting on your side? I guess you have the latest intel driver installed?

IGCL binaries are distributed as part of Intel Graphics driver package.

characharm commented 3 months ago

I guess you have the latest intel driver installed?

ofc

can you compile and do a bit of troubleshooting on your side?

The environment for sharp and SWIG is not configured... tbh, I don't want to mess with it for now. Sorry.

Rem0o commented 3 months ago

The environment for sharp and SWIG is not configured... tbh, I don't want to mess with it for now. Sorry.

Alright, well thanks for your help. Won't get far by myself on this until I get a ARC 770.

Rem0o commented 3 months ago

@characharm CtlLibraryCSharpWrapper.exe.zip

Last hail mary, made a .NET Framework 4.X version instead, if .NET 8 C++ interop is broken somehow with swig.

characharm commented 3 months ago

@characharm CtlLibraryCSharpWrapper.exe.zip

Last hail mary, made a .NET Framework 4.X version instead, if .NET 8 C++ interop is broken somehow with swig. PS S:\LocalLLMA\Vulkan\fan> .\CtlLibraryCSharpWrapper.exe RESETTING TO DEFAULT

Unhandled exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at CtlLibraryBindings.CtlLibraryPINVOKE.ctlClose(HandleRef jarg1) at Program.

d__0.MoveNext() in C:\Users\remme\Documents\Github\drivers.gpu.control-library.bindings\CtlLibraryCSharpWrapper\Program.cs:line 62 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Threading.Tasks.Task.DelayPromise.Complete() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.TimerQueueTimer.CallCallback() at System.Threading.TimerQueueTimer.Fire() at System.Threading.TimerQueue.FireNextTimers()

characharm commented 3 months ago

image sigh xD

Rem0o commented 3 months ago

Ahhh but we got further. I found why it failed at the close, but did you get anything in the command line? Any text? Any readings? Anything?

characharm commented 3 months ago

Ahhh but we got further. I found why it failed at the close, but did you get anything in the command line? Any text? Any readings? Anything?

only this RESETTING TO DEFAULT

Rem0o commented 3 months ago

Added more logs, my guess is no "Device" is found.

CtlLibraryCSharpWrapper.zip

characharm commented 3 months ago

PS S:\LocalLLMA\Vulkan\fan> .\CtlLibraryCSharpWrapper.exe Found 0 cards Found 0 fans

Rem0o commented 3 months ago

Well there's our issue. What GPU you got?

characharm commented 3 months ago

Well there's our issue. What GPU you got?

image

Rem0o commented 3 months ago

Do you got the full suite of intel bloatware driver thing? Can you control your fan from their software?

Rem0o commented 3 months ago

image

characharm commented 3 months ago

Yes, I have Arc Control installed, and I can control the cooler settings, as well as access all telemetry.

Rem0o commented 3 months ago

Noticed the samples must call enumeratedevice twice for the method to return the handles. Made some changes in that sense.

CtlLibraryCSharpWrapper.zip

characharm commented 3 months ago

image

Rem0o commented 3 months ago

@characharm did you run it as admin just in case? Otherwise I don't see what I'm doing wrong.

CtlInit works, but then listing the available devices returns nothing for some reason.

characharm commented 3 months ago

@characharm did you run it as admin just in case? Otherwise I don't see what I'm doing wrong.

CtlInit works, but then listing the available devices returns nothing for some reason.

I've tried using the console with administrator rights, right-clicking 'run as administrator,' unloading Arc Control, etc. Perhaps it's worth filing an issue on https://github.com/intel/drivers.gpu.control-library?

characharm commented 3 months ago

image

Rem0o commented 3 months ago

What driver version do you got?

characharm commented 3 months ago

What driver version do you got?

latest one from 3/29/2024, build version 101.5382

B-Lei commented 3 months ago

Just wanted to chime in that I see similar issues on my Arc A750 with latest drivers (31.0.101.5382). I'm not familiar with Windows development or C#, but I figured perhaps I could try compiling things.

First, I wanted to confirm that Intel's IGCL library is able to recognize my device and print fan settings through the bundled example, "Telemetry_Samples."

This was successful, see below for a partial output of Telemetry_Samples.exe using default "Fan Curve" configuration in Arc Control:

Adapter ID 65790 

Intel Adapter Name Intel(R) Arc(TM) A750 Graphics
Vendor id  0x8086
Device id 0x56A1
SubSys id 0x1021
SubSys Vendor id 0x8086
Rev id 0x8
Number of Power Handles [1]

<LINES OMITTED>

::::::::::::::Print Fan Properties::::::::::::::

Number of Fan Handles [1]

For Fan Handle [0]
[Fan] Fan get properties:
[Fan] Can Control [1]
[Fan] Max Points [10]
[Fan] Max RPM [-1]
[Fan] Supported Modes [2]
[Fan] Supported Units [1]
[Fan] Fan get Config:
[Fan] Fan Config Mode [2]
[Fan] Fan Config Fan Table NumPoints [6]
[Fan] Fan Config Fan Table Point Speed Unit [1]
[Fan] Fan Config Fan Table Point Speed [30]
[Fan] Fan Config Fan Table Point Temperature [25]
[Fan] Fan Config Fan Table Point Speed Unit [1]
[Fan] Fan Config Fan Table Point Speed [30]
[Fan] Fan Config Fan Table Point Temperature [40]
[Fan] Fan Config Fan Table Point Speed Unit [1]
[Fan] Fan Config Fan Table Point Speed [40]
[Fan] Fan Config Fan Table Point Temperature [55]
[Fan] Fan Config Fan Table Point Speed Unit [1]
[Fan] Fan Config Fan Table Point Speed [55]
[Fan] Fan Config Fan Table Point Temperature [70]
[Fan] Fan Config Fan Table Point Speed Unit [1]
[Fan] Fan Config Fan Table Point Speed [75]
[Fan] Fan Config Fan Table Point Temperature [85]
[Fan] Fan Config Fan Table Point Speed Unit [1]
[Fan] Fan Config Fan Table Point Speed [90]
[Fan] Fan Config Fan Table Point Temperature [100]
[Fan] Fan get state:
[Fan] Speed [794] RPM
[Fan] Speed [941] RPM
[Fan] Speed [941] RPM
[Fan] Speed [941] RPM
[Fan] Speed [941] RPM
[Fan] Speed [941] RPM
[Fan] Speed [941] RPM
[Fan] Speed [941] RPM
[Fan] Speed [941] RPM
[Fan] Speed [941] RPM

After that, I tried building drivers.gpu.control-library.bindings.

In order to run CtlLibrarySample.exe, I had to first manually copy this: drivers.gpu.control-library.bindings\x64\Debug\CtlLibraryCSharpBind.dll to same directory as the exe: drivers.gpu.control-library.bindings\CtlLibrarySample\bin\net48

Then I was able to run it. Unfortunately, running in cmd as Administrator, I see the same issue where no devices are seen:

.\CtlLibrarySample.exe
Found 0 cards
Found 0 fans

It also hangs afterwards, requiring me to forcibly close cmd.

If there's any changes you would like me to apply to drivers.gpu.control-library.bindings, I can try rebuilding and running the executable again when I have time.

Rem0o commented 3 months ago

In order to run CtlLibrarySample.exe, I had to first manually copy this: drivers.gpu.control-library.bindings\x64\Debug\CtlLibraryCSharpBind.dll to same directory as the exe: drivers.gpu.control-library.bindings\CtlLibrarySample\bin\net48

Added the missing copy post-build of the dll.

I gave the samples a good look, and I fail to see what I'm doing different, there ain't much to it.

It's a ctlinit, followed by the enumeration of the devices.

Rem0o commented 3 months ago

Update: I found a sneaky CTL_BIT(0) that I assumed to be 0, but it's actually 1. See https://github.com/Rem0o/drivers.gpu.control-library.bindings/commit/27894507f47b0ce089ce79a8df61a1e378e85814

characharm commented 3 months ago

Update: I found a sneaky CTL_BIT(0) that I assumed to be 0, but it's actually 1. See Rem0o/drivers.gpu.control-library.bindings@2789450

sadly, the behavior hasn't changed, I can also confirm that telemetry samples are working on my machine.

image

Could you consider adding the -ExecutionPolicy Bypass flag?

  <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
    <Exec Command="powershell.exe -ExecutionPolicy Bypass -File enum_uint.ps1" />
  </Target>
Rem0o commented 3 months ago

Could you consider adding the -ExecutionPolicy Bypass flag?

will do.

Rem0o commented 2 months ago

Compiled explicitly in x64 net48.zip

abrfilho commented 2 months ago

Compiled explicitly in x64 net48.zip

Hello, I'm new here. I tested the .exe as an administrator, returned 0 cards, 0 fans. I have an A770 from Acer. Is there anything I can do to help?

abrfilho commented 2 months ago

Now Fan Control loads the plugin (1.0.19) but doesn't detect any sensors from my GPU.

decafinthemorning commented 1 month ago

Hi, I have an Arc A770 and software dev experience, but no C# or Swig. I poked around with your test app and the telemetry samples and found some things out.

In Telemetry_Samples, when calling ctlEnumerateDevices the devices passed is a nullptr: https://github.com/intel/drivers.gpu.control-library/blob/master/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp#L1660. In your .bindings repo when calling CtlLibrary.ctlEnumerateDevices I replaced emptyDeviceArray.Value.cast() with null, and with that change my card and fan were discovered.

The next issue is that a lot of the structs have a Size member that needs to be set. Maybe there's a better way than this, but how I handled it with Swig was to add things like below into CtlLibraryCSharpBinds\CtlLibraryCSharpBind.i. Then I would call those to set the Size members. Not doing that would result in CTL_RESULT_ERROR_INVALID_SIZE.

%inline %{
  int sizeofSpeed() {
    return sizeof(ctl_fan_speed_t);
  }
%}

With those changes, I've been able to read the current RPM and temperature values. However, I'm getting CTL_RESULT_ERROR_UNSUPPORTED_FEATURE when I try to set a fixed fan speed with either RPM or percent. I can set a speed table, but it doesn't seem to actually do anything.

I'm not sure how much time I can spend on this for the next couple weeks, but hopefully either I can, or someone else can start with these notes and make progress where I got stuck.

Rem0o commented 1 month ago

For the size thing:

%define %setSizeInCtor(TYPE1)
%extend TYPE1 {
    TYPE1() {

        TYPE1* result = (TYPE1 *)new TYPE1();
        result->Size = sizeof(TYPE1);

        return result;
    }
}
%enddef

%setSizeInCtor(_ctl_fan_speed_t);
%setSizeInCtor(_ctl_temp_properties_t);

This should be used for all the structs created from the C# side, will set the size automatically.

WIll change the emptyArrayPtr to null everywhere we enumerate stuff. I guess that second enumerate call is fine with the array?

decafinthemorning commented 1 month ago

Thanks, that is a tidier way of handling Size and I can confirm it works.

Yes, the second enumerate call works as you had it. I just tried replacing emptyDeviceArray with an array that has 1 element, to match what gets passed to the second. That gave me 0 cards, so it seems like there's some initialization that happens when you pass null the first time.

The ctlEnumFans does work with an empty array being passed, but it works the same with null so it maybe doesn't hurt to always pass null the first time, when getting the count.

Rem0o commented 1 month ago

@decafinthemorning see https://github.com/Rem0o/drivers.gpu.control-library.bindings/commit/27429366b7b92ab61fcf8ad1706914af24f7bf25

abrfilho commented 3 weeks ago

1.0.22 returns here "IntelCtlLibrary could not initialize or has no sensors."