First commit.
[temp2RGB.git] / TODO.md
1 * Add the support for A770 RGB
2
3 [ok] Add parameters "--install-service" and "--uninstall-service", see: https://github.com/mullvad/windows-service-rs/blob/main/examples/install_service.rs
4 [ok] Add a parameter (using clap) "--no-service" to run it without the service system
5 [ok] Create the service and test it
6 [ok] * Implement RGB for RAM:
7   * Use the same approach of OpenRGB by using https://github.com/GermanAizek/WinRing0
8 [ok]  How to read temperature of GPU + CPU ? : https://github.com/GermanAizek/WinRing0 (Replace managing a ring0 driver and calling 'DeviceIoControl' manually)
9 [ok] Assign color to:
10     * Graphic card
11     * MB: "ASUS ROG STRIX B650E-I GAMING WIFI", Location:
12         * LED Strips
13         * AIO Pump
14     * RAM : "Corsair Dominator Platinum"?
15 [ok] Define how GPU + CPU temperature are combined
16 [ok] Define update/polling rate (1s ?)
17 [ok] Define filtering function (moving average) 10s kernel size?
18 [ok] Set the exe as service or start it at startup
19
20
21 Temp = (CPU + GPU) / 2
22 Colors [R,G,B]
23 Cold: [0, 255, 40]: (55 + 44) / 2 = 50°C
24 Hot: [255, 0, 0]: (75 + 85) / 2 = 80°C
25
26
27 Get-WmiObject -query "SELECT * FROM Win32_PnPSignedDriver" > output_PnPSignedDriver.txt
28 Get-WmiObject -query "SELECT * FROM Win32_PnPAllocatedResource" > output_PnPAllocatedResource.txt
29
30
31 Intel(R) NF I2C Host Controller
32
33
34 \\?\C:\Users\gburri\Projects\temp2RGB\target\debug\WinRing0x64.sys
35
36 A770:
37 "\\\\?\\PCI#VEN_8086&DEV_56A0&SUBSYS_38881025&REV_08#6&1cb01252&0&00080009#{1ca05180-a699-450a-9a0c-de4fbe3ddd89}"
38
39
40   [return: MarshalAs(UnmanagedType.U1)]
41   internal static unsafe bool CVGAAdaptor\u002ESetLEDColor(
42     [In] CVGAAdaptor* obj0,
43     byte nArea,
44     byte r,
45     byte g,
46     byte b)
47   {
48     \u0024ArrayType\u0024\u0024\u0024BY08E arrayTypeBy08E;
49     // ISSUE: cast to a reference type
50     // ISSUE: explicit reference operation
51     ^(sbyte&) ref arrayTypeBy08E = (sbyte) 7;
52     // ISSUE: cast to a reference type
53     // ISSUE: explicit reference operation
54     ^(sbyte&) ((IntPtr) &arrayTypeBy08E + 1) = (sbyte) 7;
55     // ISSUE: cast to a reference type
56     // ISSUE: explicit reference operation
57     ^(sbyte&) ((IntPtr) &arrayTypeBy08E + 2) = (sbyte) nArea;
58     // ISSUE: cast to a reference type
59     // ISSUE: explicit reference operation
60     ^(sbyte&) ((IntPtr) &arrayTypeBy08E + 3) = (sbyte) r;
61     // ISSUE: cast to a reference type
62     // ISSUE: explicit reference operation
63     ^(sbyte&) ((IntPtr) &arrayTypeBy08E + 4) = (sbyte) g;
64     // ISSUE: cast to a reference type
65     // ISSUE: explicit reference operation
66     ^(sbyte&) ((IntPtr) &arrayTypeBy08E + 5) = (sbyte) b;
67     // ISSUE: cast to a reference type
68     // ISSUE: explicit reference operation
69     ^(sbyte&) ((IntPtr) &arrayTypeBy08E + 6) = (sbyte) 0;
70     // ISSUE: cast to a reference type
71     // ISSUE: explicit reference operation
72     ^(sbyte&) ((IntPtr) &arrayTypeBy08E + 7) = (sbyte) 0;
73     // ISSUE: cast to a reference type
74     // ISSUE: explicit reference operation
75     ^(sbyte&) ((IntPtr) &arrayTypeBy08E + 8) = (sbyte) 0;
76     ulong num1 = 9;
77     \u0024ArrayType\u0024\u0024\u0024BY08E* arrayTypeBy08EPtr1 = &\u003CModule\u003E.\u003FA0x171ed149\u002E\u003FprevData\u0040\u003F1\u003F\u003FSetLEDColor\u0040CVGAAdaptor\u0040\u0040UEAA_NEEEE\u0040Z\u00404PAEA;
78     \u0024ArrayType\u0024\u0024\u0024BY08E* arrayTypeBy08EPtr2 = &arrayTypeBy08E;
79     byte num2 = 7;
80     // ISSUE: cast to a reference type
81     // ISSUE: explicit reference operation
82     byte num3 = ^(byte&) ref \u003CModule\u003E.\u003FA0x171ed149\u002E\u003FprevData\u0040\u003F1\u003F\u003FSetLEDColor\u0040CVGAAdaptor\u0040\u0040UEAA_NEEEE\u0040Z\u00404PAEA;
83     // ISSUE: cast to a reference type
84     // ISSUE: explicit reference operation
85     if ((byte) 7 >= ^(byte&) ref \u003CModule\u003E.\u003FA0x171ed149\u002E\u003FprevData\u0040\u003F1\u003F\u003FSetLEDColor\u0040CVGAAdaptor\u0040\u0040UEAA_NEEEE\u0040Z\u00404PAEA)
86     {
87       while ((uint) num2 <= (uint) num3)
88       {
89         if (num1 == 1UL)
90           return true;
91         --num1;
92         ++arrayTypeBy08EPtr2;
93         ++arrayTypeBy08EPtr1;
94         num2 = *(byte*) arrayTypeBy08EPtr2;
95         num3 = *(byte*) arrayTypeBy08EPtr1;
96         if ((uint) num2 < (uint) num3)
97           break;
98       }
99     }
100     \u003CModule\u003E.\u003FA0x171ed149\u002E\u003FprevData\u0040\u003F1\u003F\u003FSetLEDColor\u0040CVGAAdaptor\u0040\u0040UEAA_NEEEE\u0040Z\u00404PAEA = arrayTypeBy08E;
101     \u003CModule\u003E.CVGAAdaptor\u002ELogData(obj0, (sbyte*) &\u003CModule\u003E.\u003F\u003F_C\u0040_0BB\u0040MOBGKECJ\u0040Fake\u003F5I2C_Write\u003F3\u003F5\u0040, (byte*) &arrayTypeBy08E, 9);
102     return true;
103   }
104
105    [return: MarshalAs(UnmanagedType.U1)]
106   internal static unsafe bool CVGAAdaptorIntel\u002EI2C_Write(
107     [In] CVGAAdaptorIntel* obj0,
108     int nOffset,
109     byte* pData,
110     int nDataSize,
111     [MarshalAs(UnmanagedType.U1)] bool bOutputDebug)
112   {
113     if (*(long*) ((IntPtr) obj0 + 1256L) == -1L && !\u003CModule\u003E.CVGAAdaptorIntel\u002EI2C_OpenDevice(obj0))
114       return false;
115     \u0024ArrayType\u0024\u0024\u0024BY0IA\u0040D arrayTypeBy0IaD;
116     if (!\u003CModule\u003E.CVGAAdaptorIntel\u002EI2C_OpenTarget(obj0))
117     {
118       \u003CModule\u003E.sprintf_s((sbyte*) &arrayTypeBy0IaD, 128UL, (sbyte*) &\u003CModule\u003E.\u003F\u003F_C\u0040_0CO\u0040GJJFMHGA\u0040DeviceIoControl\u003F\u0024CI\u003F\u0024CJ\u003F5to\u003F5devcie\u003F5FAI\u0040, __arglist ((int) \u003CModule\u003E.GetLastError()));
119       \u003CModule\u003E.OutputDebugStringA((sbyte*) &arrayTypeBy0IaD);
120     }
121     if (bOutputDebug)
122       \u003CModule\u003E.CVGAAdaptor\u002ELogData((CVGAAdaptor*) obj0, (sbyte*) &\u003CModule\u003E.\u003F\u003F_C\u0040_0M\u0040DGLNBELN\u0040I2C_Write\u003F3\u003F5\u0040, pData, nDataSize);
123     int num = \u003CModule\u003E.CVGAAdaptorIntel\u002EI2C_WriteTarget(obj0, pData, nDataSize) ? 1 : 0;
124     if (num == 0)
125     {
126       \u003CModule\u003E.sprintf_s((sbyte*) &arrayTypeBy0IaD, 128UL, (sbyte*) &\u003CModule\u003E.\u003F\u003F_C\u0040_0CI\u0040FFLBFBLK\u0040WriteFile\u003F\u0024CI\u003F\u0024CJ\u003F5to\u003F5devcie\u003F5FAILED\u003F4\u003F5h\u0040, __arglist ((int) \u003CModule\u003E.GetLastError()));
127       \u003CModule\u003E.OutputDebugStringA((sbyte*) &arrayTypeBy0IaD);
128     }
129     \u003CModule\u003E.CVGAAdaptorIntel\u002EI2C_CloseTarget(obj0);
130     return num != 0;
131   }
132
133
134
135 __GENUS                 : 2
136 __CLASS                 : Win32_PnPSignedDriver
137 __SUPERCLASS            : CIM_Service
138 __DYNASTY               : CIM_ManagedSystemElement
139 __RELPATH               :
140 __PROPERTY_COUNT        : 28
141 __DERIVATION            : {CIM_Service, CIM_LogicalElement, CIM_ManagedSystemElement}
142 __SERVER                : SMOL-WHITE
143 __NAMESPACE             : root\cimv2
144 __PATH                  :
145 Caption                 :
146 ClassGuid               : {4d36e97d-e325-11ce-bfc1-08002be10318}
147 CompatID                : INTC#I2C
148 CreationClassName       :
149 Description             : Intel(R) NF I2C Host Controller
150 DeviceClass             : SYSTEM
151 DeviceID                : DISPLAY\INTC_I2C\7&3255D98A&0&UID26040
152 DeviceName              : Intel(R) NF I2C Host Controller
153 DevLoader               :
154 DriverDate              : 20220203000000.******+***
155 DriverName              :
156 DriverProviderName      : Intel Corporation
157 DriverVersion           : 31.100.2210.1
158 FriendlyName            :
159 HardWareID              : VIDEO\VEN_8086&DEV_56A0&SUBSYS_38881025&REV_08&INTC_I2C
160 InfName                 : oem6.inf
161 InstallDate             :
162 IsSigned                : True
163 Location                :
164 Manufacturer            : Intel Corporation
165 Name                    :
166 PDO                     : \Device\00000078
167 Signer                  : Microsoft Windows Hardware Compatibility Publisher
168 Started                 :
169 StartMode               :
170 Status                  :
171 SystemCreationClassName :
172 SystemName              :
173 PSComputerName          : SMOL-WHITE