Open characharm opened 3 months ago
Will be net 8 version only for now. Pushed a commit, try the new build.
Did you put "CtlLibraryCSharpBind.dll" in your plugin folder also? Not just the plugin's dll ?
CtlLibraryCSharpBind.dll
I suspect that this library is not in the archive
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.
The program crashes without any error messages or entries in the log
Nothing even in EventViewer?
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:
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.
It just get stuck there? No exception, no throws, nothing?
It does nothing, and after a minute, the program closes on its own.
In my case as I don't have the drivers, I get the following:
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:
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.
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.
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.
@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 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.
sigh xD
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?
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
Added more logs, my guess is no "Device" is found.
PS S:\LocalLLMA\Vulkan\fan> .\CtlLibraryCSharpWrapper.exe Found 0 cards Found 0 fans
Well there's our issue. What GPU you got?
Well there's our issue. What GPU you got?
Do you got the full suite of intel bloatware driver thing? Can you control your fan from their software?
Yes, I have Arc Control installed, and I can control the cooler settings, as well as access all telemetry.
Noticed the samples must call enumeratedevice twice for the method to return the handles. Made some changes in that sense.
@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 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?
What driver version do you got?
What driver version do you got?
latest one from 3/29/2024, build version 101.5382
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.
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.
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
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.
Could you consider adding the -ExecutionPolicy Bypass flag?
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Bypass -File enum_uint.ps1" />
</Target>
Could you consider adding the -ExecutionPolicy Bypass flag?
will do.
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?
Now Fan Control loads the plugin (1.0.19) but doesn't detect any sensors from my GPU.
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.
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?
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.
1.0.22 returns here "IntelCtlLibrary could not initialize or has no sensors."
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)