diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/Control.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/Control.cs new file mode 100644 index 0000000..e650d52 --- /dev/null +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/Control.cs @@ -0,0 +1,13 @@ +namespace LibreHardwareMonitor.Hardware.Motherboard; + +internal class Control +{ + public readonly int Index; + public readonly string Name; + + public Control(string name, int index) + { + Name = name; + Index = index; + } +} diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/Fan.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/Fan.cs new file mode 100644 index 0000000..6beec4a --- /dev/null +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/Fan.cs @@ -0,0 +1,13 @@ +namespace LibreHardwareMonitor.Hardware.Motherboard; + +internal class Fan +{ + public readonly int Index; + public readonly string Name; + + public Fan(string name, int index) + { + Name = name; + Index = index; + } +} \ No newline at end of file diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/Chip.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/Chip.cs index 3a96082..b929eb9 100644 --- a/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/Chip.cs +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/Chip.cs @@ -76,7 +76,9 @@ internal enum Chip : ushort W83627THF = 0x8280, W83667HG = 0xA510, W83667HGB = 0xB350, - W83687THF = 0x8541 + W83687THF = 0x8541, + + IPMI = 0x4764, } internal class ChipName @@ -148,6 +150,8 @@ internal class ChipName case Chip.W83667HGB: return "Winbond W83667HG-B"; case Chip.W83687THF: return "Winbond W83687THF"; + case Chip.IPMI: return "IPMI"; + default: return "Unknown"; } } diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/Ipmi.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/Ipmi.cs new file mode 100644 index 0000000..f4a8735 --- /dev/null +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/Ipmi.cs @@ -0,0 +1,328 @@ +// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// Copyright (C) LibreHardwareMonitor and Contributors. +// All Rights Reserved. + +using System; +using System.Collections.Generic; +using System.Management; +using System.Runtime.InteropServices; +using System.Text; + +namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc; + +internal class Ipmi : ISuperIO +{ + // ReSharper disable InconsistentNaming + private const byte COMMAND_FAN_LEVEL = 0x70; + private const byte COMMAND_FAN_MODE = 0x45; + private const byte COMMAND_GET_SDR = 0x23; + private const byte COMMAND_GET_SDR_REPOSITORY_INFO = 0x20; + private const byte COMMAND_GET_SENSOR_READING = 0x2d; + + private const byte FAN_MODE_FULL = 0x01; + private const byte FAN_MODE_OPTIMAL = 0x02; + + private const byte NETWORK_FUNCTION_SENSOR_EVENT = 0x04; + private const byte NETWORK_FUNCTION_STORAGE = 0x0a; + private const byte NETWORK_FUNCTION_SUPERMICRO = 0x30; + // ReSharper restore InconsistentNaming + + private readonly List _controlNames = new(); + private readonly List _controls = new(); + private readonly List _fanNames = new(); + private readonly List _fans = new(); + + private readonly ManagementObject _ipmi; + private readonly Manufacturer _manufacturer; + + private readonly List _sdr = new(); + private readonly List _temperatureNames = new(); + private readonly List _temperatures = new(); + private readonly List _voltageNames = new(); + private readonly List _voltages = new(); + + private bool _touchedFans; + + public Ipmi(Manufacturer manufacturer) + { + Chip = Chip.IPMI; + _manufacturer = manufacturer; + + using ManagementClass ipmiClass = new("root\\WMI", "Microsoft_IPMI", null); + + foreach (ManagementBaseObject ipmi in ipmiClass.GetInstances()) + { + if (ipmi is ManagementObject managementObject) + _ipmi = managementObject; + } + + // Fan control is exposed for Supermicro only as it differs between IPMI implementations + if (_manufacturer == Manufacturer.Supermicro) + { + _controlNames.Add("CPU Fan"); + _controlNames.Add("System Fan"); + } + + // Perform an early update to count the number of sensors and get their names + Update(); + + Controls = new float?[_controls.Count]; + Fans = new float?[_fans.Count]; + Temperatures = new float?[_temperatures.Count]; + Voltages = new float?[_voltages.Count]; + } + + public Chip Chip { get; } + + public float?[] Controls { get; } + + public float?[] Fans { get; } + + public float?[] Temperatures { get; } + + public float?[] Voltages { get; } + + public string GetReport() + { + StringBuilder sb = new(); + Update(sb); + return sb.ToString(); + } + + public void SetControl(int index, byte? value) + { + if (_manufacturer == Manufacturer.Supermicro) + { + if (value != null || _touchedFans) + { + _touchedFans = true; + + if (value == null) + { + RunIPMICommand(COMMAND_FAN_MODE, NETWORK_FUNCTION_SUPERMICRO, new byte[] { 0x01 /* Set */, FAN_MODE_OPTIMAL }); + } + else + { + byte[] fanMode = RunIPMICommand(COMMAND_FAN_MODE, NETWORK_FUNCTION_SUPERMICRO, new byte[] { 0x00 }); + if (fanMode.Length < 2 || fanMode[0] != 0 || fanMode[1] != FAN_MODE_FULL) + { + RunIPMICommand(COMMAND_FAN_MODE, NETWORK_FUNCTION_SUPERMICRO, new byte[] { 0x01 /* Set */, FAN_MODE_FULL }); + } + + float speed = (float)value / 255.0f * 100.0f; + RunIPMICommand(COMMAND_FAN_LEVEL, NETWORK_FUNCTION_SUPERMICRO, new byte[] { 0x66, 0x01 /* Set */, (byte)index, (byte)speed }); + } + } + } + else + { + throw new NotImplementedException(); + } + } + + public void Update() + { + Update(null); + } + + private unsafe void Update(StringBuilder stringBuilder) + { + _fans.Clear(); + _temperatures.Clear(); + _voltages.Clear(); + _controls.Clear(); + + if (_sdr.Count == 0 || stringBuilder != null) + { + byte[] sdrInfo = RunIPMICommand(COMMAND_GET_SDR_REPOSITORY_INFO, NETWORK_FUNCTION_STORAGE, new byte[] { }); + if (sdrInfo[0] == 0) + { + int recordCount = sdrInfo[3] * 256 + sdrInfo[2]; + + byte recordLower = 0; + byte recordUpper = 0; + for (int i = 0; i < recordCount; ++i) + { + byte[] sdrRaw = RunIPMICommand(COMMAND_GET_SDR, NETWORK_FUNCTION_STORAGE, new byte[] { 0, 0, recordLower, recordUpper, 0, 0xff }); + if (sdrRaw[0] == 0 && sdrRaw.Length >= 3) + { + recordLower = sdrRaw[1]; + recordUpper = sdrRaw[2]; + + Interop.Ipmi.Sdr sdr; + + fixed (byte* pSdr = sdrRaw) + { + sdr = (Interop.Ipmi.Sdr)Marshal.PtrToStructure((IntPtr)pSdr + 3, typeof(Interop.Ipmi.Sdr)); + } + + _sdr.Add(sdr); + + stringBuilder?.AppendLine("IPMI sensor " + i + " num: " + sdr.sens_num + " info: " + BitConverter.ToString(sdrRaw).Replace("-", "")); + } + else + { + break; + } + } + } + } + + foreach (Interop.Ipmi.Sdr sdr in _sdr) + { + if (sdr.rectype == 1) + { + byte[] reading = RunIPMICommand(COMMAND_GET_SENSOR_READING, NETWORK_FUNCTION_SENSOR_EVENT, new[] { sdr.sens_num }); + + if (reading[0] == 0) + { + switch (sdr.sens_type) + { + case 1: + _temperatures.Add(RawToFloat(reading[1], sdr)); + if (Temperatures.Length == 0) + _temperatureNames.Add(sdr.id_string.Replace(" Temp", "")); + + break; + + case 2: + _voltages.Add(RawToFloat(reading[1], sdr)); + if (Voltages.Length == 0) + _voltageNames.Add(sdr.id_string); + + break; + + case 4: + _fans.Add(RawToFloat(reading[1], sdr)); + if (Fans.Length == 0) + _fanNames.Add(sdr.id_string); + + break; + } + } + + stringBuilder?.AppendLine("IPMI sensor num: " + sdr.sens_num + " reading: " + BitConverter.ToString(reading).Replace("-", "")); + } + } + + if (_manufacturer == Manufacturer.Supermicro) + { + for (int i = 0; i < _controlNames.Count; ++i) + { + byte[] fanLevel = RunIPMICommand(COMMAND_FAN_LEVEL, NETWORK_FUNCTION_SUPERMICRO, new byte[] { 0x66, 0x00 /* Get */, (byte)i }); + if (fanLevel[0] == 0 && fanLevel.Length >= 2) + _controls.Add(fanLevel[1]); + + stringBuilder?.AppendLine("IPMI fan " + i + ": " + BitConverter.ToString(fanLevel).Replace("-", "")); + } + } + + for (int i = 0; i < Math.Min(_temperatures.Count, Temperatures.Length); ++i) + Temperatures[i] = _temperatures[i]; + + for (int i = 0; i < Math.Min(_voltages.Count, Voltages.Length); ++i) + Voltages[i] = _voltages[i]; + + for (int i = 0; i < Math.Min(_fans.Count, Fans.Length); ++i) + Fans[i] = _fans[i]; + + for (int i = 0; i < Math.Min(_controls.Count, Controls.Length); ++i) + Controls[i] = _controls[i]; + } + + public IEnumerable GetTemperatures() + { + for (int i = 0; i < _temperatureNames.Count; i++) + yield return new Temperature(_temperatureNames[i], i); + } + + public IEnumerable GetFans() + { + for (int i = 0; i < _fanNames.Count; i++) + yield return new Fan(_fanNames[i], i); + } + + public IEnumerable GetVoltages() + { + for (int i = 0; i < _voltageNames.Count; i++) + yield return new Voltage(_voltageNames[i], i); + } + + public IEnumerable GetControls() + { + for (int i = 0; i < _controlNames.Count; i++) + yield return new Control(_controlNames[i], i); + } + + public static bool IsBmcPresent() + { + try + { + using ManagementObjectSearcher searcher = new("root\\WMI", "SELECT * FROM Microsoft_IPMI WHERE Active='True'"); + return searcher.Get().Count > 0; + } + catch + { + return false; + } + } + + public byte? ReadGpio(int index) + { + return null; + } + + public void WriteGpio(int index, byte value) + { } + + private byte[] RunIPMICommand(byte command, byte networkFunction, byte[] requestData) + { + using ManagementBaseObject inParams = _ipmi.GetMethodParameters("RequestResponse"); + + inParams["NetworkFunction"] = networkFunction; + inParams["Lun"] = 0; + inParams["ResponderAddress"] = 0x20; + inParams["Command"] = command; + inParams["RequestDataSize"] = requestData.Length; + inParams["RequestData"] = requestData; + + using ManagementBaseObject outParams = _ipmi.InvokeMethod("RequestResponse", inParams, null); + return (byte[])outParams["ResponseData"]; + } + + // Ported from ipmiutil + // Bare minimum to read Supermicro X13 IPMI sensors, may need expanding for other boards + private static float RawToFloat(byte sensorReading, Interop.Ipmi.Sdr sdr) + { + double reading = sensorReading; + + int m = sdr.m + ((sdr.m_t & 0xc0) << 2); + if (Convert.ToBoolean(m & 0x0200)) + m -= 0x0400; + + int b = sdr.b + ((sdr.b_a & 0xc0) << 2); + if (Convert.ToBoolean(b & 0x0200)) + b -= 0x0400; + + int rx = (sdr.rx_bx & 0xf0) >> 4; + if (Convert.ToBoolean(rx & 0x08)) + rx -= 0x10; + + int bExp = sdr.rx_bx & 0x0f; + if (Convert.ToBoolean(bExp & 0x08)) + bExp -= 0x10; + + if ((sdr.sens_units & 0xc0) != 0) + reading = Convert.ToBoolean(sensorReading & 0x80) ? sensorReading - 0x100 : sensorReading; + + reading *= m; + reading += b * Math.Pow(10, bExp); + reading *= Math.Pow(10, rx); + + if (sdr.linear != 0) + throw new NotImplementedException(); + + return (float)reading; + } +} diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/LpcIO.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/LpcIO.cs index 7507eb6..9d72205 100644 --- a/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/LpcIO.cs +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/LpcIO.cs @@ -26,6 +26,9 @@ internal class LpcIO Detect(motherboard); Ring0.ReleaseIsaBusMutex(); + + if (Ipmi.IsBmcPresent()) + _superIOs.Add(new Ipmi(motherboard.Manufacturer)); } public ISuperIO[] SuperIO => _superIOs.ToArray(); diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/Motherboard.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/Motherboard.cs index 61024d0..5928813 100644 --- a/LibreHardwareMonitorLib/Hardware/Motherboard/Motherboard.cs +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/Motherboard.cs @@ -1,7 +1,7 @@ // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // Copyright (C) LibreHardwareMonitor and Contributors. -// Partial Copyright (C) Michael Möller and Contributors. +// Partial Copyright (C) Michael Möller and Contributors. // All Rights Reserved. using System; diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/SuperIOHardware.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/SuperIOHardware.cs index 7df53bc..e67db7b 100644 --- a/LibreHardwareMonitorLib/Hardware/Motherboard/SuperIOHardware.cs +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/SuperIOHardware.cs @@ -39,7 +39,7 @@ internal sealed class SuperIOHardware : Hardware out IList v, out IList t, out IList f, - out IList c, + out IList c, out _readVoltage, out _readTemperature, out _readFan, @@ -63,15 +63,15 @@ internal sealed class SuperIOHardware : Hardware get { return _motherboard; } } - private void CreateControlSensors(ISuperIO superIO, ISettings settings, IList c) + private void CreateControlSensors(ISuperIO superIO, ISettings settings, IList c) { - foreach (Ctrl ctrl in c) + foreach (Control ctrl in c) { int index = ctrl.Index; if (index < superIO.Controls.Length) { Sensor sensor = new(ctrl.Name, index, SensorType.Control, this, settings); - Control control = new(sensor, settings, 0, 100); + LibreHardwareMonitor.Hardware.Control control = new(sensor, settings, 0, 100); control.ControlModeChanged += cc => { switch (cc.ControlMode) @@ -114,7 +114,7 @@ internal sealed class SuperIOHardware : Hardware } } - private static byte GetSoftwareValueAsByte(Control control) + private static byte GetSoftwareValueAsByte(LibreHardwareMonitor.Hardware.Control control) { const float percentToByteRatio = 2.55f; float value = control.SoftwareValue * percentToByteRatio; @@ -184,7 +184,7 @@ internal sealed class SuperIOHardware : Hardware out IList v, out IList t, out IList f, - out IList c, + out IList c, out ReadValueDelegate readVoltage, out ReadValueDelegate readTemperature, out ReadValueDelegate readFan, @@ -203,7 +203,7 @@ internal sealed class SuperIOHardware : Hardware v = new List(); t = new List(); f = new List(); - c = new List(); + c = new List(); switch (superIO.Chip) { @@ -288,8 +288,8 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Auxiliary Fan", 2)); - c.Add(new Ctrl("Fan 1", 0)); - c.Add(new Ctrl("Fan 2", 1)); + c.Add(new Control("Fan 1", 0)); + c.Add(new Control("Fan 2", 1)); break; case Chip.W83627THF: @@ -307,9 +307,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Auxiliary Fan", 2)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; case Chip.NCT6771F: @@ -336,7 +336,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -371,12 +371,12 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Chassis Fan #1", 4)); f.Add(new Fan("MOS Fan #1", 5)); - c.Add(new Ctrl("CPU Fan #1", 0)); - c.Add(new Ctrl("Chassis Fan #4", 1)); - c.Add(new Ctrl("CPU Fan #2", 2)); - c.Add(new Ctrl("Chassis Fan #2", 3)); - c.Add(new Ctrl("Chassis Fan #1", 4)); - c.Add(new Ctrl("MOS Fan #1", 5)); + c.Add(new Control("CPU Fan #1", 0)); + c.Add(new Control("Chassis Fan #4", 1)); + c.Add(new Control("CPU Fan #2", 2)); + c.Add(new Control("Chassis Fan #2", 3)); + c.Add(new Control("Chassis Fan #1", 4)); + c.Add(new Control("MOS Fan #1", 5)); break; default: v.Add(new Voltage("+12V", 0)); @@ -411,17 +411,35 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #5", 6)); f.Add(new Fan("System Fan #6", 7)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("Pump Fan", 1)); - c.Add(new Ctrl("System Fan #1", 2)); - c.Add(new Ctrl("System Fan #2", 3)); - c.Add(new Ctrl("System Fan #3", 4)); - c.Add(new Ctrl("System Fan #4", 5)); - c.Add(new Ctrl("System Fan #5", 6)); - c.Add(new Ctrl("System Fan #6", 7)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("Pump Fan", 1)); + c.Add(new Control("System Fan #1", 2)); + c.Add(new Control("System Fan #2", 3)); + c.Add(new Control("System Fan #3", 4)); + c.Add(new Control("System Fan #4", 5)); + c.Add(new Control("System Fan #5", 6)); + c.Add(new Control("System Fan #6", 7)); break; } + + break; + + case Chip.IPMI: + Ipmi ipmi = (Ipmi)superIO; + + foreach (Temperature temperature in ipmi.GetTemperatures()) + t.Add(temperature); + + foreach (Fan fan in ipmi.GetFans()) + f.Add(fan); + + foreach (Voltage voltage in ipmi.GetVoltages()) + v.Add(voltage); + + foreach (Control control in ipmi.GetControls()) + c.Add(control); + break; default: @@ -430,7 +448,7 @@ internal sealed class SuperIOHardware : Hardware } } - private static void GetDefaultConfiguration(ISuperIO superIO, ICollection v, ICollection t, ICollection f, ICollection c) + private static void GetDefaultConfiguration(ISuperIO superIO, ICollection v, ICollection t, ICollection f, ICollection c) { for (int i = 0; i < superIO.Voltages.Length; i++) v.Add(new Voltage("Voltage #" + (i + 1), i, true)); @@ -442,7 +460,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); } private static void GetIteConfigurationsA @@ -453,7 +471,7 @@ internal sealed class SuperIOHardware : Hardware IList v, IList t, IList f, - ICollection c, + ICollection c, ref ReadValueDelegate readFan, ref UpdateDelegate postUpdate, ref Mutex mutex) @@ -549,7 +567,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan 6", 5)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -571,7 +589,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -671,7 +689,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -806,9 +824,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #1", 1)); f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("Power Fan", 4)); - c.Add(new Ctrl("PWM #1", 0)); - c.Add(new Ctrl("PWM #2", 1)); - c.Add(new Ctrl("PWM #3", 2)); + c.Add(new Control("PWM #1", 0)); + c.Add(new Control("PWM #2", 1)); + c.Add(new Control("PWM #3", 2)); break; @@ -898,7 +916,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -923,7 +941,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -1003,7 +1021,7 @@ internal sealed class SuperIOHardware : Hardware } } - private static void GetIteConfigurationsB(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) + private static void GetIteConfigurationsB(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) { switch (manufacturer) { @@ -1031,7 +1049,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Chassis Fan #2", 2)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + i, i)); + c.Add(new Control("Fan #" + i, i)); break; @@ -1053,7 +1071,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -1097,7 +1115,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -1153,8 +1171,8 @@ internal sealed class SuperIOHardware : Hardware t.Add(new Temperature("System", 0)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan", 1)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan", 1)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan", 1)); break; @@ -1181,8 +1199,8 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("System Fan", 1)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan", 1)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan", 1)); break; @@ -1232,7 +1250,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -1257,7 +1275,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -1285,11 +1303,11 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("System Fan #3", 3)); f.Add(new Fan("CPU Optional Fan", 4)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan #1", 1)); - c.Add(new Ctrl("System Fan #2", 2)); - c.Add(new Ctrl("System Fan #3", 3)); - c.Add(new Ctrl("CPU Optional Fan", 4)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan #1", 1)); + c.Add(new Control("System Fan #2", 2)); + c.Add(new Control("System Fan #3", 3)); + c.Add(new Control("CPU Optional Fan", 4)); break; @@ -1314,11 +1332,11 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("PCH Fan", 3)); f.Add(new Fan("CPU Optional Fan", 4)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan #1", 1)); - c.Add(new Ctrl("System Fan #2", 2)); - c.Add(new Ctrl("PCH Fan", 3)); - c.Add(new Ctrl("CPU Optional Fan", 4)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan #1", 1)); + c.Add(new Control("System Fan #2", 2)); + c.Add(new Control("PCH Fan", 3)); + c.Add(new Control("CPU Optional Fan", 4)); break; @@ -1344,11 +1362,11 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("PCH Fan", 3)); f.Add(new Fan("CPU Optional Fan", 4)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan #1", 1)); - c.Add(new Ctrl("System Fan #2", 2)); - c.Add(new Ctrl("PCH Fan", 3)); - c.Add(new Ctrl("CPU Optional Fan", 4)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan #1", 1)); + c.Add(new Control("System Fan #2", 2)); + c.Add(new Control("PCH Fan", 3)); + c.Add(new Control("CPU Optional Fan", 4)); break; @@ -1371,11 +1389,11 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("PCH Fan", 3)); f.Add(new Fan("CPU Optional Fan", 4)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan #1", 1)); - c.Add(new Ctrl("System Fan #2", 2)); - c.Add(new Ctrl("PCH Fan", 3)); - c.Add(new Ctrl("CPU Optional Fan", 4)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan #1", 1)); + c.Add(new Control("System Fan #2", 2)); + c.Add(new Control("PCH Fan", 3)); + c.Add(new Control("CPU Optional Fan", 4)); break; @@ -1403,10 +1421,10 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #1", 1)); f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("System Fan #3", 3)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan #1", 1)); - c.Add(new Ctrl("System Fan #2", 2)); - c.Add(new Ctrl("System Fan #3", 3)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan #1", 1)); + c.Add(new Control("System Fan #2", 2)); + c.Add(new Control("System Fan #3", 3)); break; @@ -1433,11 +1451,11 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("System Fan #3", 3)); f.Add(new Fan("CPU Optional Fan", 4)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan #1", 1)); - c.Add(new Ctrl("System Fan #2", 2)); - c.Add(new Ctrl("System Fan #3", 3)); - c.Add(new Ctrl("CPU Optional Fan", 4)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan #1", 1)); + c.Add(new Control("System Fan #2", 2)); + c.Add(new Control("System Fan #3", 3)); + c.Add(new Control("CPU Optional Fan", 4)); break; @@ -1462,11 +1480,11 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #2", 2)); f.Add(new Fan("System Fan #3", 3)); f.Add(new Fan("CPU Optional Fan", 4)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan #1", 1)); - c.Add(new Ctrl("System Fan #2", 2)); - c.Add(new Ctrl("System Fan #3", 3)); - c.Add(new Ctrl("CPU Optional Fan", 4)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan #1", 1)); + c.Add(new Control("System Fan #2", 2)); + c.Add(new Control("System Fan #3", 3)); + c.Add(new Control("CPU Optional Fan", 4)); break; case Model.Z690_GAMING_X_DDR4: @@ -1482,12 +1500,12 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #3", 3)); f.Add(new Fan("CPU Optional Fan", 4)); f.Add(new Fan("System Fan #4 / Pump", 5)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("System Fan #1", 1)); - c.Add(new Ctrl("System Fan #2", 2)); - c.Add(new Ctrl("System Fan #3", 3)); - c.Add(new Ctrl("CPU Optional Fan", 4)); - c.Add(new Ctrl("System Fan #4 / Pump", 5)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("System Fan #1", 1)); + c.Add(new Control("System Fan #2", 2)); + c.Add(new Control("System Fan #3", 3)); + c.Add(new Control("CPU Optional Fan", 4)); + c.Add(new Control("System Fan #4 / Pump", 5)); break; case Model.Z68A_D3H_B3: // IT8728F @@ -1589,7 +1607,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -1606,7 +1624,7 @@ internal sealed class SuperIOHardware : Hardware v.Add(new Voltage("Vcore", 0, 0, 1)); v.Add(new Voltage("DIMM", 1, 0, 1)); v.Add(new Voltage("+12V", 2, 5, 1)); // Reads higher than it should. - v.Add(new Voltage("+5V", 3, 147, 100)); // Reads higher than it should. + v.Add(new Voltage("+5V", 3, 147, 100)); // Reads higher than it should. // Commented because I don't know if it makes sense. //v.Add(new Voltage("VCC ST", 4)); // Reads 4.2V. //v.Add(new Voltage("VCCIN AUX", 5)); // Reads 2.2V. @@ -1614,14 +1632,14 @@ internal sealed class SuperIOHardware : Hardware //v.Add(new Voltage("3VSB", 7, 10, 10)); // Reads 5.8V ? v.Add(new Voltage("VBat", 8, 10, 10)); // Reads higher than it should at 3.4V. t.Add(new Temperature("System 1", 0)); - t.Add(new Temperature("System 2", 1)); // Not sure what sensor is this. + t.Add(new Temperature("System 2", 1)); // Not sure what sensor is this. t.Add(new Temperature("CPU", 2)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("CPU Optional fan", 2)); f.Add(new Fan("System Fan", 4)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("CPU Optional Fan", 2)); - c.Add(new Ctrl("System Fan", 4)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("CPU Optional Fan", 2)); + c.Add(new Control("System Fan", 4)); break; @@ -1645,10 +1663,10 @@ internal sealed class SuperIOHardware : Hardware for (int i = 2; i < superIO.Fans.Length; i++) f.Add(new Fan($"System Fan #{i - 1}", i)); - c.Add(new Ctrl("CPU Fan", 0)); - c.Add(new Ctrl("CPU Optional Fan", 1)); + c.Add(new Control("CPU Fan", 0)); + c.Add(new Control("CPU Optional Fan", 1)); for (int i = 2; i < superIO.Controls.Length; i++) - c.Add(new Ctrl($"System Fan #{i - 1}", i)); + c.Add(new Control($"System Fan #{i - 1}", i)); break; @@ -1670,7 +1688,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -1712,7 +1730,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -1737,13 +1755,13 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } } - private static void GetIteConfigurationsC(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) + private static void GetIteConfigurationsC(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) { switch (manufacturer) { @@ -1786,7 +1804,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -1806,9 +1824,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #5 Pump", 0)); f.Add(new Fan("System Fan #6 Pump", 1)); f.Add(new Fan("System Fan #4", 2)); - c.Add(new Ctrl("Fan #5", 0)); - c.Add(new Ctrl("Fan #6", 1)); - c.Add(new Ctrl("Fan #4", 2)); + c.Add(new Control("Fan #5", 0)); + c.Add(new Control("Fan #6", 1)); + c.Add(new Control("Fan #4", 2)); break; @@ -1819,9 +1837,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #5 Pump", 0)); f.Add(new Fan("System Fan #6 Pump", 1)); f.Add(new Fan("System Fan #4", 2)); - c.Add(new Ctrl("System Fan #5 Pump", 0)); - c.Add(new Ctrl("System Fan #6 Pump", 1)); - c.Add(new Ctrl("System Fan #4", 2)); + c.Add(new Control("System Fan #5 Pump", 0)); + c.Add(new Control("System Fan #6 Pump", 1)); + c.Add(new Control("System Fan #4", 2)); break; default: @@ -1842,7 +1860,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -1867,13 +1885,13 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } } - private static void GetFintekConfiguration(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) + private static void GetFintekConfiguration(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) { switch (manufacturer) { @@ -1941,13 +1959,13 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } } - private static void GetNuvotonConfigurationF(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) + private static void GetNuvotonConfigurationF(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) { switch (manufacturer) { @@ -1971,9 +1989,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("Chassis Fan #2", 3)); - c.Add(new Ctrl("Chassis Fan #2", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Chassis Fan #1", 2)); + c.Add(new Control("Chassis Fan #2", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Chassis Fan #1", 2)); break; @@ -2013,7 +2031,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -2032,7 +2050,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -2055,7 +2073,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -2081,9 +2099,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("Chassis Fan #2", 3)); - c.Add(new Ctrl("Chassis Fan #2", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Chassis Fan #1", 2)); + c.Add(new Control("Chassis Fan #2", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Chassis Fan #1", 2)); } break; @@ -2106,7 +2124,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -2129,7 +2147,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -2155,13 +2173,13 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } } - private static void GetNuvotonConfigurationD(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) + private static void GetNuvotonConfigurationD(ISuperIO superIO, Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) { switch (manufacturer) { @@ -2196,7 +2214,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -2236,7 +2254,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -2267,7 +2285,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -2300,13 +2318,13 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("SB Fan", 5)); f.Add(new Fan("Chassis #4", 6)); - c.Add(new Ctrl("Chassis #3", 0)); - c.Add(new Ctrl("CPU #1", 1)); - c.Add(new Ctrl("CPU #2", 2)); - c.Add(new Ctrl("Chassis #1", 3)); - c.Add(new Ctrl("Chassis #2", 4)); - c.Add(new Ctrl("SB Fan", 5)); - c.Add(new Ctrl("Chassis #4", 6)); + c.Add(new Control("Chassis #3", 0)); + c.Add(new Control("CPU #1", 1)); + c.Add(new Control("CPU #2", 2)); + c.Add(new Control("Chassis #1", 3)); + c.Add(new Control("Chassis #2", 4)); + c.Add(new Control("SB Fan", 5)); + c.Add(new Control("Chassis #4", 6)); break; @@ -2335,10 +2353,10 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("CPU Fan #2", 2)); //CPU_FAN2 (WP) f.Add(new Fan("Chipset Fan", 3)); - c.Add(new Ctrl("CPU Fan #1", 0)); - c.Add(new Ctrl("Chassis Fan", 1)); - c.Add(new Ctrl("CPU Fan #2", 2)); - c.Add(new Ctrl("Chipset Fan", 3)); + c.Add(new Control("CPU Fan #1", 0)); + c.Add(new Control("Chassis Fan", 1)); + c.Add(new Control("CPU Fan #2", 2)); + c.Add(new Control("Chipset Fan", 3)); break; case Model.Z790_Taichi: @@ -2352,9 +2370,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Chassis Fan #6", 1)); f.Add(new Fan("Chassis Fan #3", 6)); - c.Add(new Ctrl("Chassis Fan #5", 0)); - c.Add(new Ctrl("Chassis Fan #6", 1)); - c.Add(new Ctrl("Chassis Fan #3", 6)); + c.Add(new Control("Chassis Fan #5", 0)); + c.Add(new Control("Chassis Fan #6", 1)); + c.Add(new Control("Chassis Fan #3", 6)); break; default: @@ -2385,7 +2403,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -2418,10 +2436,10 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Chassis Fan #2", 2)); f.Add(new Fan("Chassis Fan #3", 3)); - c.Add(new Ctrl("Chassis Fan #1", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Chassis Fan #2", 2)); - c.Add(new Ctrl("Chassis Fan #3", 3)); + c.Add(new Control("Chassis Fan #1", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Chassis Fan #2", 2)); + c.Add(new Control("Chassis Fan #3", 3)); break; @@ -2453,11 +2471,11 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Chassis Fan #2", 2)); f.Add(new Fan("Chassis Fan #3", 3)); f.Add(new Fan("AIO Pump", 4)); - c.Add(new Ctrl("Chassis Fan #1", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Chassis Fan #2", 2)); - c.Add(new Ctrl("Chassis Fan #3", 3)); - c.Add(new Ctrl("AIO Pump", 4)); + c.Add(new Control("Chassis Fan #1", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Chassis Fan #2", 2)); + c.Add(new Control("Chassis Fan #3", 3)); + c.Add(new Control("AIO Pump", 4)); break; @@ -2494,7 +2512,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan(fanNames[i], i)); for (int i = 0; i < fanControlNames.Length; i++) - c.Add(new Ctrl(fanControlNames[i], i)); + c.Add(new Control(fanControlNames[i], i)); break; @@ -2543,7 +2561,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -2591,10 +2609,10 @@ internal sealed class SuperIOHardware : Hardware t.Add(new Temperature("PECI 1 Calibrated", 22)); t.Add(new Temperature("Virtual", 23)); - fanControlNames = new[] {"Chassis Fan 1", "CPU Fan", "Chassis Fan 2", - "Chassis Fan 3", "High Amp Fan", "Waterpump", "AIO Pump"}; + fanControlNames = new[] { "Chassis Fan 1", "CPU Fan", "Chassis Fan 2", "Chassis Fan 3", "High Amp Fan", "Waterpump", "AIO Pump" }; System.Diagnostics.Debug.Assert(fanControlNames.Length == superIO.Fans.Length, $"Expected {fanControlNames.Length} fan register in the SuperIO chip"); + System.Diagnostics.Debug.Assert(superIO.Fans.Length == superIO.Controls.Length, "Expected counts of cans controls and fan speed registers to be equal"); @@ -2602,11 +2620,11 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan(fanControlNames[i], i)); for (int i = 0; i < fanControlNames.Length; i++) - c.Add(new Ctrl(fanControlNames[i], i)); + c.Add(new Control(fanControlNames[i], i)); break; - case Model.ROG_MAXIMUS_X_HERO_WIFI_AC: //NCT6793D + case Model.ROG_MAXIMUS_X_HERO_WIFI_AC: //NCT6793D v.Add(new Voltage("Vcore", 0, 2, 2)); v.Add(new Voltage("+5V", 1, 4, 1)); v.Add(new Voltage("AVSB", 2, 34, 34)); @@ -2624,7 +2642,7 @@ internal sealed class SuperIOHardware : Hardware v.Add(new Voltage("CPU VCCIO/IMC", 14)); t.Add(new Temperature("CPU (PECI)", 0)); t.Add(new Temperature("T2", 1)); - t.Add(new Temperature("Motherboard", 2)); //Verified via BIOS and HWinfo. HWinfo had T1 and Motherboard, but thye were the same. + t.Add(new Temperature("Motherboard", 2)); //Verified via BIOS and HWinfo. HWinfo had T1 and Motherboard, but thye were the same. t.Add(new Temperature("Temperature #3", 4)); t.Add(new Temperature("Temperature #4", 5)); t.Add(new Temperature("Temperature #5", 6)); @@ -2636,7 +2654,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan(fanControlNames[i], i)); for (int i = 0; i < fanControlNames.Length; i++) - c.Add(new Ctrl(fanControlNames[i], i)); + c.Add(new Control(fanControlNames[i], i)); break; @@ -2671,6 +2689,7 @@ internal sealed class SuperIOHardware : Hardware System.Diagnostics.Debug.Assert(fanControlNames.Length == superIO.Fans.Length, $"Expected {fanControlNames.Length} fan register in the SuperIO chip"); + System.Diagnostics.Debug.Assert(superIO.Fans.Length == superIO.Controls.Length, "Expected counts of cans controls and fan speed registers to be equal"); @@ -2678,11 +2697,11 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan(fanControlNames[i], i)); for (int i = 0; i < fanControlNames.Length; i++) - c.Add(new Ctrl(fanControlNames[i], i)); + c.Add(new Control(fanControlNames[i], i)); break; - case Model.ROG_MAXIMUS_Z690_HERO: //NCT6798D + case Model.ROG_MAXIMUS_Z690_HERO: //NCT6798D v.Add(new Voltage("Vcore", 0)); v.Add(new Voltage("+5V", 1, 4, 1)); v.Add(new Voltage("AVSB", 2, 34, 34)); @@ -2699,21 +2718,24 @@ internal sealed class SuperIOHardware : Hardware v.Add(new Voltage("Voltage #14 ", 13)); v.Add(new Voltage("Voltage #15", 14)); - t.Add(new Temperature("CPU Package", 0)); // Matches CPU Package in HWinfo & Armoury Crate. - t.Add(new Temperature("CPU Weighted", 1)); // Unsure about this one. HWinfo & Armoury Crate doesn't have anything that match my values. Varies from 34 (idle) to 42C (under load). Hwinfo is 31-32C for same. - t.Add(new Temperature("Motherboard", 2)); // Matches MB in HWinfo & Armoury Crate. + t.Add(new Temperature("CPU Package", 0)); // Matches CPU Package in HWinfo & Armoury Crate. + t.Add(new Temperature("CPU Weighted", + 1)); // Unsure about this one. HWinfo & Armoury Crate doesn't have anything that match my values. Varies from 34 (idle) to 42C (under load). Hwinfo is 31-32C for same. + + t.Add(new Temperature("Motherboard", 2)); // Matches MB in HWinfo & Armoury Crate. //t.Add(new Temperature("Temperature #4", 4)); // Constant at 15C //t.Add(new Temperature("Temperature #5", 5)); // Varies from 15C to 123C. Probably bogus //t.Add(new Temperature("Temperature #6", 6)); // Constant at 32C //t.Add(new Temperature("Temperature #7", 7)); // Varies from 14C to 124C. Probably bogus - t.Add(new Temperature("PCH", 12)); // Chipset. Match HWinfo & Armoury Crate - t.Add(new Temperature("CPU", 21)); // Matches CPU in HWinfo & Armoury Crate. + t.Add(new Temperature("PCH", 12)); // Chipset. Match HWinfo & Armoury Crate + t.Add(new Temperature("CPU", 21)); // Matches CPU in HWinfo & Armoury Crate. // note that CPU Opt Fan is on the ASUS EC controller. Together with VRM, T_Sensor, WaterIn, WaterOut and WaterFlow + additional sensors. fanControlNames = new[] { "Chassis Fan 1", "CPU Fan", "Chassis Fan 2", "Chassis Fan 3", "Chassis Fan 4", "Waterpump", "AIO Pump" }; System.Diagnostics.Debug.Assert(fanControlNames.Length == superIO.Fans.Length, $"Expected {fanControlNames.Length} fan register in the SuperIO chip"); + System.Diagnostics.Debug.Assert(superIO.Fans.Length == superIO.Controls.Length, "Expected counts of cans controls and fan speed registers to be equal"); @@ -2721,7 +2743,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan(fanControlNames[i], i)); for (int i = 0; i < fanControlNames.Length; i++) - c.Add(new Ctrl(fanControlNames[i], i)); + c.Add(new Control(fanControlNames[i], i)); break; @@ -2768,6 +2790,7 @@ internal sealed class SuperIOHardware : Hardware fanControlNames = new[] { "Chassis Fan 1", "CPU Fan", "Radiator Fan 1", "Radiator Fan 2", "Chassis Fan 2", "Water Pump 1", "Water Pump 2" }; System.Diagnostics.Debug.Assert(fanControlNames.Length == superIO.Fans.Length, $"Expected {fanControlNames.Length} fan register in the SuperIO chip"); + System.Diagnostics.Debug.Assert(superIO.Fans.Length == superIO.Controls.Length, "Expected counts of fan controls and fan speed registers to be equal"); @@ -2775,7 +2798,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan(fanControlNames[i], i)); for (int i = 0; i < fanControlNames.Length; i++) - c.Add(new Ctrl(fanControlNames[i], i)); + c.Add(new Control(fanControlNames[i], i)); break; @@ -2807,7 +2830,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -2874,13 +2897,13 @@ internal sealed class SuperIOHardware : Hardware switch (i) { case 0: - c.Add(new Ctrl("Chassis Fan", 0)); + c.Add(new Control("Chassis Fan", 0)); break; case 1: - c.Add(new Ctrl("CPU Fan", 1)); + c.Add(new Control("CPU Fan", 1)); break; case 4: - c.Add(new Ctrl("AIO Pump", 4)); + c.Add(new Control("AIO Pump", 4)); break; } } @@ -2889,31 +2912,39 @@ internal sealed class SuperIOHardware : Hardware case Model.ROG_ZENITH_II_EXTREME: // NCT6798D // Voltage = value + (value - Vf) * Ri / Rf. - v.Add(new Voltage("Vcore", 0)); - v.Add(new Voltage("+5V", 1, 4, 1)); - v.Add(new Voltage("+3.3V", 3, 34, 34)); - v.Add(new Voltage("+12V", 4, 6, 1)); - v.Add(new Voltage("DIMM Voltage CD", 11, 10, 10)); - v.Add(new Voltage("DIMM Voltage AB", 13)); + v.Add(new Voltage("Vcore", 0)); + v.Add(new Voltage("+5V", 1, 4, 1)); + v.Add(new Voltage("+3.3V", 3, 34, 34)); + v.Add(new Voltage("+12V", 4, 6, 1)); + v.Add(new Voltage("DIMM Voltage CD", 11, 10, 10)); + v.Add(new Voltage("DIMM Voltage AB", 13)); v.Add(new Voltage("1.8V PPL Voltage", 14)); - t.Add(new Temperature("CPU", 1)); - t.Add(new Temperature("Motherboard", 2)); - t.Add(new Temperature("Temperature #3", 3)); - t.Add(new Temperature("Temperature #4", 4)); - t.Add(new Temperature("Temperature #5", 5)); - t.Add(new Temperature("Temperature #6", 6)); - t.Add(new Temperature("Temperature #7", 7)); + t.Add(new Temperature("CPU", 1)); + t.Add(new Temperature("Motherboard", 2)); + t.Add(new Temperature("Temperature #3", 3)); + t.Add(new Temperature("Temperature #4", 4)); + t.Add(new Temperature("Temperature #5", 5)); + t.Add(new Temperature("Temperature #6", 6)); + t.Add(new Temperature("Temperature #7", 7)); t.Add(new Temperature("Temperature #21", 21)); for (int i = 0; i < superIO.Fans.Length; i++) { switch (i) { - case 0: f.Add(new Fan("Chassis Fan", 0)); break; - case 1: f.Add(new Fan("CPU Fan", 1)); break; - case 2: f.Add(new Fan("CPU Optional Fan", 2)); break; - case 4: f.Add(new Fan("AIO Pump", 4)); break; + case 0: + f.Add(new Fan("Chassis Fan", 0)); + break; + case 1: + f.Add(new Fan("CPU Fan", 1)); + break; + case 2: + f.Add(new Fan("CPU Optional Fan", 2)); + break; + case 4: + f.Add(new Fan("AIO Pump", 4)); + break; } } @@ -2921,10 +2952,18 @@ internal sealed class SuperIOHardware : Hardware { switch (i) { - case 0: c.Add(new Ctrl("Chassis Fan", 0)); break; - case 1: c.Add(new Ctrl("CPU Fan", 1)); break; - case 2: c.Add(new Ctrl("CPU Optional Fan", 2)); break; - case 4: c.Add(new Ctrl("AIO Pump", 4)); break; + case 0: + c.Add(new Control("Chassis Fan", 0)); + break; + case 1: + c.Add(new Control("CPU Fan", 1)); + break; + case 2: + c.Add(new Control("CPU Optional Fan", 2)); + break; + case 4: + c.Add(new Control("AIO Pump", 4)); + break; } } @@ -2969,16 +3008,17 @@ internal sealed class SuperIOHardware : Hardware switch (i) { case 0: - c.Add(new Ctrl("Chassis Fan", 0)); + c.Add(new Control("Chassis Fan", 0)); break; case 1: - c.Add(new Ctrl("CPU Fan", 1)); + c.Add(new Control("CPU Fan", 1)); break; case 4: - c.Add(new Ctrl("AIO Pump", 4)); + c.Add(new Control("AIO Pump", 4)); break; } } + break; case Model.ROG_STRIX_B550_F_GAMING_WIFI: // NCT6798D-R @@ -3003,7 +3043,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; @@ -3035,7 +3075,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -3066,9 +3106,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("System Fan #1", 2)); f.Add(new Fan("System Fan #2", 3)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("System Fan #1", 2)); - c.Add(new Ctrl("System Fan #2", 3)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("System Fan #1", 2)); + c.Add(new Control("System Fan #2", 3)); break; @@ -3099,12 +3139,12 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #2", 3)); f.Add(new Fan("System Fan #3", 4)); f.Add(new Fan("System Fan #4", 5)); - c.Add(new Ctrl("Pump Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("System Fan #1", 2)); - c.Add(new Ctrl("System Fan #2", 3)); - c.Add(new Ctrl("System Fan #3", 4)); - c.Add(new Ctrl("System Fan #4", 5)); + c.Add(new Control("Pump Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("System Fan #1", 2)); + c.Add(new Control("System Fan #2", 3)); + c.Add(new Control("System Fan #3", 4)); + c.Add(new Control("System Fan #4", 5)); break; @@ -3132,12 +3172,12 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("System Fan #2", 3)); f.Add(new Fan("System Fan #3", 4)); f.Add(new Fan("System Fan #4", 5)); - c.Add(new Ctrl("Pump Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("System Fan #1", 2)); - c.Add(new Ctrl("System Fan #2", 3)); - c.Add(new Ctrl("System Fan #3", 4)); - c.Add(new Ctrl("System Fan #4", 5)); + c.Add(new Control("Pump Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("System Fan #1", 2)); + c.Add(new Control("System Fan #2", 3)); + c.Add(new Control("System Fan #3", 4)); + c.Add(new Control("System Fan #4", 5)); break; @@ -3169,7 +3209,7 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } @@ -3204,13 +3244,13 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Fan #" + (i + 1), i)); for (int i = 0; i < superIO.Controls.Length; i++) - c.Add(new Ctrl("Fan #" + (i + 1), i)); + c.Add(new Control("Fan #" + (i + 1), i)); break; } } - private static void GetWinbondConfigurationEhf(Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) + private static void GetWinbondConfigurationEhf(Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) { switch (manufacturer) { @@ -3229,9 +3269,9 @@ internal sealed class SuperIOHardware : Hardware t.Add(new Temperature("Motherboard", 2)); f.Add(new Fan("CPU Fan", 0)); f.Add(new Fan("Chassis Fan", 1)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; @@ -3254,9 +3294,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Auxiliary Fan", 2)); f.Add(new Fan("CPU Fan #2", 3)); f.Add(new Fan("Auxiliary Fan #2", 4)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; } @@ -3282,15 +3322,15 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Auxiliary Fan", 2)); f.Add(new Fan("CPU Fan #2", 3)); f.Add(new Fan("Auxiliary Fan #2", 4)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; } } - private static void GetWinbondConfigurationHg(Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) + private static void GetWinbondConfigurationHg(Manufacturer manufacturer, Model model, IList v, IList t, IList f, IList c) { switch (manufacturer) { @@ -3309,9 +3349,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Chassis Fan", 0)); f.Add(new Fan("CPU Fan", 1)); f.Add(new Fan("Power Fan", 2)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; @@ -3333,9 +3373,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Auxiliary Fan", 2)); f.Add(new Fan("CPU Fan #2", 3)); f.Add(new Fan("Auxiliary Fan #2", 4)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; } @@ -3361,9 +3401,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("Chassis Fan #2", 3)); f.Add(new Fan("Chassis Fan #3", 4)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; @@ -3382,9 +3422,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Power Fan", 2)); f.Add(new Fan("Chassis Fan #2", 3)); f.Add(new Fan("Chassis Fan #3", 4)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; @@ -3406,9 +3446,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Auxiliary Fan", 2)); f.Add(new Fan("CPU Fan #2", 3)); f.Add(new Fan("Auxiliary Fan #2", 4)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; } @@ -3433,9 +3473,9 @@ internal sealed class SuperIOHardware : Hardware f.Add(new Fan("Auxiliary Fan", 2)); f.Add(new Fan("CPU Fan #2", 3)); f.Add(new Fan("Auxiliary Fan #2", 4)); - c.Add(new Ctrl("System Fan", 0)); - c.Add(new Ctrl("CPU Fan", 1)); - c.Add(new Ctrl("Auxiliary Fan", 2)); + c.Add(new Control("System Fan", 0)); + c.Add(new Control("CPU Fan", 1)); + c.Add(new Control("Auxiliary Fan", 2)); break; } @@ -3502,63 +3542,4 @@ internal sealed class SuperIOHardware : Hardware private delegate float? ReadValueDelegate(int index); private delegate void UpdateDelegate(); - - private class Voltage - { - public readonly bool Hidden; - public readonly int Index; - public readonly string Name; - public readonly float Rf; - public readonly float Ri; - public readonly float Vf; - - public Voltage(string name, int index, bool hidden = false) : this(name, index, 0, 1, 0, hidden) - { } - - public Voltage(string name, int index, float ri, float rf, float vf = 0, bool hidden = false) - { - Name = name; - Index = index; - Ri = ri; - Rf = rf; - Vf = vf; - Hidden = hidden; - } - } - - private class Temperature - { - public readonly int Index; - public readonly string Name; - - public Temperature(string name, int index) - { - Name = name; - Index = index; - } - } - - private class Fan - { - public readonly int Index; - public readonly string Name; - - public Fan(string name, int index) - { - Name = name; - Index = index; - } - } - - private class Ctrl - { - public readonly int Index; - public readonly string Name; - - public Ctrl(string name, int index) - { - Name = name; - Index = index; - } - } } diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/Temperature.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/Temperature.cs new file mode 100644 index 0000000..785fa4c --- /dev/null +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/Temperature.cs @@ -0,0 +1,13 @@ +namespace LibreHardwareMonitor.Hardware.Motherboard; + +internal class Temperature +{ + public readonly int Index; + public readonly string Name; + + public Temperature(string name, int index) + { + Name = name; + Index = index; + } +} \ No newline at end of file diff --git a/LibreHardwareMonitorLib/Hardware/Motherboard/Voltage.cs b/LibreHardwareMonitorLib/Hardware/Motherboard/Voltage.cs new file mode 100644 index 0000000..a734b70 --- /dev/null +++ b/LibreHardwareMonitorLib/Hardware/Motherboard/Voltage.cs @@ -0,0 +1,24 @@ +namespace LibreHardwareMonitor.Hardware.Motherboard; + +internal class Voltage +{ + public readonly bool Hidden; + public readonly int Index; + public readonly string Name; + public readonly float Rf; + public readonly float Ri; + public readonly float Vf; + + public Voltage(string name, int index, bool hidden = false) : this(name, index, 0, 1, 0, hidden) + { } + + public Voltage(string name, int index, float ri, float rf, float vf = 0, bool hidden = false) + { + Name = name; + Index = index; + Ri = ri; + Rf = rf; + Vf = vf; + Hidden = hidden; + } +} \ No newline at end of file diff --git a/LibreHardwareMonitorLib/Interop/Ipmi.cs b/LibreHardwareMonitorLib/Interop/Ipmi.cs new file mode 100644 index 0000000..ec32da6 --- /dev/null +++ b/LibreHardwareMonitorLib/Interop/Ipmi.cs @@ -0,0 +1,96 @@ +using System.Runtime.InteropServices; + +namespace LibreHardwareMonitor.Interop; + +internal static class Ipmi +{ + // Ported from ipmiutil + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] + internal struct Sdr + { + public ushort recid; + + public byte sdrver; + + public byte rectype; + + public byte reclen; + + public byte sens_ownid; + + public byte sens_ownlun; + + public byte sens_num; + + public byte entity_id; + + public byte entity_inst; + + public byte sens_init; + + public byte sens_capab; + + public byte sens_type; + + public byte ev_type; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 6)] + public string data1; + + public byte sens_units; + + public byte sens_base; + + public byte sens_mod; + + public byte linear; + + public byte m; + + public byte m_t; + + public byte b; + + public byte b_a; + + public byte a_ax; + + public byte rx_bx; + + public byte flags; + + public byte nom_reading; + + public byte norm_max; + + public byte norm_min; + + public byte sens_max_reading; + + public byte sens_min_reading; + + public byte unr_threshold; + + public byte ucr_threshold; + + public byte unc_threshold; + + public byte lnr_threshold; + + public byte lcr_threshold; + + public byte lnc_threshold; + + public byte pos_hysteresis; + + public byte neg_hysteresis; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 3)] + public string data3; + + public byte id_strlen; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] + public string id_string; + } +}