Fix some code analysis issues (#841)
This commit is contained in:
@@ -358,7 +358,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
w.Write(report);
|
w.Write(report);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (IHardware hardware in (IEnumerable<IHardware>)group.Hardware)
|
foreach (IHardware hardware in group.Hardware)
|
||||||
ReportHardware(hardware, w);
|
ReportHardware(hardware, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
|
|||||||
//Reading output report instead of feature report, as the measurements are in the output report
|
//Reading output report instead of feature report, as the measurements are in the output report
|
||||||
_stream.Read(_rawData);
|
_stream.Read(_rawData);
|
||||||
|
|
||||||
Name = $"D5Next";
|
Name = "D5Next";
|
||||||
FirmwareVersion = Convert.ToUInt16(_rawData[14] | (_rawData[13] << 8));
|
FirmwareVersion = Convert.ToUInt16(_rawData[14] | (_rawData[13] << 8));
|
||||||
_temperatures[0] = new Sensor("Water Temperature", 0, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
|
_temperatures[0] = new Sensor("Water Temperature", 0, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
|
||||||
ActivateSensor(_temperatures[0]);
|
ActivateSensor(_temperatures[0]);
|
||||||
@@ -60,7 +60,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
|
|||||||
//Reading output report instead of feature report, as the measurements are in the output report
|
//Reading output report instead of feature report, as the measurements are in the output report
|
||||||
_stream.Read(_rawData);
|
_stream.Read(_rawData);
|
||||||
_temperatures[0].Value = (_rawData[88] | (_rawData[87] << 8)) / 100f; //Water Temp
|
_temperatures[0].Value = (_rawData[88] | (_rawData[87] << 8)) / 100f; //Water Temp
|
||||||
_rpmSensors[0].Value = (_rawData[117] | (_rawData[116] << 8)); //Pump RPM
|
_rpmSensors[0].Value = _rawData[117] | (_rawData[116] << 8); //Pump RPM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
|
|||||||
{
|
{
|
||||||
internal sealed class MPS : Hardware
|
internal sealed class MPS : Hardware
|
||||||
{
|
{
|
||||||
|
public const int ExternalTemperature = 43;
|
||||||
|
public const int InternalWaterTemperature = 45;
|
||||||
|
public const int PumpFlow = 35;
|
||||||
private const byte MPS_REPORT_ID = 0x2;
|
private const byte MPS_REPORT_ID = 0x2;
|
||||||
|
|
||||||
private readonly Sensor _pumpFlow;
|
private readonly Sensor _pumpFlow;
|
||||||
@@ -79,9 +82,9 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
|
|||||||
if (_rawData[0] != MPS_REPORT_ID)
|
if (_rawData[0] != MPS_REPORT_ID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_pumpFlow.Value = BitConverter.ToUInt16(_rawData, MPSDataIndexes.PumpFlow) / 10f;
|
_pumpFlow.Value = BitConverter.ToUInt16(_rawData, PumpFlow) / 10f;
|
||||||
|
|
||||||
_externalTemperature = BitConverter.ToUInt16(_rawData, MPSDataIndexes.ExternalTemperature);
|
_externalTemperature = BitConverter.ToUInt16(_rawData, ExternalTemperature);
|
||||||
//sensor reading returns Int16.MaxValue (32767), when not connected
|
//sensor reading returns Int16.MaxValue (32767), when not connected
|
||||||
if (_externalTemperature != short.MaxValue)
|
if (_externalTemperature != short.MaxValue)
|
||||||
{
|
{
|
||||||
@@ -92,19 +95,12 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
|
|||||||
_temperatures[0].Value = null;
|
_temperatures[0].Value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_temperatures[1].Value = BitConverter.ToUInt16(_rawData, MPSDataIndexes.InternalWaterTemperature) / 100f;
|
_temperatures[1].Value = BitConverter.ToUInt16(_rawData, InternalWaterTemperature) / 100f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ushort ExtractFirmwareVersion()
|
private ushort ExtractFirmwareVersion()
|
||||||
{
|
{
|
||||||
return BitConverter.ToUInt16(_rawData, 3);
|
return BitConverter.ToUInt16(_rawData, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class MPSDataIndexes
|
|
||||||
{
|
|
||||||
public const int ExternalTemperature = 43;
|
|
||||||
public const int InternalWaterTemperature = 45;
|
|
||||||
public const int PumpFlow = 35;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer
|
|||||||
//Reading output report instead of feature report, as the measurements are in the output report
|
//Reading output report instead of feature report, as the measurements are in the output report
|
||||||
_stream.Read(_rawData);
|
_stream.Read(_rawData);
|
||||||
|
|
||||||
Name = $"OCTO";
|
Name = "OCTO";
|
||||||
FirmwareVersion = GetConvertedValue(OctoDataIndexes.FIRMWARE_VERSION).GetValueOrDefault(0);
|
FirmwareVersion = GetConvertedValue(OctoDataIndexes.FIRMWARE_VERSION).GetValueOrDefault(0);
|
||||||
|
|
||||||
// Initialize the 4 temperature sensors
|
// Initialize the 4 temperature sensors
|
||||||
|
|||||||
@@ -85,8 +85,10 @@ namespace LibreHardwareMonitor.Hardware.Controller.Heatmaster
|
|||||||
{
|
{
|
||||||
int device = 81 + i;
|
int device = 81 + i;
|
||||||
string name = ReadString(device, 'C');
|
string name = ReadString(device, 'C');
|
||||||
_relays[i] = new Sensor(name, device, SensorType.Control, this, settings);
|
_relays[i] = new Sensor(name, device, SensorType.Control, this, settings)
|
||||||
_relays[i].Value = 100 * ReadInteger(device, 'S');
|
{
|
||||||
|
Value = 100 * ReadInteger(device, 'S')
|
||||||
|
};
|
||||||
ActivateSensor(_relays[i]);
|
ActivateSensor(_relays[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +159,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.Heatmaster
|
|||||||
private string ReadString(int device, char field)
|
private string ReadString(int device, char field)
|
||||||
{
|
{
|
||||||
string s = ReadField(device, field);
|
string s = ReadField(device, field);
|
||||||
if (s != null && s[0] == '"' && s[s.Length - 1] == '"')
|
if (s?[0] == '"' && s[s.Length - 1] == '"')
|
||||||
return s.Substring(1, s.Length - 2);
|
return s.Substring(1, s.Length - 2);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -32,87 +32,85 @@ namespace LibreHardwareMonitor.Hardware.Controller.Heatmaster
|
|||||||
bool isValid = false;
|
bool isValid = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (SerialPort serialPort = new(portNames[i], 38400, Parity.None, 8, StopBits.One))
|
using SerialPort serialPort = new(portNames[i], 38400, Parity.None, 8, StopBits.One);
|
||||||
|
serialPort.NewLine = ((char)0x0D).ToString();
|
||||||
|
_report.Append("Port Name: ");
|
||||||
|
_report.AppendLine(portNames[i]);
|
||||||
|
try
|
||||||
{
|
{
|
||||||
serialPort.NewLine = ((char)0x0D).ToString();
|
serialPort.Open();
|
||||||
_report.Append("Port Name: ");
|
}
|
||||||
_report.AppendLine(portNames[i]);
|
catch (UnauthorizedAccessException)
|
||||||
try
|
{
|
||||||
|
_report.AppendLine("Exception: Access Denied");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serialPort.IsOpen)
|
||||||
|
{
|
||||||
|
serialPort.DiscardInBuffer();
|
||||||
|
serialPort.DiscardOutBuffer();
|
||||||
|
serialPort.Write(new byte[] { 0xAA }, 0, 1);
|
||||||
|
|
||||||
|
int j = 0;
|
||||||
|
while (serialPort.BytesToRead == 0 && j < 10)
|
||||||
{
|
{
|
||||||
serialPort.Open();
|
Thread.Sleep(20);
|
||||||
}
|
j++;
|
||||||
catch (UnauthorizedAccessException)
|
|
||||||
{
|
|
||||||
_report.AppendLine("Exception: Access Denied");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serialPort.IsOpen)
|
if (serialPort.BytesToRead > 0)
|
||||||
{
|
{
|
||||||
serialPort.DiscardInBuffer();
|
bool flag = false;
|
||||||
serialPort.DiscardOutBuffer();
|
while (serialPort.BytesToRead > 0 && !flag)
|
||||||
serialPort.Write(new byte[] { 0xAA }, 0, 1);
|
|
||||||
|
|
||||||
int j = 0;
|
|
||||||
while (serialPort.BytesToRead == 0 && j < 10)
|
|
||||||
{
|
{
|
||||||
Thread.Sleep(20);
|
flag |= serialPort.ReadByte() == 0xAA;
|
||||||
j++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serialPort.BytesToRead > 0)
|
if (flag)
|
||||||
{
|
{
|
||||||
bool flag = false;
|
serialPort.WriteLine("[0:0]RH");
|
||||||
while (serialPort.BytesToRead > 0 && !flag)
|
try
|
||||||
{
|
{
|
||||||
flag |= serialPort.ReadByte() == 0xAA;
|
int k = 0;
|
||||||
}
|
int revision = 0;
|
||||||
|
while (k < 5)
|
||||||
if (flag)
|
|
||||||
{
|
|
||||||
serialPort.WriteLine("[0:0]RH");
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
int k = 0;
|
string line = ReadLine(serialPort, 100);
|
||||||
int revision = 0;
|
if (line.StartsWith("-[0:0]RH:", StringComparison.Ordinal))
|
||||||
while (k < 5)
|
|
||||||
{
|
{
|
||||||
string line = ReadLine(serialPort, 100);
|
revision = int.Parse(line.Substring(9), CultureInfo.InvariantCulture);
|
||||||
if (line.StartsWith("-[0:0]RH:", StringComparison.Ordinal))
|
break;
|
||||||
{
|
|
||||||
revision = int.Parse(line.Substring(9), CultureInfo.InvariantCulture);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
k++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isValid = revision == 770;
|
k++;
|
||||||
if (!isValid)
|
|
||||||
{
|
|
||||||
_report.Append("Status: Wrong Hardware Revision " + revision.ToString(CultureInfo.InvariantCulture));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (TimeoutException)
|
|
||||||
|
isValid = revision == 770;
|
||||||
|
if (!isValid)
|
||||||
{
|
{
|
||||||
_report.AppendLine("Status: Timeout Reading Revision");
|
_report.Append("Status: Wrong Hardware Revision " + revision.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (TimeoutException)
|
||||||
{
|
{
|
||||||
_report.AppendLine("Status: Wrong Startflag");
|
_report.AppendLine("Status: Timeout Reading Revision");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_report.AppendLine("Status: No Response");
|
_report.AppendLine("Status: Wrong Startflag");
|
||||||
}
|
}
|
||||||
|
|
||||||
serialPort.DiscardInBuffer();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_report.AppendLine("Status: Port not Open");
|
_report.AppendLine("Status: No Response");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serialPort.DiscardInBuffer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_report.AppendLine("Status: Port not Open");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.Nzxt
|
|||||||
|
|
||||||
private readonly byte[] _setFanSpeedMsg;
|
private readonly byte[] _setFanSpeedMsg;
|
||||||
private readonly HidStream _stream;
|
private readonly HidStream _stream;
|
||||||
private readonly Dictionary<int, byte[]> _rawData = new Dictionary<int, byte[]>();
|
private readonly Dictionary<int, byte[]> _rawData = new();
|
||||||
|
|
||||||
private readonly Sensor _noise;
|
private readonly Sensor _noise;
|
||||||
private readonly Sensor[] _currents = new Sensor[FANS_COUNT];
|
private readonly Sensor[] _currents = new Sensor[FANS_COUNT];
|
||||||
@@ -90,10 +90,10 @@ namespace LibreHardwareMonitor.Hardware.Controller.Nzxt
|
|||||||
// NZXT GRID does not report current PWM value. So we need to initialize it with some value to keep GUI and device values in sync.
|
// NZXT GRID does not report current PWM value. So we need to initialize it with some value to keep GUI and device values in sync.
|
||||||
_fanControls[i].SetDefault();
|
_fanControls[i].SetDefault();
|
||||||
}
|
}
|
||||||
_noise = new Sensor($"GRID Noise", 0, SensorType.Noise, this, Array.Empty<ParameterDescription>(), settings);
|
_noise = new Sensor("GRID Noise", 0, SensorType.Noise, this, Array.Empty<ParameterDescription>(), settings);
|
||||||
ActivateSensor(_noise);
|
ActivateSensor(_noise);
|
||||||
|
|
||||||
Thread readGridReports = new Thread(ContinuousRead) { IsBackground = true };
|
Thread readGridReports = new(ContinuousRead) { IsBackground = true };
|
||||||
readGridReports.Start(_rawData);
|
readGridReports.Start(_rawData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.Nzxt
|
|||||||
if (control.ControlMode == ControlMode.Software)
|
if (control.ControlMode == ControlMode.Software)
|
||||||
{
|
{
|
||||||
float value = control.SoftwareValue;
|
float value = control.SoftwareValue;
|
||||||
byte fanSpeed = (byte)(value > 100 ? 100 : (value < 0) ? 0 : value); // Clamp the value, anything out of range will fail
|
byte fanSpeed = (byte)(value > 100 ? 100 : value < 0 ? 0 : value); // Clamp the value, anything out of range will fail
|
||||||
|
|
||||||
//_controlling = true;
|
//_controlling = true;
|
||||||
_setFanSpeedMsg[2] = (byte)control.Sensor.Index;
|
_setFanSpeedMsg[2] = (byte)control.Sensor.Index;
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ namespace LibreHardwareMonitor.Hardware.Controller.Nzxt
|
|||||||
private static readonly byte[][] _setPumpTargetMap = new byte[101][]; // Sacrifice memory to speed this up with a lookup instead of a copy operation
|
private static readonly byte[][] _setPumpTargetMap = new byte[101][]; // Sacrifice memory to speed this up with a lookup instead of a copy operation
|
||||||
|
|
||||||
private readonly Sensor _pump;
|
private readonly Sensor _pump;
|
||||||
private readonly Control _pumpControl;
|
|
||||||
private readonly Sensor _pumpRpm;
|
private readonly Sensor _pumpRpm;
|
||||||
private readonly byte[] _rawData = new byte[64];
|
private readonly byte[] _rawData = new byte[64];
|
||||||
private readonly HidStream _stream;
|
private readonly HidStream _stream;
|
||||||
@@ -60,11 +59,11 @@ namespace LibreHardwareMonitor.Hardware.Controller.Nzxt
|
|||||||
Name = "Nzxt Kraken X3";
|
Name = "Nzxt Kraken X3";
|
||||||
|
|
||||||
_pump = new Sensor("Pump Control", 0, SensorType.Control, this, Array.Empty<ParameterDescription>(), settings);
|
_pump = new Sensor("Pump Control", 0, SensorType.Control, this, Array.Empty<ParameterDescription>(), settings);
|
||||||
_pumpControl = new Control(_pump, settings, 0, 100);
|
Control pumpControl = new(_pump, settings, 0, 100);
|
||||||
_pump.Control = _pumpControl;
|
_pump.Control = pumpControl;
|
||||||
_pumpControl.ControlModeChanged += SoftwareControlValueChanged;
|
pumpControl.ControlModeChanged += SoftwareControlValueChanged;
|
||||||
_pumpControl.SoftwareControlValueChanged += SoftwareControlValueChanged;
|
pumpControl.SoftwareControlValueChanged += SoftwareControlValueChanged;
|
||||||
SoftwareControlValueChanged(_pumpControl);
|
SoftwareControlValueChanged(pumpControl);
|
||||||
ActivateSensor(_pump);
|
ActivateSensor(_pump);
|
||||||
|
|
||||||
_pumpRpm = new Sensor("Pump", 0, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
|
_pumpRpm = new Sensor("Pump", 0, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
|
||||||
@@ -88,7 +87,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.Nzxt
|
|||||||
if (control.ControlMode == ControlMode.Software)
|
if (control.ControlMode == ControlMode.Software)
|
||||||
{
|
{
|
||||||
float value = control.SoftwareValue;
|
float value = control.SoftwareValue;
|
||||||
byte pumpSpeedIndex = (byte)(value > 100 ? 100 : (value < 0) ? 0 : value); // Clamp the value, anything out of range will fail
|
byte pumpSpeedIndex = (byte)(value > 100 ? 100 : value < 0 ? 0 : value); // Clamp the value, anything out of range will fail
|
||||||
|
|
||||||
_controlling = true;
|
_controlling = true;
|
||||||
_stream.Write(_setPumpTargetMap[pumpSpeedIndex]);
|
_stream.Write(_setPumpTargetMap[pumpSpeedIndex]);
|
||||||
@@ -152,7 +151,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.Nzxt
|
|||||||
else if (_pump.Value != _rawData[19])
|
else if (_pump.Value != _rawData[19])
|
||||||
{
|
{
|
||||||
float value = _pump.Value.GetValueOrDefault();
|
float value = _pump.Value.GetValueOrDefault();
|
||||||
byte pumpSpeedIndex = (byte)(value > 100 ? 100 : (value < 0) ? 0 : value); // Clamp the value, anything out of range will fail
|
byte pumpSpeedIndex = (byte)(value > 100 ? 100 : value < 0 ? 0 : value); // Clamp the value, anything out of range will fail
|
||||||
_stream.Write(_setPumpTargetMap[pumpSpeedIndex]);
|
_stream.Write(_setPumpTargetMap[pumpSpeedIndex]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.TBalancer
|
|||||||
_portIndex = portIndex;
|
_portIndex = portIndex;
|
||||||
_protocolVersion = protocolVersion;
|
_protocolVersion = protocolVersion;
|
||||||
|
|
||||||
ParameterDescription[] parameter = { new ParameterDescription("Offset [°C]", "Temperature offset.", 0) };
|
ParameterDescription[] parameter = { new("Offset [°C]", "Temperature offset.", 0) };
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (int i = 0; i < _digitalTemperatures.Length; i++)
|
for (int i = 0; i < _digitalTemperatures.Length; i++)
|
||||||
_digitalTemperatures[i] = new Sensor("Digital Sensor " + i, offset + i, SensorType.Temperature, this, parameter, settings);
|
_digitalTemperatures[i] = new Sensor("Digital Sensor " + i, offset + i, SensorType.Temperature, this, parameter, settings);
|
||||||
@@ -138,8 +138,7 @@ namespace LibreHardwareMonitor.Hardware.Controller.TBalancer
|
|||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (_miniNgFans[(number * 2) + i] == null)
|
_miniNgFans[(number * 2) + i] ??= new Sensor("miniNG #" + (number + 1) + " Fan Channel " + (i + 1), 4 + (number * 2) + i, SensorType.Fan, this, _settings);
|
||||||
_miniNgFans[(number * 2) + i] = new Sensor("miniNG #" + (number + 1) + " Fan Channel " + (i + 1), 4 + (number * 2) + i, SensorType.Fan, this, _settings);
|
|
||||||
|
|
||||||
Sensor sensor = _miniNgFans[(number * 2) + i];
|
Sensor sensor = _miniNgFans[(number * 2) + i];
|
||||||
sensor.Value = 20.0f * _data[offset + 43 + (2 * i)];
|
sensor.Value = 20.0f * _data[offset + 43 + (2 * i)];
|
||||||
@@ -233,20 +232,17 @@ namespace LibreHardwareMonitor.Hardware.Controller.TBalancer
|
|||||||
{
|
{
|
||||||
float maxRpm = 11.5f * ((_data[149 + (2 * i)] << 8) | _data[148 + (2 * i)]);
|
float maxRpm = 11.5f * ((_data[149 + (2 * i)] << 8) | _data[148 + (2 * i)]);
|
||||||
|
|
||||||
if (_fans[i] == null)
|
_fans[i] ??= new Sensor("Fan Channel " + i,
|
||||||
{
|
i,
|
||||||
_fans[i] = new Sensor("Fan Channel " + i,
|
SensorType.Fan,
|
||||||
i,
|
this,
|
||||||
SensorType.Fan,
|
new[]
|
||||||
this,
|
{
|
||||||
new[]
|
new ParameterDescription("MaxRPM",
|
||||||
{
|
"Maximum revolutions per minute (RPM) of the fan.",
|
||||||
new ParameterDescription("MaxRPM",
|
maxRpm)
|
||||||
"Maximum revolutions per minute (RPM) of the fan.",
|
},
|
||||||
maxRpm)
|
_settings);
|
||||||
},
|
|
||||||
_settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
float value;
|
float value;
|
||||||
if ((_data[136] & (1 << i)) == 0) // pwm mode
|
if ((_data[136] & (1 << i)) == 0) // pwm mode
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
{
|
{
|
||||||
0x00 => FAMILY_16H_MODEL_00_MISC_CONTROL_DEVICE_ID,
|
0x00 => FAMILY_16H_MODEL_00_MISC_CONTROL_DEVICE_ID,
|
||||||
0x30 => FAMILY_16H_MODEL_30_MISC_CONTROL_DEVICE_ID,
|
0x30 => FAMILY_16H_MODEL_30_MISC_CONTROL_DEVICE_ID,
|
||||||
_ => 0,
|
_ => 0
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -161,10 +161,12 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
{
|
{
|
||||||
Ring0.ReadPciConfig(addr, 8, out uint rev);
|
Ring0.ReadPciConfig(addr, 8, out uint rev);
|
||||||
|
|
||||||
if (dev == 0x43851002)
|
_cStatesIoOffset = dev switch
|
||||||
_cStatesIoOffset = (byte)((rev & 0xFF) < 0x40 ? 0xB3 : 0x9C);
|
{
|
||||||
else if (dev is 0x780B1022 or 0x790B1022)
|
0x43851002 => (byte)((rev & 0xFF) < 0x40 ? 0xB3 : 0x9C),
|
||||||
_cStatesIoOffset = 0x9C;
|
0x780B1022 or 0x790B1022 => 0x9C,
|
||||||
|
_ => _cStatesIoOffset
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cStatesIoOffset != 0)
|
if (_cStatesIoOffset != 0)
|
||||||
@@ -288,7 +290,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
6 => 8,
|
6 => 8,
|
||||||
7 => 12,
|
7 => 12,
|
||||||
8 => 16,
|
8 => 16,
|
||||||
_ => 1,
|
_ => 1
|
||||||
};
|
};
|
||||||
return (cpuFid + 0x10) / divisor;
|
return (cpuFid + 0x10) / divisor;
|
||||||
|
|
||||||
@@ -314,7 +316,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
{
|
{
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
int b = stream.ReadByte();
|
int b = stream.ReadByte();
|
||||||
while (b is not (-1) and not 10)
|
while (b is not -1 and not 10)
|
||||||
{
|
{
|
||||||
stringBuilder.Append((char)b);
|
stringBuilder.Append((char)b);
|
||||||
b = stream.ReadByte();
|
b = stream.ReadByte();
|
||||||
@@ -447,7 +449,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ReadSmuRegister(uint address, out uint value)
|
private static bool ReadSmuRegister(uint address, out uint value)
|
||||||
{
|
{
|
||||||
if (Ring0.WaitPciBusMutex(10))
|
if (Ring0.WaitPciBusMutex(10))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
if (cpuId == null)
|
if (cpuId == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
GroupAffinity previousAffinity = ThreadAffinity.Set(cpuId.Affinity);
|
GroupAffinity previousAffinity = ThreadAffinity.Set(cpuId.Affinity);
|
||||||
|
|
||||||
// MSRC001_0299
|
// MSRC001_0299
|
||||||
@@ -490,7 +489,6 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
if (cpu == null)
|
if (cpu == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
GroupAffinity previousAffinity = ThreadAffinity.Set(cpu.Affinity);
|
GroupAffinity previousAffinity = ThreadAffinity.Set(cpu.Affinity);
|
||||||
|
|
||||||
// MSRC001_0299
|
// MSRC001_0299
|
||||||
@@ -502,8 +500,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
// MSRC001_029A
|
// MSRC001_029A
|
||||||
// total_energy [31:0]
|
// total_energy [31:0]
|
||||||
DateTime sampleTime = DateTime.Now;
|
DateTime sampleTime = DateTime.Now;
|
||||||
uint eax;
|
Ring0.ReadMsr(MSR_CORE_ENERGY_STAT, out uint eax, out _);
|
||||||
Ring0.ReadMsr(MSR_CORE_ENERGY_STAT, out eax, out _);
|
|
||||||
uint totalEnergy = eax;
|
uint totalEnergy = eax;
|
||||||
|
|
||||||
// MSRC001_0293
|
// MSRC001_0293
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
{
|
{
|
||||||
"GenuineIntel" => Vendor.Intel,
|
"GenuineIntel" => Vendor.Intel,
|
||||||
"AuthenticAMD" => Vendor.AMD,
|
"AuthenticAMD" => Vendor.AMD,
|
||||||
_ => Vendor.Unknown,
|
_ => Vendor.Unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
if (OpCode.CpuId(CPUID_EXT, 0, out eax, out _, out _, out _))
|
if (OpCode.CpuId(CPUID_EXT, 0, out eax, out _, out _, out _))
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
{
|
{
|
||||||
internal class CpuLoad
|
internal class CpuLoad
|
||||||
{
|
{
|
||||||
private readonly CpuId[][] _cpuid;
|
|
||||||
private long[] _idleTimes;
|
private long[] _idleTimes;
|
||||||
private readonly float[] _threadLoads;
|
private readonly float[] _threadLoads;
|
||||||
private float _totalLoad;
|
private float _totalLoad;
|
||||||
@@ -20,7 +19,6 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
|
|
||||||
public CpuLoad(CpuId[][] cpuid)
|
public CpuLoad(CpuId[][] cpuid)
|
||||||
{
|
{
|
||||||
_cpuid = cpuid;
|
|
||||||
_threadLoads = new float[cpuid.Sum(x => x.Length)];
|
_threadLoads = new float[cpuid.Sum(x => x.Length)];
|
||||||
_totalLoad = 0;
|
_totalLoad = 0;
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -129,13 +129,13 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
{
|
{
|
||||||
Vendor.AMD => "amdcpu",
|
Vendor.AMD => "amdcpu",
|
||||||
Vendor.Intel => "intelcpu",
|
Vendor.Intel => "intelcpu",
|
||||||
_ => "genericcpu",
|
_ => "genericcpu"
|
||||||
};
|
};
|
||||||
|
|
||||||
return new Identifier(s, processorIndex.ToString(CultureInfo.InvariantCulture));
|
return new Identifier(s, processorIndex.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EstimateTimeStampCounterFrequency(out double frequency, out double error)
|
private static void EstimateTimeStampCounterFrequency(out double frequency, out double error)
|
||||||
{
|
{
|
||||||
// preload the function
|
// preload the function
|
||||||
EstimateTimeStampCounterFrequency(0, out double f, out double e);
|
EstimateTimeStampCounterFrequency(0, out double f, out double e);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
public IntelCpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(processorIndex, cpuId, settings)
|
public IntelCpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(processorIndex, cpuId, settings)
|
||||||
{
|
{
|
||||||
uint eax;
|
uint eax;
|
||||||
uint edx;
|
|
||||||
|
|
||||||
// set tjMax
|
// set tjMax
|
||||||
float[] tjMax;
|
float[] tjMax;
|
||||||
@@ -53,13 +52,13 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
{
|
{
|
||||||
2 => Floats(80 + 10),
|
2 => Floats(80 + 10),
|
||||||
4 => Floats(90 + 10),
|
4 => Floats(90 + 10),
|
||||||
_ => Floats(85 + 10),
|
_ => Floats(85 + 10)
|
||||||
},
|
},
|
||||||
// G0
|
// G0
|
||||||
0x0B => Floats(90 + 10),
|
0x0B => Floats(90 + 10),
|
||||||
// M0
|
// M0
|
||||||
0x0D => Floats(85 + 10),
|
0x0D => Floats(85 + 10),
|
||||||
_ => Floats(85 + 10),
|
_ => Floats(85 + 10)
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
0x02 => Floats(90),
|
0x02 => Floats(90),
|
||||||
// A0, B0
|
// A0, B0
|
||||||
0x0A => Floats(100),
|
0x0A => Floats(100),
|
||||||
_ => Floats(90),
|
_ => Floats(90)
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -257,7 +256,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
case MicroArchitecture.Atom:
|
case MicroArchitecture.Atom:
|
||||||
case MicroArchitecture.Core:
|
case MicroArchitecture.Core:
|
||||||
case MicroArchitecture.NetBurst:
|
case MicroArchitecture.NetBurst:
|
||||||
if (Ring0.ReadMsr(IA32_PERF_STATUS, out uint _, out edx))
|
if (Ring0.ReadMsr(IA32_PERF_STATUS, out uint _, out uint edx))
|
||||||
_timeStampCounterMultiplier = ((edx >> 8) & 0x1f) + (0.5 * ((edx >> 14) & 1));
|
_timeStampCounterMultiplier = ((edx >> 8) & 0x1f) + (0.5 * ((edx >> 14) & 1));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -403,7 +402,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
EnergyUnitsMultiplier = _microArchitecture switch
|
EnergyUnitsMultiplier = _microArchitecture switch
|
||||||
{
|
{
|
||||||
MicroArchitecture.Silvermont or MicroArchitecture.Airmont => 1.0e-6f * (1 << (int)((eax >> 8) & 0x1F)),
|
MicroArchitecture.Silvermont or MicroArchitecture.Airmont => 1.0e-6f * (1 << (int)((eax >> 8) & 0x1F)),
|
||||||
_ => 1.0f / (1 << (int)((eax >> 8) & 0x1F)),
|
_ => 1.0f / (1 << (int)((eax >> 8) & 0x1F))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,13 +508,12 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
|
|
||||||
float coreMax = float.MinValue;
|
float coreMax = float.MinValue;
|
||||||
float coreAvg = 0;
|
float coreAvg = 0;
|
||||||
uint eax = 0;
|
uint eax;
|
||||||
uint edx;
|
|
||||||
|
|
||||||
for (int i = 0; i < _coreTemperatures.Length; i++)
|
for (int i = 0; i < _coreTemperatures.Length; i++)
|
||||||
{
|
{
|
||||||
// if reading is valid
|
// if reading is valid
|
||||||
if (Ring0.ReadMsr(IA32_THERM_STATUS_MSR, out eax, out uint _, _cpuId[i][0].Affinity) && (eax & 0x80000000) != 0)
|
if (Ring0.ReadMsr(IA32_THERM_STATUS_MSR, out eax, out _, _cpuId[i][0].Affinity) && (eax & 0x80000000) != 0)
|
||||||
{
|
{
|
||||||
// get the dist from tjMax from bits 22:16
|
// get the dist from tjMax from bits 22:16
|
||||||
float deltaT = (eax & 0x007F0000) >> 16;
|
float deltaT = (eax & 0x007F0000) >> 16;
|
||||||
@@ -547,7 +545,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
if (_packageTemperature != null)
|
if (_packageTemperature != null)
|
||||||
{
|
{
|
||||||
// if reading is valid
|
// if reading is valid
|
||||||
if (Ring0.ReadMsr(IA32_PACKAGE_THERM_STATUS, out eax, out uint _, _cpuId[0][0].Affinity) && (eax & 0x80000000) != 0)
|
if (Ring0.ReadMsr(IA32_PACKAGE_THERM_STATUS, out eax, out _, _cpuId[0][0].Affinity) && (eax & 0x80000000) != 0)
|
||||||
{
|
{
|
||||||
// get the dist from tjMax from bits 22:16
|
// get the dist from tjMax from bits 22:16
|
||||||
float deltaT = (eax & 0x007F0000) >> 16;
|
float deltaT = (eax & 0x007F0000) >> 16;
|
||||||
@@ -567,7 +565,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
for (int i = 0; i < _coreClocks.Length; i++)
|
for (int i = 0; i < _coreClocks.Length; i++)
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(1);
|
System.Threading.Thread.Sleep(1);
|
||||||
if (Ring0.ReadMsr(IA32_PERF_STATUS, out eax, out uint _, _cpuId[i][0].Affinity))
|
if (Ring0.ReadMsr(IA32_PERF_STATUS, out eax, out _, _cpuId[i][0].Affinity))
|
||||||
{
|
{
|
||||||
newBusClock = TimeStampCounterFrequency / _timeStampCounterMultiplier;
|
newBusClock = TimeStampCounterFrequency / _timeStampCounterMultiplier;
|
||||||
switch (_microArchitecture)
|
switch (_microArchitecture)
|
||||||
@@ -622,7 +620,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
if (sensor == null)
|
if (sensor == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!Ring0.ReadMsr(_energyStatusMsrs[sensor.Index], out eax, out uint _))
|
if (!Ring0.ReadMsr(_energyStatusMsrs[sensor.Index], out eax, out _))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DateTime time = DateTime.UtcNow;
|
DateTime time = DateTime.UtcNow;
|
||||||
@@ -637,7 +635,7 @@ namespace LibreHardwareMonitor.Hardware.CPU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_coreVoltage != null && Ring0.ReadMsr(IA32_PERF_STATUS, out _, out edx))
|
if (_coreVoltage != null && Ring0.ReadMsr(IA32_PERF_STATUS, out _, out uint edx))
|
||||||
{
|
{
|
||||||
_coreVoltage.Value = ((edx >> 32) & 0xFFFF) / (float)(1 << 13);
|
_coreVoltage.Value = ((edx >> 32) & 0xFFFF) / (float)(1 << 13);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
D3dkmdt.DXGK_ENGINE_TYPE.DXGK_ENGINE_TYPE_COPY => "D3D Copy",
|
D3dkmdt.DXGK_ENGINE_TYPE.DXGK_ENGINE_TYPE_COPY => "D3D Copy",
|
||||||
D3dkmdt.DXGK_ENGINE_TYPE.DXGK_ENGINE_TYPE_OVERLAY => "D3D Overlay",
|
D3dkmdt.DXGK_ENGINE_TYPE.DXGK_ENGINE_TYPE_OVERLAY => "D3D Overlay",
|
||||||
D3dkmdt.DXGK_ENGINE_TYPE.DXGK_ENGINE_TYPE_CRYPTO => "D3D Crypto",
|
D3dkmdt.DXGK_ENGINE_TYPE.DXGK_ENGINE_TYPE_CRYPTO => "D3D Crypto",
|
||||||
_ => "D3D Unknown",
|
_ => "D3D Unknown"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
D3dkmth.D3DKMT_OPENADAPTERFROMDEVICENAME adapter,
|
D3dkmth.D3DKMT_OPENADAPTERFROMDEVICENAME adapter,
|
||||||
out D3dkmth.D3DKMT_QUERYSTATISTICS_ADAPTER_INFORMATION adapterInformation)
|
out D3dkmth.D3DKMT_QUERYSTATISTICS_ADAPTER_INFORMATION adapterInformation)
|
||||||
{
|
{
|
||||||
var queryStatistics = new D3dkmth.D3DKMT_QUERYSTATISTICS { AdapterLuid = adapter.AdapterLuid, Type = D3dkmth.D3DKMT_QUERYSTATISTICS_TYPE.D3DKMT_QUERYSTATISTICS_ADAPTER, };
|
var queryStatistics = new D3dkmth.D3DKMT_QUERYSTATISTICS { AdapterLuid = adapter.AdapterLuid, Type = D3dkmth.D3DKMT_QUERYSTATISTICS_TYPE.D3DKMT_QUERYSTATISTICS_ADAPTER };
|
||||||
|
|
||||||
status = Gdi32.D3DKMTQueryStatistics(ref queryStatistics);
|
status = Gdi32.D3DKMTQueryStatistics(ref queryStatistics);
|
||||||
|
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ namespace LibreHardwareMonitor.Hardware.Gpu
|
|||||||
for (int i = 0; i < coolerSettings.Count; i++)
|
for (int i = 0; i < coolerSettings.Count; i++)
|
||||||
{
|
{
|
||||||
NvApi.NvCooler cooler = coolerSettings.Cooler[i];
|
NvApi.NvCooler cooler = coolerSettings.Cooler[i];
|
||||||
string name = "GPU Fan" + (coolerSettings.Count > 1 ? " " + (cooler.Controller) : string.Empty);
|
string name = "GPU Fan" + (coolerSettings.Count > 1 ? " " + cooler.Controller : string.Empty);
|
||||||
|
|
||||||
_controls[i] = new Sensor(name, i, SensorType.Control, this, settings);
|
_controls[i] = new Sensor(name, i, SensorType.Control, this, settings);
|
||||||
ActivateSensor(_controls[i]);
|
ActivateSensor(_controls[i]);
|
||||||
@@ -991,7 +991,7 @@ namespace LibreHardwareMonitor.Hardware.Gpu
|
|||||||
NvApi.NvThermalSettings settings = new()
|
NvApi.NvThermalSettings settings = new()
|
||||||
{
|
{
|
||||||
Version = (uint)NvApi.MAKE_NVAPI_VERSION<NvApi.NvThermalSettings>(1),
|
Version = (uint)NvApi.MAKE_NVAPI_VERSION<NvApi.NvThermalSettings>(1),
|
||||||
Count = NvApi.MAX_THERMAL_SENSORS_PER_GPU,
|
Count = NvApi.MAX_THERMAL_SENSORS_PER_GPU
|
||||||
};
|
};
|
||||||
|
|
||||||
status = NvApi.NvAPI_GPU_GetThermalSettings(_handle, (int)NvApi.NvThermalTarget.All, ref settings);
|
status = NvApi.NvAPI_GPU_GetThermalSettings(_handle, (int)NvApi.NvThermalTarget.All, ref settings);
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
if (_device == null)
|
if (_device == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
return Kernel32.DeviceIoControl(_device, ioControlCode, inBuffer, inBuffer == null ? 0 : (uint)Marshal.SizeOf(inBuffer), null, 0, out uint _, IntPtr.Zero);
|
return Kernel32.DeviceIoControl(_device, ioControlCode, inBuffer, inBuffer == null ? 0 : (uint)Marshal.SizeOf(inBuffer), null, 0, out uint _, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +125,6 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
if (_device == null)
|
if (_device == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
object boxedOutBuffer = outBuffer;
|
object boxedOutBuffer = outBuffer;
|
||||||
bool b = Kernel32.DeviceIoControl(_device,
|
bool b = Kernel32.DeviceIoControl(_device,
|
||||||
ioControlCode,
|
ioControlCode,
|
||||||
@@ -146,7 +144,6 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
if (_device == null)
|
if (_device == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
object boxedOutBuffer = outBuffer;
|
object boxedOutBuffer = outBuffer;
|
||||||
bool b = Kernel32.DeviceIoControl(_device,
|
bool b = Kernel32.DeviceIoControl(_device,
|
||||||
ioControlCode,
|
ioControlCode,
|
||||||
@@ -177,7 +174,6 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
if (manager == IntPtr.Zero)
|
if (manager == IntPtr.Zero)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
IntPtr service = AdvApi32.OpenService(manager, _serviceName, AdvApi32.SERVICE_ACCESS_MASK.SERVICE_ALL_ACCESS);
|
IntPtr service = AdvApi32.OpenService(manager, _serviceName, AdvApi32.SERVICE_ACCESS_MASK.SERVICE_ALL_ACCESS);
|
||||||
if (service == IntPtr.Zero)
|
if (service == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,10 +18,8 @@ namespace LibreHardwareMonitor.Hardware.Memory
|
|||||||
private readonly Sensor _virtualMemoryLoad;
|
private readonly Sensor _virtualMemoryLoad;
|
||||||
private readonly Sensor _virtualMemoryUsed;
|
private readonly Sensor _virtualMemoryUsed;
|
||||||
|
|
||||||
|
|
||||||
public override HardwareType HardwareType => HardwareType.Memory;
|
public override HardwareType HardwareType => HardwareType.Memory;
|
||||||
|
|
||||||
|
|
||||||
public GenericLinuxMemory(string name, ISettings settings) : base(name, new Identifier("ram"), settings)
|
public GenericLinuxMemory(string name, ISettings settings) : base(name, new Identifier("ram"), settings)
|
||||||
{
|
{
|
||||||
_physicalMemoryUsed = new Sensor("Memory Used", 0, SensorType.Data, this, settings);
|
_physicalMemoryUsed = new Sensor("Memory Used", 0, SensorType.Data, this, settings);
|
||||||
@@ -43,7 +41,6 @@ namespace LibreHardwareMonitor.Hardware.Memory
|
|||||||
ActivateSensor(_virtualMemoryLoad);
|
ActivateSensor(_virtualMemoryLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -83,7 +80,7 @@ namespace LibreHardwareMonitor.Hardware.Memory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private long GetMemInfoValue(string line)
|
private static long GetMemInfoValue(string line)
|
||||||
{
|
{
|
||||||
// Example: "MemTotal: 32849676 kB"
|
// Example: "MemTotal: 32849676 kB"
|
||||||
|
|
||||||
|
|||||||
@@ -14,14 +14,7 @@ namespace LibreHardwareMonitor.Hardware.Memory
|
|||||||
|
|
||||||
public MemoryGroup(ISettings settings)
|
public MemoryGroup(ISettings settings)
|
||||||
{
|
{
|
||||||
if (Software.OperatingSystem.IsUnix)
|
_hardware = new Hardware[] { Software.OperatingSystem.IsUnix ? new GenericLinuxMemory("Generic Memory", settings) : new GenericWindowsMemory("Generic Memory", settings) };
|
||||||
{
|
|
||||||
_hardware = new Hardware[] { new GenericLinuxMemory("Generic Memory", settings) };
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_hardware = new Hardware[] { new GenericWindowsMemory("Generic Memory", settings) };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetReport()
|
public string GetReport()
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
ECSensor.TempChipset,
|
ECSensor.TempChipset,
|
||||||
ECSensor.FanWaterPump,
|
ECSensor.FanWaterPump,
|
||||||
ECSensor.CurrCPU,
|
ECSensor.CurrCPU,
|
||||||
ECSensor.VoltageCPU),
|
ECSensor.VoltageCPU)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Dictionary<BoardFamily, Dictionary<ECSensor, EmbeddedControllerSource>> _knownSensors = new()
|
private static readonly Dictionary<BoardFamily, Dictionary<ECSensor, EmbeddedControllerSource>> _knownSensors = new()
|
||||||
@@ -173,7 +173,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
{ ECSensor.FanWaterFlow, new EmbeddedControllerSource("Water flow", SensorType.Flow, 0x00b4, 2, factor: 1.0f / 42f * 60f) },
|
{ ECSensor.FanWaterFlow, new EmbeddedControllerSource("Water flow", SensorType.Flow, 0x00b4, 2, factor: 1.0f / 42f * 60f) },
|
||||||
{ ECSensor.CurrCPU, new EmbeddedControllerSource("CPU", SensorType.Current, 0x00f4) },
|
{ ECSensor.CurrCPU, new EmbeddedControllerSource("CPU", SensorType.Current, 0x00f4) },
|
||||||
{ ECSensor.TempWaterIn, new EmbeddedControllerSource("Water In", SensorType.Temperature, 0x010d, blank: -40) },
|
{ ECSensor.TempWaterIn, new EmbeddedControllerSource("Water In", SensorType.Temperature, 0x010d, blank: -40) },
|
||||||
{ ECSensor.TempWaterOut, new EmbeddedControllerSource("Water Out", SensorType.Temperature, 0x010b, blank: -40) },
|
{ ECSensor.TempWaterOut, new EmbeddedControllerSource("Water Out", SensorType.Temperature, 0x010b, blank: -40) }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -192,7 +192,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
{ ECSensor.FanWaterFlow, new EmbeddedControllerSource("Water flow", SensorType.Flow, 0x00bc, 2, factor: 1.0f / 42f * 60f) },
|
{ ECSensor.FanWaterFlow, new EmbeddedControllerSource("Water flow", SensorType.Flow, 0x00bc, 2, factor: 1.0f / 42f * 60f) },
|
||||||
{ ECSensor.CurrCPU, new EmbeddedControllerSource("CPU", SensorType.Current, 0x00f4) },
|
{ ECSensor.CurrCPU, new EmbeddedControllerSource("CPU", SensorType.Current, 0x00f4) },
|
||||||
{ ECSensor.TempWaterIn, new EmbeddedControllerSource("Water In", SensorType.Temperature, 0x0100, blank: -40) },
|
{ ECSensor.TempWaterIn, new EmbeddedControllerSource("Water In", SensorType.Temperature, 0x0100, blank: -40) },
|
||||||
{ ECSensor.TempWaterOut, new EmbeddedControllerSource("Water Out", SensorType.Temperature, 0x0101, blank: -40) },
|
{ ECSensor.TempWaterOut, new EmbeddedControllerSource("Water Out", SensorType.Temperature, 0x0101, blank: -40) }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -202,7 +202,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
{ ECSensor.TempTSensor, new EmbeddedControllerSource("T Sensor", SensorType.Temperature, 0x003d, blank: -40) },
|
{ ECSensor.TempTSensor, new EmbeddedControllerSource("T Sensor", SensorType.Temperature, 0x003d, blank: -40) },
|
||||||
{ ECSensor.FanWaterPump, new EmbeddedControllerSource("Water Pump", SensorType.Fan, 0x00bc, 2) },
|
{ ECSensor.FanWaterPump, new EmbeddedControllerSource("Water Pump", SensorType.Fan, 0x00bc, 2) },
|
||||||
{ ECSensor.CurrCPU, new EmbeddedControllerSource("CPU", SensorType.Current, 0x00f4) },
|
{ ECSensor.CurrCPU, new EmbeddedControllerSource("CPU", SensorType.Current, 0x00f4) },
|
||||||
{ ECSensor.VoltageCPU, new EmbeddedControllerSource("CPU Core", SensorType.Voltage, 0x00a2, 2, factor: 1e-3f) },
|
{ ECSensor.VoltageCPU, new EmbeddedControllerSource("CPU Core", SensorType.Voltage, 0x00a2, 2, factor: 1e-3f) }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -213,9 +213,9 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
{ ECSensor.TempWaterIn, new EmbeddedControllerSource("Water In", SensorType.Temperature, 0x0100, blank: -40) },
|
{ ECSensor.TempWaterIn, new EmbeddedControllerSource("Water In", SensorType.Temperature, 0x0100, blank: -40) },
|
||||||
{ ECSensor.TempWaterOut, new EmbeddedControllerSource("Water Out", SensorType.Temperature, 0x0101, blank: -40) },
|
{ ECSensor.TempWaterOut, new EmbeddedControllerSource("Water Out", SensorType.Temperature, 0x0101, blank: -40) },
|
||||||
{ ECSensor.TempWaterBlockIn, new EmbeddedControllerSource("Water Block In", SensorType.Temperature, 0x0102, blank: -40) },
|
{ ECSensor.TempWaterBlockIn, new EmbeddedControllerSource("Water Block In", SensorType.Temperature, 0x0102, blank: -40) },
|
||||||
{ ECSensor.FanWaterFlow, new EmbeddedControllerSource("Water Flow", SensorType.Flow, 0x00be, 2, factor: 1.0f / 42f * 60f) }, // todo: need validation for this calculation
|
{ ECSensor.FanWaterFlow, new EmbeddedControllerSource("Water Flow", SensorType.Flow, 0x00be, 2, factor: 1.0f / 42f * 60f) } // todo: need validation for this calculation
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly byte[] _data;
|
private readonly byte[] _data;
|
||||||
@@ -260,11 +260,13 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
internal static EmbeddedController Create(Model model, ISettings settings)
|
internal static EmbeddedController Create(Model model, ISettings settings)
|
||||||
{
|
{
|
||||||
var boards = _boards.Where(b => b.Models.Contains(model)).ToList();
|
var boards = _boards.Where(b => b.Models.Contains(model)).ToList();
|
||||||
if (boards.Count == 0)
|
switch (boards.Count)
|
||||||
return null;
|
{
|
||||||
|
case 0:
|
||||||
if (boards.Count > 1)
|
return null;
|
||||||
throw new MultipleBoardRecordsFoundException(model.ToString());
|
case > 1:
|
||||||
|
throw new MultipleBoardRecordsFoundException(model.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
BoardInfo board = boards[0];
|
BoardInfo board = boards[0];
|
||||||
IEnumerable<EmbeddedControllerSource> sources = board.Sensors.Select(ecs => _knownSensors[board.Family][ecs]);
|
IEnumerable<EmbeddedControllerSource> sources = board.Sensors.Select(ecs => _knownSensors[board.Family][ecs]);
|
||||||
@@ -291,7 +293,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
{
|
{
|
||||||
1 => unchecked((sbyte)_data[readRegister]),
|
1 => unchecked((sbyte)_data[readRegister]),
|
||||||
2 => unchecked((short)((_data[readRegister] << 8) + _data[readRegister + 1])),
|
2 => unchecked((short)((_data[readRegister] << 8) + _data[readRegister + 1])),
|
||||||
_ => 0,
|
_ => 0
|
||||||
};
|
};
|
||||||
|
|
||||||
readRegister += _sources[si].Size;
|
readRegister += _sources[si].Size;
|
||||||
@@ -414,7 +416,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
Amd400,
|
Amd400,
|
||||||
Amd500,
|
Amd500,
|
||||||
Intel100,
|
Intel100,
|
||||||
Intel600,
|
Intel600
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct BoardInfo
|
private struct BoardInfo
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
WriteLoop(register, value, WriteByteOp);
|
WriteLoop(register, value, WriteByteOp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (!_disposed)
|
if (!_disposed)
|
||||||
@@ -202,7 +201,6 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc.EC
|
|||||||
SmiEventPending = 0x40 // SMI_EVT
|
SmiEventPending = 0x40 // SMI_EVT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Read/Write ops
|
#region Read/Write ops
|
||||||
|
|
||||||
protected bool ReadByteOp(byte register, out byte value)
|
protected bool ReadByteOp(byte register, out byte value)
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
Chip.IT8613E or Chip.IT8620E or Chip.IT8628E or Chip.IT8631E or Chip.IT8721F or Chip.IT8728F or Chip.IT8771E or Chip.IT8772E or Chip.IT8686E or Chip.IT8688E or Chip.IT8689E => 0.012f,
|
Chip.IT8613E or Chip.IT8620E or Chip.IT8628E or Chip.IT8631E or Chip.IT8721F or Chip.IT8728F or Chip.IT8771E or Chip.IT8772E or Chip.IT8686E or Chip.IT8688E or Chip.IT8689E => 0.012f,
|
||||||
Chip.IT8695E => 11f / 1000f,
|
Chip.IT8695E => 11f / 1000f,
|
||||||
Chip.IT8655E or Chip.IT8665E or Chip.IT879XE => 0.0109f,
|
Chip.IT8655E or Chip.IT8665E or Chip.IT879XE => 0.0109f,
|
||||||
_ => 0.016f,
|
_ => 0.016f
|
||||||
};
|
};
|
||||||
|
|
||||||
// Older IT8705F and IT8721F revisions do not have 16-bit fan counters.
|
// Older IT8705F and IT8721F revisions do not have 16-bit fan counters.
|
||||||
@@ -209,7 +209,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
{
|
{
|
||||||
Chip.IT8712F or Chip.IT8716F or Chip.IT8718F or Chip.IT8726F => 5,
|
Chip.IT8712F or Chip.IT8716F or Chip.IT8718F or Chip.IT8726F => 5,
|
||||||
Chip.IT8720F or Chip.IT8721F => 8,
|
Chip.IT8720F or Chip.IT8721F => 8,
|
||||||
_ => 0,
|
_ => 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,7 +558,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
// Address of the Fan Controller Main Control Register.
|
// Address of the Fan Controller Main Control Register.
|
||||||
// No need for the 2nd control register (bit 7 of 0x15 0x16 0x17),
|
// No need for the 2nd control register (bit 7 of 0x15 0x16 0x17),
|
||||||
// as PWM value will set it to manual mode when new value is set.
|
// as PWM value will set it to manual mode when new value is set.
|
||||||
private readonly byte FAN_MAIN_CTRL_REG = 0x13;
|
private const byte FAN_MAIN_CTRL_REG = 0x13;
|
||||||
|
|
||||||
#pragma warning restore IDE1006 // Naming Styles
|
#pragma warning restore IDE1006 // Naming Styles
|
||||||
// ReSharper restore InconsistentNaming
|
// ReSharper restore InconsistentNaming
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
string name = null;
|
string name = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (StreamReader reader = new(path + "/name"))
|
using StreamReader reader = new(path + "/name");
|
||||||
name = reader.ReadLine();
|
name = reader.ReadLine();
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{ }
|
{ }
|
||||||
@@ -260,14 +260,14 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ReadFirstLine(Stream stream)
|
private static string ReadFirstLine(Stream stream)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
int b = stream.ReadByte();
|
int b = stream.ReadByte();
|
||||||
while (b is not (-1) and not 10)
|
while (b is not -1 and not 10)
|
||||||
{
|
{
|
||||||
sb.Append((char)b);
|
sb.Append((char)b);
|
||||||
b = stream.ReadByte();
|
b = stream.ReadByte();
|
||||||
|
|||||||
@@ -520,76 +520,31 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
port.IT87Enter();
|
port.IT87Enter();
|
||||||
|
|
||||||
ushort chipId = port.ReadWord(CHIP_ID_REGISTER);
|
ushort chipId = port.ReadWord(CHIP_ID_REGISTER);
|
||||||
Chip chip;
|
Chip chip = chipId switch
|
||||||
switch (chipId)
|
|
||||||
{
|
{
|
||||||
case 0x8613:
|
0x8613 => Chip.IT8613E,
|
||||||
chip = Chip.IT8613E;
|
0x8620 => Chip.IT8620E,
|
||||||
break;
|
0x8628 => Chip.IT8628E,
|
||||||
case 0x8620:
|
0x8631 => Chip.IT8631E,
|
||||||
chip = Chip.IT8620E;
|
0x8665 => Chip.IT8665E,
|
||||||
break;
|
0x8655 => Chip.IT8655E,
|
||||||
case 0x8628:
|
0x8686 => Chip.IT8686E,
|
||||||
chip = Chip.IT8628E;
|
0x8688 => Chip.IT8688E,
|
||||||
break;
|
0x8689 => Chip.IT8689E,
|
||||||
case 0x8631:
|
0x8695 => Chip.IT8695E,
|
||||||
chip = Chip.IT8631E;
|
0x8705 => Chip.IT8705F,
|
||||||
break;
|
0x8712 => Chip.IT8712F,
|
||||||
case 0x8665:
|
0x8716 => Chip.IT8716F,
|
||||||
chip = Chip.IT8665E;
|
0x8718 => Chip.IT8718F,
|
||||||
break;
|
0x8720 => Chip.IT8720F,
|
||||||
case 0x8655:
|
0x8721 => Chip.IT8721F,
|
||||||
chip = Chip.IT8655E;
|
0x8726 => Chip.IT8726F,
|
||||||
break;
|
0x8728 => Chip.IT8728F,
|
||||||
case 0x8686:
|
0x8771 => Chip.IT8771E,
|
||||||
chip = Chip.IT8686E;
|
0x8772 => Chip.IT8772E,
|
||||||
break;
|
0x8733 => Chip.IT879XE,
|
||||||
case 0x8688:
|
_ => Chip.Unknown
|
||||||
chip = Chip.IT8688E;
|
};
|
||||||
break;
|
|
||||||
case 0x8689:
|
|
||||||
chip = Chip.IT8689E;
|
|
||||||
break;
|
|
||||||
case 0x8695:
|
|
||||||
chip = Chip.IT8695E;
|
|
||||||
break;
|
|
||||||
case 0x8705:
|
|
||||||
chip = Chip.IT8705F;
|
|
||||||
break;
|
|
||||||
case 0x8712:
|
|
||||||
chip = Chip.IT8712F;
|
|
||||||
break;
|
|
||||||
case 0x8716:
|
|
||||||
chip = Chip.IT8716F;
|
|
||||||
break;
|
|
||||||
case 0x8718:
|
|
||||||
chip = Chip.IT8718F;
|
|
||||||
break;
|
|
||||||
case 0x8720:
|
|
||||||
chip = Chip.IT8720F;
|
|
||||||
break;
|
|
||||||
case 0x8721:
|
|
||||||
chip = Chip.IT8721F;
|
|
||||||
break;
|
|
||||||
case 0x8726:
|
|
||||||
chip = Chip.IT8726F;
|
|
||||||
break;
|
|
||||||
case 0x8728:
|
|
||||||
chip = Chip.IT8728F;
|
|
||||||
break;
|
|
||||||
case 0x8771:
|
|
||||||
chip = Chip.IT8771E;
|
|
||||||
break;
|
|
||||||
case 0x8772:
|
|
||||||
chip = Chip.IT8772E;
|
|
||||||
break;
|
|
||||||
case 0x8733:
|
|
||||||
chip = Chip.IT879XE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
chip = Chip.Unknown;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chip == Chip.Unknown)
|
if (chip == Chip.Unknown)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
public readonly int HalfBit;
|
public readonly int HalfBit;
|
||||||
public readonly ushort SourceRegister;
|
public readonly ushort SourceRegister;
|
||||||
public readonly ushort? AlternateRegister;
|
public readonly ushort? AlternateRegister;
|
||||||
};
|
}
|
||||||
|
|
||||||
private readonly ushort[] _fanCountRegister;
|
private readonly ushort[] _fanCountRegister;
|
||||||
private readonly ushort[] _fanRpmRegister;
|
private readonly ushort[] _fanRpmRegister;
|
||||||
@@ -280,7 +280,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
new(null, 0x106),
|
new(null, 0x106),
|
||||||
new(null, 0x108),
|
new(null, 0x108),
|
||||||
new(null, 0x10A),
|
new(null, 0x10A),
|
||||||
new(null, 0x10C),
|
new(null, 0x10C)
|
||||||
};
|
};
|
||||||
|
|
||||||
// VIN0 +12V
|
// VIN0 +12V
|
||||||
@@ -426,7 +426,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
if (valid && _voltageRegisters[i] == _voltageVBatRegister)
|
if (valid && _voltageRegisters[i] == _voltageVBatRegister)
|
||||||
valid = (ReadByte(_vBatMonitorControlRegister) & 0x01) > 0;
|
valid = (ReadByte(_vBatMonitorControlRegister) & 0x01) > 0;
|
||||||
|
|
||||||
Voltages[i] = valid ? value : (float?)null;
|
Voltages[i] = valid ? value : null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -501,7 +501,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
|
|
||||||
temperature = 0.5f * value;
|
temperature = 0.5f * value;
|
||||||
System.Diagnostics.Debug.WriteLine("Temperature register {0} final temperature: {1}.", i, temperature);
|
System.Diagnostics.Debug.WriteLine("Temperature register {0} final temperature: {1}.", i, temperature);
|
||||||
if (temperature is > 125 or < (-55))
|
if (temperature is > 125 or < -55)
|
||||||
{
|
{
|
||||||
temperature = null;
|
temperature = null;
|
||||||
System.Diagnostics.Debug.WriteLine("Temperature register {0} discarded: Out of range.", i);
|
System.Diagnostics.Debug.WriteLine("Temperature register {0} discarded: Out of range.", i);
|
||||||
@@ -533,7 +533,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
temperatureSourceMask |= 1L << (byte)source;
|
temperatureSourceMask |= 1L << (byte)source;
|
||||||
|
|
||||||
temperature = 0.5f * value;
|
temperature = 0.5f * value;
|
||||||
if (temperature is > 125 or < (-55))
|
if (temperature is > 125 or < -55)
|
||||||
temperature = null;
|
temperature = null;
|
||||||
|
|
||||||
for (int j = 0; j < Temperatures.Length; j++)
|
for (int j = 0; j < Temperatures.Length; j++)
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
private readonly byte[] _initialFanTertiaryControlValue = Array.Empty<byte>();
|
private readonly byte[] _initialFanTertiaryControlValue = Array.Empty<byte>();
|
||||||
private readonly bool[] _restoreDefaultFanPwmControlRequired = Array.Empty<bool>();
|
private readonly bool[] _restoreDefaultFanPwmControlRequired = Array.Empty<bool>();
|
||||||
|
|
||||||
|
|
||||||
public W836XX(Chip chip, byte revision, ushort address)
|
public W836XX(Chip chip, byte revision, ushort address)
|
||||||
{
|
{
|
||||||
_address = address;
|
_address = address;
|
||||||
@@ -376,12 +375,16 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
|
|
||||||
Fans[i] = count < 0xff ? 1.35e6f / (count * divisor) : 0;
|
Fans[i] = count < 0xff ? 1.35e6f / (count * divisor) : 0;
|
||||||
|
|
||||||
// update fan divisor
|
switch (count)
|
||||||
if (count > 192 && divisorBits < 7)
|
{
|
||||||
divisorBits++;
|
// update fan divisor
|
||||||
|
case > 192 when divisorBits < 7:
|
||||||
if (count < 96 && divisorBits > 0)
|
divisorBits++;
|
||||||
divisorBits--;
|
break;
|
||||||
|
case < 96 when divisorBits > 0:
|
||||||
|
divisorBits--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
newBits = SetBit(newBits, FAN_DIV_BIT2[i], (divisorBits >> 2) & 1);
|
newBits = SetBit(newBits, FAN_DIV_BIT2[i], (divisorBits >> 2) & 1);
|
||||||
newBits = SetBit(newBits, FAN_DIV_BIT1[i], (divisorBits >> 1) & 1);
|
newBits = SetBit(newBits, FAN_DIV_BIT1[i], (divisorBits >> 1) & 1);
|
||||||
@@ -391,7 +394,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard.Lpc
|
|||||||
for (int i = 0; i < Controls.Length; i++)
|
for (int i = 0; i < Controls.Length; i++)
|
||||||
{
|
{
|
||||||
byte value = ReadByte(0, _fanPwmRegister[i]);
|
byte value = ReadByte(0, _fanPwmRegister[i]);
|
||||||
Controls[i] = (float)Math.Round((value) * 100.0f / 0xFF);
|
Controls[i] = (float)Math.Round(value * 100.0f / 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ring0.ReleaseIsaBusMutex();
|
Ring0.ReleaseIsaBusMutex();
|
||||||
|
|||||||
@@ -2146,7 +2146,6 @@ namespace LibreHardwareMonitor.Hardware.Motherboard
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case Model.AB350_Pro4: //NCT6779D
|
case Model.AB350_Pro4: //NCT6779D
|
||||||
case Model.AB350M_Pro4:
|
case Model.AB350M_Pro4:
|
||||||
case Model.AB350M:
|
case Model.AB350M:
|
||||||
@@ -2288,7 +2287,6 @@ namespace LibreHardwareMonitor.Hardware.Motherboard
|
|||||||
c.Add(new Ctrl("Chipset Fan", 3));
|
c.Add(new Ctrl("Chipset Fan", 3));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
v.Add(new Voltage("Vcore", 0, 10, 10));
|
v.Add(new Voltage("Vcore", 0, 10, 10));
|
||||||
v.Add(new Voltage("Voltage #2", 1, true));
|
v.Add(new Voltage("Voltage #2", 1, true));
|
||||||
@@ -2526,7 +2524,7 @@ namespace LibreHardwareMonitor.Hardware.Motherboard
|
|||||||
fanControlNames = new[] {"Chassis Fan 1", "CPU Fan", "Chassis Fan 2",
|
fanControlNames = new[] {"Chassis Fan 1", "CPU Fan", "Chassis Fan 2",
|
||||||
"Chassis Fan 3", "High Amp Fan", "W_PUMP+", "AIO Pump"};
|
"Chassis Fan 3", "High Amp Fan", "W_PUMP+", "AIO Pump"};
|
||||||
System.Diagnostics.Debug.Assert(fanControlNames.Length == superIO.Fans.Length,
|
System.Diagnostics.Debug.Assert(fanControlNames.Length == superIO.Fans.Length,
|
||||||
string.Format("Expected {0} fan register in the SuperIO chip", fanControlNames.Length));
|
$"Expected {fanControlNames.Length} fan register in the SuperIO chip");
|
||||||
System.Diagnostics.Debug.Assert(superIO.Fans.Length == superIO.Controls.Length,
|
System.Diagnostics.Debug.Assert(superIO.Fans.Length == superIO.Controls.Length,
|
||||||
"Expected counts of cans controls and fan speed registers to be equal");
|
"Expected counts of cans controls and fan speed registers to be equal");
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ namespace LibreHardwareMonitor.Hardware.Network
|
|||||||
if (NetworkInterface == null)
|
if (NetworkInterface == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
long newTick = Stopwatch.GetTimestamp();
|
long newTick = Stopwatch.GetTimestamp();
|
||||||
double dt = new TimeSpan(newTick - _lastTick).TotalSeconds;
|
double dt = new TimeSpan(newTick - _lastTick).TotalSeconds;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace LibreHardwareMonitor.Hardware.Network
|
|||||||
private readonly Dictionary<string, Network> _networks = new();
|
private readonly Dictionary<string, Network> _networks = new();
|
||||||
private readonly object _scanLock = new();
|
private readonly object _scanLock = new();
|
||||||
private readonly ISettings _settings;
|
private readonly ISettings _settings;
|
||||||
private List<Network> _hardware = new();
|
private readonly List<Network> _hardware = new();
|
||||||
|
|
||||||
public NetworkGroup(ISettings settings)
|
public NetworkGroup(ISettings settings)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -237,7 +237,6 @@ namespace LibreHardwareMonitor.Hardware.Psu.Corsair
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Exception classes
|
#region Exception classes
|
||||||
|
|
||||||
public class CommunicationProtocolError : ApplicationException
|
public class CommunicationProtocolError : ApplicationException
|
||||||
@@ -249,7 +248,6 @@ namespace LibreHardwareMonitor.Hardware.Psu.Corsair
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region PSU USB communication protocol implementation
|
#region PSU USB communication protocol implementation
|
||||||
|
|
||||||
internal static class UsbApi
|
internal static class UsbApi
|
||||||
@@ -267,8 +265,8 @@ namespace LibreHardwareMonitor.Hardware.Psu.Corsair
|
|||||||
#endif
|
#endif
|
||||||
static float Linear11ToFloat32(ushort val)
|
static float Linear11ToFloat32(ushort val)
|
||||||
{
|
{
|
||||||
int exp = ((short)val) >> 11;
|
int exp = (short)val >> 11;
|
||||||
int mant = (((short)(val & 0x7ff)) << 5) >> 5;
|
int mant = ((short)(val & 0x7ff) << 5) >> 5;
|
||||||
return mant * (float)Math.Pow(2, exp);
|
return mant * (float)Math.Pow(2, exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,7 +402,7 @@ namespace LibreHardwareMonitor.Hardware.Psu.Corsair
|
|||||||
Command.RAIL_VOLTS_HCRIT or Command.RAIL_VOLTS_LCRIT or Command.RAIL_AMPS_HCRIT or Command.TEMP_HCRIT or Command.IN_VOLTS or Command.IN_AMPS or Command.RAIL_VOLTS or Command.RAIL_AMPS
|
Command.RAIL_VOLTS_HCRIT or Command.RAIL_VOLTS_LCRIT or Command.RAIL_AMPS_HCRIT or Command.TEMP_HCRIT or Command.IN_VOLTS or Command.IN_AMPS or Command.RAIL_VOLTS or Command.RAIL_AMPS
|
||||||
or Command.TEMP0 or Command.TEMP1 or Command.FAN_RPM or Command.RAIL_WATTS or Command.TOTAL_WATTS => Linear11ToFloat32((ushort)tmp), // Linear11ToInt((ushort)tmp, 1000000);
|
or Command.TEMP0 or Command.TEMP1 or Command.FAN_RPM or Command.RAIL_WATTS or Command.TOTAL_WATTS => Linear11ToFloat32((ushort)tmp), // Linear11ToInt((ushort)tmp, 1000000);
|
||||||
Command.TOTAL_UPTIME or Command.UPTIME or Command.OCPMODE => tmp,
|
Command.TOTAL_UPTIME or Command.UPTIME or Command.OCPMODE => tmp,
|
||||||
_ => null,
|
_ => null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace LibreHardwareMonitor.Hardware.Psu.Corsair
|
|||||||
0x1c0a, // RM650i
|
0x1c0a, // RM650i
|
||||||
0x1c0b, // RM750i
|
0x1c0b, // RM750i
|
||||||
0x1c0c, // RM850i
|
0x1c0c, // RM850i
|
||||||
0x1c0d, // RM1000i
|
0x1c0d // RM1000i
|
||||||
// 0x1c11, // AX1600i
|
// 0x1c11, // AX1600i
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_report.Append("Status: Installing driver \"").Append(_filePath).Append("\" failed").AppendLine((File.Exists(_filePath) ? " and file exists" : string.Empty));
|
_report.Append("Status: Installing driver \"").Append(_filePath).Append("\" failed").AppendLine(File.Exists(_filePath) ? " and file exists" : string.Empty);
|
||||||
_report.Append("First Exception: ").AppendLine(installError);
|
_report.Append("First Exception: ").AppendLine(installError);
|
||||||
_report.Append("Second Exception: ").AppendLine(secondError);
|
_report.Append("Second Exception: ").AppendLine(secondError);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
{ 166, new SmuSensorType { Name = "Fabric", Type = SensorType.Clock, Scale = 1 } },
|
{ 166, new SmuSensorType { Name = "Fabric", Type = SensorType.Clock, Scale = 1 } },
|
||||||
{ 177, new SmuSensorType { Name = "Uncore", Type = SensorType.Clock, Scale = 1 } },
|
{ 177, new SmuSensorType { Name = "Uncore", Type = SensorType.Clock, Scale = 1 } },
|
||||||
{ 178, new SmuSensorType { Name = "Memory", Type = SensorType.Clock, Scale = 1 } },
|
{ 178, new SmuSensorType { Name = "Memory", Type = SensorType.Clock, Scale = 1 } },
|
||||||
{ 342, new SmuSensorType { Name = "Displays", Type = SensorType.Factor, Scale = 1 } },
|
{ 342, new SmuSensorType { Name = "Displays", Type = SensorType.Factor, Scale = 1 } }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
{ 48, new SmuSensorType { Name = "Fabric", Type = SensorType.Clock, Scale = 1 } },
|
{ 48, new SmuSensorType { Name = "Fabric", Type = SensorType.Clock, Scale = 1 } },
|
||||||
{ 50, new SmuSensorType { Name = "Uncore", Type = SensorType.Clock, Scale = 1 } },
|
{ 50, new SmuSensorType { Name = "Uncore", Type = SensorType.Clock, Scale = 1 } },
|
||||||
{ 51, new SmuSensorType { Name = "Memory", Type = SensorType.Clock, Scale = 1 } },
|
{ 51, new SmuSensorType { Name = "Memory", Type = SensorType.Clock, Scale = 1 } },
|
||||||
{ 115, new SmuSensorType { Name = "SoC", Type = SensorType.Temperature, Scale = 1 } },
|
{ 115, new SmuSensorType { Name = "SoC", Type = SensorType.Temperature, Scale = 1 } }
|
||||||
//{ 66, new SmuSensorType { Name = "Bus Speed", Type = SensorType.Clock, Scale = 1 } },
|
//{ 66, new SmuSensorType { Name = "Bus Speed", Type = SensorType.Clock, Scale = 1 } },
|
||||||
//{ 188, new SmuSensorType { Name = "Core #1", Type = SensorType.Clock, Scale = 1000 } },
|
//{ 188, new SmuSensorType { Name = "Core #1", Type = SensorType.Clock, Scale = 1000 } },
|
||||||
//{ 189, new SmuSensorType { Name = "Core #2", Type = SensorType.Clock, Scale = 1000 } },
|
//{ 189, new SmuSensorType { Name = "Core #2", Type = SensorType.Clock, Scale = 1000 } },
|
||||||
@@ -99,7 +99,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
{ 280, new SmuSensorType { Name = "Core #13 (Effective)", Type = SensorType.Clock, Scale = 1000 } },
|
{ 280, new SmuSensorType { Name = "Core #13 (Effective)", Type = SensorType.Clock, Scale = 1000 } },
|
||||||
{ 281, new SmuSensorType { Name = "Core #14 (Effective)", Type = SensorType.Clock, Scale = 1000 } },
|
{ 281, new SmuSensorType { Name = "Core #14 (Effective)", Type = SensorType.Clock, Scale = 1000 } },
|
||||||
{ 282, new SmuSensorType { Name = "Core #15 (Effective)", Type = SensorType.Clock, Scale = 1000 } },
|
{ 282, new SmuSensorType { Name = "Core #15 (Effective)", Type = SensorType.Clock, Scale = 1000 } },
|
||||||
{ 283, new SmuSensorType { Name = "Core #16 (Effective)", Type = SensorType.Clock, Scale = 1000 } },
|
{ 283, new SmuSensorType { Name = "Core #16 (Effective)", Type = SensorType.Clock, Scale = 1000 } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -141,7 +141,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
0x60 => CpuCodeName.Renoir,
|
0x60 => CpuCodeName.Renoir,
|
||||||
0x71 => CpuCodeName.Matisse,
|
0x71 => CpuCodeName.Matisse,
|
||||||
0x90 => CpuCodeName.Vangogh,
|
0x90 => CpuCodeName.Vangogh,
|
||||||
_ => CpuCodeName.Undefined,
|
_ => CpuCodeName.Undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
0x20 or 0x21 => CpuCodeName.Vermeer,
|
0x20 or 0x21 => CpuCodeName.Vermeer,
|
||||||
0x40 => CpuCodeName.Rembrandt,
|
0x40 => CpuCodeName.Rembrandt,
|
||||||
0x50 => CpuCodeName.Cezanne,
|
0x50 => CpuCodeName.Cezanne,
|
||||||
_ => CpuCodeName.Undefined,
|
_ => CpuCodeName.Undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
_32Way,
|
_32Way,
|
||||||
_48Way,
|
_48Way,
|
||||||
_64Way,
|
_64Way,
|
||||||
_20Way,
|
_20Way
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -477,7 +477,7 @@ namespace LibreHardwareMonitor.Hardware
|
|||||||
HBM = 0x20,
|
HBM = 0x20,
|
||||||
HBM2 = 0x21,
|
HBM2 = 0x21,
|
||||||
DDR5 = 0x22,
|
DDR5 = 0x22,
|
||||||
LPDDR5 = 0x23,
|
LPDDR5 = 0x23
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InformationBase
|
public class InformationBase
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
if (!allAttributesFound)
|
if (!allAttributesFound)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
// check if there is a matching name prefix for this type
|
// check if there is a matching name prefix for this type
|
||||||
if (type.GetCustomAttributes(typeof(NamePrefixAttribute), true) is NamePrefixAttribute[] namePrefixes)
|
if (type.GetCustomAttributes(typeof(NamePrefixAttribute), true) is NamePrefixAttribute[] namePrefixes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
internal class DebugSmart : ISmart
|
internal class DebugSmart : ISmart
|
||||||
{
|
{
|
||||||
private readonly Drive[] _drives = {
|
private readonly Drive[] _drives = {
|
||||||
new Drive("KINGSTON SNV425S264GB", null, 16,
|
new("KINGSTON SNV425S264GB", null, 16,
|
||||||
@" 01 000000000000 100 100
|
@" 01 000000000000 100 100
|
||||||
02 000000000000 100 100
|
02 000000000000 100 100
|
||||||
03 000000000000 100 100
|
03 000000000000 100 100
|
||||||
@@ -32,7 +32,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
F0 000000000000 100 100
|
F0 000000000000 100 100
|
||||||
AA 07007B000000 100 100
|
AA 07007B000000 100 100
|
||||||
AD 0E1E71304919 100 100"),
|
AD 0E1E71304919 100 100"),
|
||||||
new Drive("PLEXTOR PX-128M2S", "1.03", 16,
|
new("PLEXTOR PX-128M2S", "1.03", 16,
|
||||||
@" 01 000000000000 100 100 0
|
@" 01 000000000000 100 100 0
|
||||||
03 000000000000 100 100 0
|
03 000000000000 100 100 0
|
||||||
04 000000000000 100 100 0
|
04 000000000000 100 100 0
|
||||||
@@ -50,7 +50,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
C5 000000000000 100 100 0
|
C5 000000000000 100 100 0
|
||||||
C6 000000000000 100 100 0
|
C6 000000000000 100 100 0
|
||||||
C7 000000000000 100 100 0"),
|
C7 000000000000 100 100 0"),
|
||||||
new Drive("OCZ-VERTEX2", "1.25", 16,
|
new("OCZ-VERTEX2", "1.25", 16,
|
||||||
@" 01 DADAD5000000 100 106 50
|
@" 01 DADAD5000000 100 106 50
|
||||||
05 000000000000 100 100 3
|
05 000000000000 100 100 3
|
||||||
09 DF0900004A2F 100 100 0
|
09 DF0900004A2F 100 100 0
|
||||||
@@ -70,7 +70,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
EA 000600000000 0 0 0
|
EA 000600000000 0 0 0
|
||||||
F1 000600000000 0 0 0
|
F1 000600000000 0 0 0
|
||||||
F2 801200000000 0 0 0"),
|
F2 801200000000 0 0 0"),
|
||||||
new Drive("WDC WD5000AADS-00S9B0", null, 10,
|
new("WDC WD5000AADS-00S9B0", null, 10,
|
||||||
@" 1 000000000000 200 200
|
@" 1 000000000000 200 200
|
||||||
3 820D00000000 149 150
|
3 820D00000000 149 150
|
||||||
4 610800000000 98 98
|
4 610800000000 98 98
|
||||||
@@ -91,7 +91,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
130 7B0300010002 1 41
|
130 7B0300010002 1 41
|
||||||
5 000000000000 0 0
|
5 000000000000 0 0
|
||||||
1 000000000000 0 0"),
|
1 000000000000 0 0"),
|
||||||
new Drive("INTEL SSDSA2M080G2GC", null, 10,
|
new("INTEL SSDSA2M080G2GC", null, 10,
|
||||||
@" 3 000000000000 100 100
|
@" 3 000000000000 100 100
|
||||||
4 000000000000 100 100
|
4 000000000000 100 100
|
||||||
5 010000000000 100 100
|
5 010000000000 100 100
|
||||||
@@ -106,7 +106,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
233 000000000000 98 98
|
233 000000000000 98 98
|
||||||
184 000000000000 100 100
|
184 000000000000 100 100
|
||||||
1 000000000000 0 0"),
|
1 000000000000 0 0"),
|
||||||
new Drive("OCZ-VERTEX", null, 10,
|
new("OCZ-VERTEX", null, 10,
|
||||||
@" 1 000000000000 0 8
|
@" 1 000000000000 0 8
|
||||||
9 000000000000 30 99
|
9 000000000000 30 99
|
||||||
12 000000000000 0 15
|
12 000000000000 0 15
|
||||||
@@ -129,7 +129,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
211 000000000000 0 0
|
211 000000000000 0 0
|
||||||
212 000000000000 0 0
|
212 000000000000 0 0
|
||||||
213 000000000000 0 0"),
|
213 000000000000 0 0"),
|
||||||
new Drive("INTEL SSDSA2CW120G3", null, 16,
|
new("INTEL SSDSA2CW120G3", null, 16,
|
||||||
@"03 000000000000 100 100 0
|
@"03 000000000000 100 100 0
|
||||||
04 000000000000 100 100 0
|
04 000000000000 100 100 0
|
||||||
05 000000000000 100 100 0
|
05 000000000000 100 100 0
|
||||||
@@ -149,7 +149,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
E9 000000000000 100 100 0
|
E9 000000000000 100 100 0
|
||||||
F1 FF4300000000 100 100 0
|
F1 FF4300000000 100 100 0
|
||||||
F2 264F00000000 100 100 0"),
|
F2 264F00000000 100 100 0"),
|
||||||
new Drive("CORSAIR CMFSSD-128GBG2D", "VBM19C1Q", 16,
|
new("CORSAIR CMFSSD-128GBG2D", "VBM19C1Q", 16,
|
||||||
@"09 100900000000 99 99 0
|
@"09 100900000000 99 99 0
|
||||||
0C 560200000000 99 99 0
|
0C 560200000000 99 99 0
|
||||||
AF 000000000000 100 100 10
|
AF 000000000000 100 100 10
|
||||||
@@ -167,7 +167,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
C7 810100000000 253 253 0
|
C7 810100000000 253 253 0
|
||||||
E8 240000000000 60 60 10
|
E8 240000000000 60 60 10
|
||||||
E9 630594120000 92 92 0"),
|
E9 630594120000 92 92 0"),
|
||||||
new Drive("Maxtor 6L300R0", null, 10,
|
new("Maxtor 6L300R0", null, 10,
|
||||||
@"3 9E5500000000 183 193
|
@"3 9E5500000000 183 193
|
||||||
4 0A0D00000000 252 252
|
4 0A0D00000000 252 252
|
||||||
5 010000000000 253 253
|
5 010000000000 253 253
|
||||||
@@ -202,7 +202,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
59 FC3203030100 205 0
|
59 FC3203030100 205 0
|
||||||
1 000000000000 0 0
|
1 000000000000 0 0
|
||||||
144 000000000000 0 34 "),
|
144 000000000000 0 34 "),
|
||||||
new Drive("M4-CT256M4SSD2", "0309", 16,
|
new("M4-CT256M4SSD2", "0309", 16,
|
||||||
@"01 000000000000 100 100 50
|
@"01 000000000000 100 100 50
|
||||||
05 000000000000 100 100 10
|
05 000000000000 100 100 10
|
||||||
09 AB0100000000 100 100 1
|
09 AB0100000000 100 100 1
|
||||||
@@ -226,7 +226,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
C7 000000000000 100 100 1
|
C7 000000000000 100 100 1
|
||||||
CA 000000000000 100 100 1
|
CA 000000000000 100 100 1
|
||||||
CE 000000000000 100 100 1 "),
|
CE 000000000000 100 100 1 "),
|
||||||
new Drive("C300-CTFDDAC256MAG", "0007", 16,
|
new("C300-CTFDDAC256MAG", "0007", 16,
|
||||||
@"01 000000000000 100 100 0
|
@"01 000000000000 100 100 0
|
||||||
05 000000000000 100 100 0
|
05 000000000000 100 100 0
|
||||||
09 4C0A00000000 100 100 0
|
09 4C0A00000000 100 100 0
|
||||||
@@ -249,7 +249,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
C7 000000000000 100 100 0
|
C7 000000000000 100 100 0
|
||||||
CA 000000000000 100 100 0
|
CA 000000000000 100 100 0
|
||||||
CE 000000000000 100 100 0"),
|
CE 000000000000 100 100 0"),
|
||||||
new Drive("M4-CT064M4SSD2", "0009", 16,
|
new("M4-CT064M4SSD2", "0009", 16,
|
||||||
@"01 000000000000 100 100 50
|
@"01 000000000000 100 100 50
|
||||||
05 000000000000 100 100 10
|
05 000000000000 100 100 10
|
||||||
09 260000000000 100 100 1
|
09 260000000000 100 100 1
|
||||||
@@ -273,7 +273,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
C7 000000000000 100 100 1
|
C7 000000000000 100 100 1
|
||||||
CA 000000000000 100 100 1
|
CA 000000000000 100 100 1
|
||||||
CE 000000000000 100 100 1"),
|
CE 000000000000 100 100 1"),
|
||||||
new Drive("M4-CT128M4SSD2", "000F", 16,
|
new("M4-CT128M4SSD2", "000F", 16,
|
||||||
@"01 000000000000 100 100 50
|
@"01 000000000000 100 100 50
|
||||||
05 000000000000 100 100 10
|
05 000000000000 100 100 10
|
||||||
09 CA1400000000 100 100 1
|
09 CA1400000000 100 100 1
|
||||||
@@ -297,7 +297,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
C7 000000000000 100 100 1
|
C7 000000000000 100 100 1
|
||||||
CA 010000000000 99 99 1
|
CA 010000000000 99 99 1
|
||||||
CE 000000000000 100 100 1 "),
|
CE 000000000000 100 100 1 "),
|
||||||
new Drive("Samsung SSD 840 PRO Series", "DXM05B0Q", 16,
|
new("Samsung SSD 840 PRO Series", "DXM05B0Q", 16,
|
||||||
@"05 000000000000 100 100 10
|
@"05 000000000000 100 100 10
|
||||||
09 541200000000 99 99 0
|
09 541200000000 99 99 0
|
||||||
0C 820500000000 98 98 0
|
0C 820500000000 98 98 0
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
new SmartAttribute(0xF2, SmartNames.TotalLbasRead),
|
new SmartAttribute(0xF2, SmartNames.TotalLbasRead),
|
||||||
new SmartAttribute(0xFA, SmartNames.ReadErrorRetryRate),
|
new SmartAttribute(0xFA, SmartNames.ReadErrorRetryRate),
|
||||||
new SmartAttribute(0xFE, SmartNames.FreeFallProtection),
|
new SmartAttribute(0xFE, SmartNames.FreeFallProtection),
|
||||||
new SmartAttribute(0xC2, SmartNames.Temperature, (r, v, p) => r[0] + (p?[0].Value ?? 0),
|
new SmartAttribute(0xC2, SmartNames.Temperature, (r, _, p) => r[0] + (p?[0].Value ?? 0),
|
||||||
SensorType.Temperature, 0, SmartNames.Temperature, false,
|
SensorType.Temperature, 0, SmartNames.Temperature, false,
|
||||||
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\n" + "Temperature = Value + Offset.", 0) }),
|
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\n" + "Temperature = Value + Offset.", 0) }),
|
||||||
new SmartAttribute(0xE7, SmartNames.Temperature, (r, v, p) => r[0] + (p?[0].Value ?? 0),
|
new SmartAttribute(0xE7, SmartNames.Temperature, (r, _, p) => r[0] + (p?[0].Value ?? 0),
|
||||||
SensorType.Temperature, 0, SmartNames.Temperature, false,
|
SensorType.Temperature, 0, SmartNames.Temperature, false,
|
||||||
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\n" + "Temperature = Value + Offset.", 0) }),
|
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\n" + "Temperature = Value + Offset.", 0) }),
|
||||||
new SmartAttribute(0xBE, SmartNames.TemperatureDifferenceFrom100, (r, v, p) => r[0] + (p?[0].Value ?? 0),
|
new SmartAttribute(0xBE, SmartNames.TemperatureDifferenceFrom100, (r, _, p) => r[0] + (p?[0].Value ?? 0),
|
||||||
SensorType.Temperature, 0, "Temperature", false,
|
SensorType.Temperature, 0, "Temperature", false,
|
||||||
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\n" + "Temperature = Value + Offset.", 0) })
|
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\n" + "Temperature = Value + Offset.", 0) })
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public bool IdentifyController(SafeHandle hDevice, out Kernel32.NVME_IDENTIFY_CONTROLLER_DATA data)
|
public bool IdentifyController(SafeHandle hDevice, out Kernel32.NVME_IDENTIFY_CONTROLLER_DATA data)
|
||||||
{
|
{
|
||||||
data = Kernel32.CreateStruct<Kernel32.NVME_IDENTIFY_CONTROLLER_DATA>();
|
data = Kernel32.CreateStruct<Kernel32.NVME_IDENTIFY_CONTROLLER_DATA>();
|
||||||
if (hDevice == null || hDevice.IsInvalid)
|
if (hDevice?.IsInvalid != false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -74,7 +74,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public bool HealthInfoLog(SafeHandle hDevice, out Kernel32.NVME_HEALTH_INFO_LOG data)
|
public bool HealthInfoLog(SafeHandle hDevice, out Kernel32.NVME_HEALTH_INFO_LOG data)
|
||||||
{
|
{
|
||||||
data = Kernel32.CreateStruct<Kernel32.NVME_HEALTH_INFO_LOG>();
|
data = Kernel32.CreateStruct<Kernel32.NVME_HEALTH_INFO_LOG>();
|
||||||
if (hDevice == null || hDevice.IsInvalid)
|
if (hDevice?.IsInvalid != false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -118,10 +118,9 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public static SafeHandle IdentifyDevice(StorageInfo storageInfo)
|
public static SafeHandle IdentifyDevice(StorageInfo storageInfo)
|
||||||
{
|
{
|
||||||
SafeHandle handle = Kernel32.OpenDevice(storageInfo.Scsi);
|
SafeHandle handle = Kernel32.OpenDevice(storageInfo.Scsi);
|
||||||
if (handle == null || handle.IsInvalid)
|
if (handle?.IsInvalid != false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
Kernel32.NVME_PASS_THROUGH_IOCTL passThrough = Kernel32.CreateStruct<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
Kernel32.NVME_PASS_THROUGH_IOCTL passThrough = Kernel32.CreateStruct<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
||||||
passThrough.srb.HeaderLenght = (uint)Marshal.SizeOf<Kernel32.SRB_IO_CONTROL>();
|
passThrough.srb.HeaderLenght = (uint)Marshal.SizeOf<Kernel32.SRB_IO_CONTROL>();
|
||||||
passThrough.srb.Signature = Encoding.ASCII.GetBytes(Kernel32.IntelNVMeMiniPortSignature1);
|
passThrough.srb.Signature = Encoding.ASCII.GetBytes(Kernel32.IntelNVMeMiniPortSignature1);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public bool IdentifyController(SafeHandle hDevice, out Kernel32.NVME_IDENTIFY_CONTROLLER_DATA data)
|
public bool IdentifyController(SafeHandle hDevice, out Kernel32.NVME_IDENTIFY_CONTROLLER_DATA data)
|
||||||
{
|
{
|
||||||
data = Kernel32.CreateStruct<Kernel32.NVME_IDENTIFY_CONTROLLER_DATA>();
|
data = Kernel32.CreateStruct<Kernel32.NVME_IDENTIFY_CONTROLLER_DATA>();
|
||||||
if (hDevice == null || hDevice.IsInvalid)
|
if (hDevice?.IsInvalid != false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -74,11 +74,10 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public bool HealthInfoLog(SafeHandle hDevice, out Kernel32.NVME_HEALTH_INFO_LOG data)
|
public bool HealthInfoLog(SafeHandle hDevice, out Kernel32.NVME_HEALTH_INFO_LOG data)
|
||||||
{
|
{
|
||||||
data = Kernel32.CreateStruct<Kernel32.NVME_HEALTH_INFO_LOG>();
|
data = Kernel32.CreateStruct<Kernel32.NVME_HEALTH_INFO_LOG>();
|
||||||
if (hDevice == null || hDevice.IsInvalid)
|
if (hDevice?.IsInvalid != false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
IntPtr buffer;
|
|
||||||
|
|
||||||
Kernel32.NVME_PASS_THROUGH_IOCTL passThrough = Kernel32.CreateStruct<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
Kernel32.NVME_PASS_THROUGH_IOCTL passThrough = Kernel32.CreateStruct<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
||||||
passThrough.srb.HeaderLenght = (uint)Marshal.SizeOf<Kernel32.SRB_IO_CONTROL>();
|
passThrough.srb.HeaderLenght = (uint)Marshal.SizeOf<Kernel32.SRB_IO_CONTROL>();
|
||||||
@@ -97,7 +96,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
passThrough.ReturnBufferLen = (uint)Marshal.SizeOf<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
passThrough.ReturnBufferLen = (uint)Marshal.SizeOf<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
||||||
|
|
||||||
int length = Marshal.SizeOf<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
int length = Marshal.SizeOf<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
||||||
buffer = Marshal.AllocHGlobal(length);
|
IntPtr buffer = Marshal.AllocHGlobal(length);
|
||||||
Marshal.StructureToPtr(passThrough, buffer, false);
|
Marshal.StructureToPtr(passThrough, buffer, false);
|
||||||
|
|
||||||
bool validTransfer = Kernel32.DeviceIoControl(hDevice, Kernel32.IOCTL.IOCTL_SCSI_MINIPORT, buffer, length, buffer, length, out _, IntPtr.Zero);
|
bool validTransfer = Kernel32.DeviceIoControl(hDevice, Kernel32.IOCTL.IOCTL_SCSI_MINIPORT, buffer, length, buffer, length, out _, IntPtr.Zero);
|
||||||
@@ -120,10 +119,9 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public static SafeHandle IdentifyDevice(StorageInfo storageInfo)
|
public static SafeHandle IdentifyDevice(StorageInfo storageInfo)
|
||||||
{
|
{
|
||||||
SafeHandle handle = Kernel32.OpenDevice(storageInfo.Scsi);
|
SafeHandle handle = Kernel32.OpenDevice(storageInfo.Scsi);
|
||||||
if (handle == null || handle.IsInvalid)
|
if (handle?.IsInvalid != false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
Kernel32.NVME_PASS_THROUGH_IOCTL passThrough = Kernel32.CreateStruct<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
Kernel32.NVME_PASS_THROUGH_IOCTL passThrough = Kernel32.CreateStruct<Kernel32.NVME_PASS_THROUGH_IOCTL>();
|
||||||
passThrough.srb.HeaderLenght = (uint)Marshal.SizeOf<Kernel32.SRB_IO_CONTROL>();
|
passThrough.srb.HeaderLenght = (uint)Marshal.SizeOf<Kernel32.SRB_IO_CONTROL>();
|
||||||
passThrough.srb.Signature = Encoding.ASCII.GetBytes(Kernel32.IntelNVMeMiniPortSignature2);
|
passThrough.srb.Signature = Encoding.ASCII.GetBytes(Kernel32.IntelNVMeMiniPortSignature2);
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public bool HealthInfoLog(SafeHandle hDevice, out Kernel32.NVME_HEALTH_INFO_LOG data)
|
public bool HealthInfoLog(SafeHandle hDevice, out Kernel32.NVME_HEALTH_INFO_LOG data)
|
||||||
{
|
{
|
||||||
data = Kernel32.CreateStruct<Kernel32.NVME_HEALTH_INFO_LOG>();
|
data = Kernel32.CreateStruct<Kernel32.NVME_HEALTH_INFO_LOG>();
|
||||||
if (hDevice == null || hDevice.IsInvalid)
|
if (hDevice?.IsInvalid != false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -180,10 +180,9 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public static SafeHandle IdentifyDevice(StorageInfo storageInfo)
|
public static SafeHandle IdentifyDevice(StorageInfo storageInfo)
|
||||||
{
|
{
|
||||||
SafeHandle handle = Kernel32.OpenDevice(storageInfo.DeviceId);
|
SafeHandle handle = Kernel32.OpenDevice(storageInfo.DeviceId);
|
||||||
if (handle == null || handle.IsInvalid)
|
if (handle?.IsInvalid != false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
Kernel32.SCSI_PASS_THROUGH_WITH_BUFFERS buffers = Kernel32.CreateStruct<Kernel32.SCSI_PASS_THROUGH_WITH_BUFFERS>();
|
Kernel32.SCSI_PASS_THROUGH_WITH_BUFFERS buffers = Kernel32.CreateStruct<Kernel32.SCSI_PASS_THROUGH_WITH_BUFFERS>();
|
||||||
|
|
||||||
buffers.Spt.Length = (ushort)Marshal.SizeOf<Kernel32.SCSI_PASS_THROUGH>();
|
buffers.Spt.Length = (ushort)Marshal.SizeOf<Kernel32.SCSI_PASS_THROUGH>();
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
|
|
||||||
public Storage.NVMeInfo GetInfo()
|
public Storage.NVMeInfo GetInfo()
|
||||||
{
|
{
|
||||||
if (_handle == null || _handle.IsClosed)
|
if (_handle?.IsClosed != false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
@@ -128,7 +128,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
|
|
||||||
public Storage.NVMeHealthInfo GetHealthInfo()
|
public Storage.NVMeHealthInfo GetHealthInfo()
|
||||||
{
|
{
|
||||||
if (_handle == null || _handle.IsClosed)
|
if (_handle?.IsClosed != false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public bool IdentifyController(SafeHandle hDevice, out Kernel32.NVME_IDENTIFY_CONTROLLER_DATA data)
|
public bool IdentifyController(SafeHandle hDevice, out Kernel32.NVME_IDENTIFY_CONTROLLER_DATA data)
|
||||||
{
|
{
|
||||||
data = Kernel32.CreateStruct<Kernel32.NVME_IDENTIFY_CONTROLLER_DATA>();
|
data = Kernel32.CreateStruct<Kernel32.NVME_IDENTIFY_CONTROLLER_DATA>();
|
||||||
if (hDevice == null || hDevice.IsInvalid)
|
if (hDevice?.IsInvalid != false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -58,7 +58,7 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public bool HealthInfoLog(SafeHandle hDevice, out Kernel32.NVME_HEALTH_INFO_LOG data)
|
public bool HealthInfoLog(SafeHandle hDevice, out Kernel32.NVME_HEALTH_INFO_LOG data)
|
||||||
{
|
{
|
||||||
data = Kernel32.CreateStruct<Kernel32.NVME_HEALTH_INFO_LOG>();
|
data = Kernel32.CreateStruct<Kernel32.NVME_HEALTH_INFO_LOG>();
|
||||||
if (hDevice == null || hDevice.IsInvalid)
|
if (hDevice?.IsInvalid != false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -95,10 +95,9 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
public static SafeHandle IdentifyDevice(StorageInfo storageInfo)
|
public static SafeHandle IdentifyDevice(StorageInfo storageInfo)
|
||||||
{
|
{
|
||||||
SafeHandle handle = Kernel32.OpenDevice(storageInfo.DeviceId);
|
SafeHandle handle = Kernel32.OpenDevice(storageInfo.DeviceId);
|
||||||
if (handle == null || handle.IsInvalid)
|
if (handle?.IsInvalid != false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
Kernel32.STORAGE_QUERY_BUFFER nptwb = Kernel32.CreateStruct<Kernel32.STORAGE_QUERY_BUFFER>();
|
Kernel32.STORAGE_QUERY_BUFFER nptwb = Kernel32.CreateStruct<Kernel32.STORAGE_QUERY_BUFFER>();
|
||||||
nptwb.ProtocolSpecific.ProtocolType = Kernel32.STORAGE_PROTOCOL_TYPE.ProtocolTypeNvme;
|
nptwb.ProtocolSpecific.ProtocolType = Kernel32.STORAGE_PROTOCOL_TYPE.ProtocolTypeNvme;
|
||||||
nptwb.ProtocolSpecific.DataType = (uint)Kernel32.STORAGE_PROTOCOL_NVME_DATA_TYPE.NVMeDataTypeIdentify;
|
nptwb.ProtocolSpecific.DataType = (uint)Kernel32.STORAGE_PROTOCOL_NVME_DATA_TYPE.NVMeDataTypeIdentify;
|
||||||
|
|||||||
@@ -13,28 +13,28 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
{
|
{
|
||||||
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
||||||
{
|
{
|
||||||
new SmartAttribute(0x01, SmartNames.ReadErrorRate),
|
new(0x01, SmartNames.ReadErrorRate),
|
||||||
new SmartAttribute(0x09, SmartNames.PowerOnHours),
|
new(0x09, SmartNames.PowerOnHours),
|
||||||
new SmartAttribute(0x0C, SmartNames.PowerCycleCount),
|
new(0x0C, SmartNames.PowerCycleCount),
|
||||||
new SmartAttribute(0xB8, SmartNames.InitialBadBlockCount),
|
new(0xB8, SmartNames.InitialBadBlockCount),
|
||||||
new SmartAttribute(0xC3, SmartNames.ProgramFailure),
|
new(0xC3, SmartNames.ProgramFailure),
|
||||||
new SmartAttribute(0xC4, SmartNames.EraseFailure),
|
new(0xC4, SmartNames.EraseFailure),
|
||||||
new SmartAttribute(0xC5, SmartNames.ReadFailure),
|
new(0xC5, SmartNames.ReadFailure),
|
||||||
new SmartAttribute(0xC6, SmartNames.SectorsRead),
|
new(0xC6, SmartNames.SectorsRead),
|
||||||
new SmartAttribute(0xC7, SmartNames.SectorsWritten),
|
new(0xC7, SmartNames.SectorsWritten),
|
||||||
new SmartAttribute(0xC8, SmartNames.ReadCommands),
|
new(0xC8, SmartNames.ReadCommands),
|
||||||
new SmartAttribute(0xC9, SmartNames.WriteCommands),
|
new(0xC9, SmartNames.WriteCommands),
|
||||||
new SmartAttribute(0xCA, SmartNames.BitErrors),
|
new(0xCA, SmartNames.BitErrors),
|
||||||
new SmartAttribute(0xCB, SmartNames.CorrectedErrors),
|
new(0xCB, SmartNames.CorrectedErrors),
|
||||||
new SmartAttribute(0xCC, SmartNames.BadBlockFullFlag),
|
new(0xCC, SmartNames.BadBlockFullFlag),
|
||||||
new SmartAttribute(0xCD, SmartNames.MaxCellCycles),
|
new(0xCD, SmartNames.MaxCellCycles),
|
||||||
new SmartAttribute(0xCE, SmartNames.MinErase),
|
new(0xCE, SmartNames.MinErase),
|
||||||
new SmartAttribute(0xCF, SmartNames.MaxErase),
|
new(0xCF, SmartNames.MaxErase),
|
||||||
new SmartAttribute(0xD0, SmartNames.AverageEraseCount),
|
new(0xD0, SmartNames.AverageEraseCount),
|
||||||
new SmartAttribute(0xD1, SmartNames.RemainingLife, null, SensorType.Level, 0, SmartNames.RemainingLife),
|
new(0xD1, SmartNames.RemainingLife, null, SensorType.Level, 0, SmartNames.RemainingLife),
|
||||||
new SmartAttribute(0xD2, SmartNames.UnknownUnique),
|
new(0xD2, SmartNames.UnknownUnique),
|
||||||
new SmartAttribute(0xD3, SmartNames.SataErrorCountCrc),
|
new(0xD3, SmartNames.SataErrorCountCrc),
|
||||||
new SmartAttribute(0xD4, SmartNames.SataErrorCountHandshake)
|
new(0xD4, SmartNames.SataErrorCountHandshake)
|
||||||
};
|
};
|
||||||
|
|
||||||
public SsdIndilinx(StorageInfo storageInfo, ISmart smart, string name, string firmwareRevision, int index, ISettings settings)
|
public SsdIndilinx(StorageInfo storageInfo, ISmart smart, string name, string firmwareRevision, int index, ISettings settings)
|
||||||
|
|||||||
@@ -13,34 +13,34 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
{
|
{
|
||||||
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
||||||
{
|
{
|
||||||
new SmartAttribute(0x01, SmartNames.ReadErrorRate),
|
new(0x01, SmartNames.ReadErrorRate),
|
||||||
new SmartAttribute(0x03, SmartNames.SpinUpTime),
|
new(0x03, SmartNames.SpinUpTime),
|
||||||
new SmartAttribute(0x04, SmartNames.StartStopCount, RawToInt),
|
new(0x04, SmartNames.StartStopCount, RawToInt),
|
||||||
new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount),
|
new(0x05, SmartNames.ReallocatedSectorsCount),
|
||||||
new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
|
new(0x09, SmartNames.PowerOnHours, RawToInt),
|
||||||
new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
new(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
||||||
new SmartAttribute(0xAA, SmartNames.AvailableReservedSpace),
|
new(0xAA, SmartNames.AvailableReservedSpace),
|
||||||
new SmartAttribute(0xAB, SmartNames.ProgramFailCount),
|
new(0xAB, SmartNames.ProgramFailCount),
|
||||||
new SmartAttribute(0xAC, SmartNames.EraseFailCount),
|
new(0xAC, SmartNames.EraseFailCount),
|
||||||
new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
|
new(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
|
||||||
new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
|
new(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xB8, SmartNames.EndToEndError),
|
new(0xB8, SmartNames.EndToEndError),
|
||||||
new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
|
new(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xBE,
|
new(0xBE,
|
||||||
SmartNames.Temperature,
|
SmartNames.Temperature,
|
||||||
(r, v, p) => r[0] + (p?[0].Value ?? 0),
|
(r, _, p) => r[0] + (p?[0].Value ?? 0),
|
||||||
SensorType.Temperature,
|
SensorType.Temperature,
|
||||||
0,
|
0,
|
||||||
SmartNames.AirflowTemperature,
|
SmartNames.AirflowTemperature,
|
||||||
false,
|
false,
|
||||||
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\nTemperature = Value + Offset.", 0) }),
|
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\nTemperature = Value + Offset.", 0) }),
|
||||||
new SmartAttribute(0xC0, SmartNames.UnsafeShutdownCount),
|
new(0xC0, SmartNames.UnsafeShutdownCount),
|
||||||
new SmartAttribute(0xC7, SmartNames.CrcErrorCount, RawToInt),
|
new(0xC7, SmartNames.CrcErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xE1, SmartNames.HostWrites, (r, v, p) => RawToInt(r, v, p) / 0x20, SensorType.Data, 0, SmartNames.HostWrites),
|
new(0xE1, SmartNames.HostWrites, (r, v, p) => RawToInt(r, v, p) / 0x20, SensorType.Data, 0, SmartNames.HostWrites),
|
||||||
new SmartAttribute(0xE8, SmartNames.RemainingLife, null, SensorType.Level, 0, SmartNames.RemainingLife),
|
new(0xE8, SmartNames.RemainingLife, null, SensorType.Level, 0, SmartNames.RemainingLife),
|
||||||
new SmartAttribute(0xE9, SmartNames.MediaWearOutIndicator),
|
new(0xE9, SmartNames.MediaWearOutIndicator),
|
||||||
new SmartAttribute(0xF1, SmartNames.HostWrites, (r, v, p) => RawToInt(r, v, p) / 0x20, SensorType.Data, 0, SmartNames.HostWrites),
|
new(0xF1, SmartNames.HostWrites, (r, v, p) => RawToInt(r, v, p) / 0x20, SensorType.Data, 0, SmartNames.HostWrites),
|
||||||
new SmartAttribute(0xF2, SmartNames.HostReads, (r, v, p) => RawToInt(r, v, p) / 0x20, SensorType.Data, 1, SmartNames.HostReads)
|
new(0xF2, SmartNames.HostReads, (r, v, p) => RawToInt(r, v, p) / 0x20, SensorType.Data, 1, SmartNames.HostReads)
|
||||||
};
|
};
|
||||||
|
|
||||||
public SsdIntel(StorageInfo storageInfo, ISmart smart, string name, string firmwareRevision, int index, ISettings settings)
|
public SsdIntel(StorageInfo storageInfo, ISmart smart, string name, string firmwareRevision, int index, ISettings settings)
|
||||||
|
|||||||
@@ -14,44 +14,44 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
{
|
{
|
||||||
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
||||||
{
|
{
|
||||||
new SmartAttribute(0x01, SmartNames.ReadErrorRate, RawToInt),
|
new(0x01, SmartNames.ReadErrorRate, RawToInt),
|
||||||
new SmartAttribute(0x05, SmartNames.ReallocatedNANDBlockCount, RawToInt),
|
new(0x05, SmartNames.ReallocatedNANDBlockCount, RawToInt),
|
||||||
new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
|
new(0x09, SmartNames.PowerOnHours, RawToInt),
|
||||||
new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
new(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
||||||
new SmartAttribute(0xAA, SmartNames.NewFailingBlockCount, RawToInt),
|
new(0xAA, SmartNames.NewFailingBlockCount, RawToInt),
|
||||||
new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
|
new(0xAB, SmartNames.ProgramFailCount, RawToInt),
|
||||||
new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
|
new(0xAC, SmartNames.EraseFailCount, RawToInt),
|
||||||
new SmartAttribute(0xAD, SmartNames.WearLevelingCount, RawToInt),
|
new(0xAD, SmartNames.WearLevelingCount, RawToInt),
|
||||||
new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
|
new(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
|
||||||
new SmartAttribute(0xB4, SmartNames.UnusedReserveNANDBlocks, RawToInt),
|
new(0xB4, SmartNames.UnusedReserveNANDBlocks, RawToInt),
|
||||||
new SmartAttribute(0xB5, SmartNames.Non4KAlignedAccess, (raw, value, p) => 6e4f * ((raw[5] << 8) | raw[4])),
|
new(0xB5, SmartNames.Non4KAlignedAccess, (raw, _, _) => 6e4f * ((raw[5] << 8) | raw[4])),
|
||||||
new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
|
new(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xB8, SmartNames.ErrorCorrectionCount, RawToInt),
|
new(0xB8, SmartNames.ErrorCorrectionCount, RawToInt),
|
||||||
new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
|
new(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
|
||||||
new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt),
|
new(0xBC, SmartNames.CommandTimeout, RawToInt),
|
||||||
new SmartAttribute(0xBD, SmartNames.FactoryBadBlockCount, RawToInt),
|
new(0xBD, SmartNames.FactoryBadBlockCount, RawToInt),
|
||||||
new SmartAttribute(0xC2, SmartNames.Temperature, RawToInt),
|
new(0xC2, SmartNames.Temperature, RawToInt),
|
||||||
new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
|
new(0xC4, SmartNames.ReallocationEventCount, RawToInt),
|
||||||
new SmartAttribute(0xC5, SmartNames.CurrentPendingSectorCount),
|
new(0xC5, SmartNames.CurrentPendingSectorCount),
|
||||||
new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
|
new(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xC7, SmartNames.UltraDmaCrcErrorCount, RawToInt),
|
new(0xC7, SmartNames.UltraDmaCrcErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xCA, SmartNames.RemainingLife, (raw, value, p) => 100 - RawToInt(raw, value, p), SensorType.Level, 0, SmartNames.RemainingLife),
|
new(0xCA, SmartNames.RemainingLife, (raw, value, p) => 100 - RawToInt(raw, value, p), SensorType.Level, 0, SmartNames.RemainingLife),
|
||||||
new SmartAttribute(0xCE, SmartNames.WriteErrorRate, (raw, value, p) => 6e4f * ((raw[1] << 8) | raw[0])),
|
new(0xCE, SmartNames.WriteErrorRate, (raw, _, _) => 6e4f * ((raw[1] << 8) | raw[0])),
|
||||||
new SmartAttribute(0xD2, SmartNames.SuccessfulRAINRecoveryCount, RawToInt),
|
new(0xD2, SmartNames.SuccessfulRAINRecoveryCount, RawToInt),
|
||||||
new SmartAttribute(0xF6,
|
new(0xF6,
|
||||||
SmartNames.TotalLbasWritten,
|
SmartNames.TotalLbasWritten,
|
||||||
(r, v, p) => (((long)r[5] << 40) |
|
(r, _, _) => (((long)r[5] << 40) |
|
||||||
((long)r[4] << 32) |
|
((long)r[4] << 32) |
|
||||||
((long)r[3] << 24) |
|
((long)r[3] << 24) |
|
||||||
((long)r[2] << 16) |
|
((long)r[2] << 16) |
|
||||||
((long)r[1] << 8) |
|
((long)r[1] << 8) |
|
||||||
r[0]) *
|
r[0]) *
|
||||||
(512.0f / 1024 / 1024 / 1024),
|
(512.0f / 1024 / 1024 / 1024),
|
||||||
SensorType.Data,
|
SensorType.Data,
|
||||||
0,
|
0,
|
||||||
"Total Bytes Written"),
|
"Total Bytes Written"),
|
||||||
new SmartAttribute(0xF7, SmartNames.HostProgramNANDPagesCount, RawToInt),
|
new(0xF7, SmartNames.HostProgramNANDPagesCount, RawToInt),
|
||||||
new SmartAttribute(0xF8, SmartNames.FTLProgramNANDPagesCount, RawToInt)
|
new(0xF8, SmartNames.FTLProgramNANDPagesCount, RawToInt)
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly Sensor _temperature;
|
private readonly Sensor _temperature;
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
{
|
{
|
||||||
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
||||||
{
|
{
|
||||||
new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
|
new(0x09, SmartNames.PowerOnHours, RawToInt),
|
||||||
new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
new(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
||||||
new SmartAttribute(0xF1, SmartNames.HostWrites, RawToGb, SensorType.Data, 0, SmartNames.HostWrites),
|
new(0xF1, SmartNames.HostWrites, RawToGb, SensorType.Data, 0, SmartNames.HostWrites),
|
||||||
new SmartAttribute(0xF2, SmartNames.HostReads, RawToGb, SensorType.Data, 1, SmartNames.HostReads)
|
new(0xF2, SmartNames.HostReads, RawToGb, SensorType.Data, 1, SmartNames.HostReads)
|
||||||
};
|
};
|
||||||
|
|
||||||
public SsdPlextor(StorageInfo storageInfo, ISmart smart, string name, string firmwareRevision, int index, ISettings settings)
|
public SsdPlextor(StorageInfo storageInfo, ISmart smart, string name, string firmwareRevision, int index, ISettings settings)
|
||||||
|
|||||||
@@ -13,42 +13,42 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
{
|
{
|
||||||
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
||||||
{
|
{
|
||||||
new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount),
|
new(0x05, SmartNames.ReallocatedSectorsCount),
|
||||||
new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
|
new(0x09, SmartNames.PowerOnHours, RawToInt),
|
||||||
new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
new(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
||||||
new SmartAttribute(0xAF, SmartNames.ProgramFailCountChip, RawToInt),
|
new(0xAF, SmartNames.ProgramFailCountChip, RawToInt),
|
||||||
new SmartAttribute(0xB0, SmartNames.EraseFailCountChip, RawToInt),
|
new(0xB0, SmartNames.EraseFailCountChip, RawToInt),
|
||||||
new SmartAttribute(0xB1, SmartNames.WearLevelingCount, RawToInt),
|
new(0xB1, SmartNames.WearLevelingCount, RawToInt),
|
||||||
new SmartAttribute(0xB2, SmartNames.UsedReservedBlockCountChip, RawToInt),
|
new(0xB2, SmartNames.UsedReservedBlockCountChip, RawToInt),
|
||||||
new SmartAttribute(0xB3, SmartNames.UsedReservedBlockCountTotal, RawToInt),
|
new(0xB3, SmartNames.UsedReservedBlockCountTotal, RawToInt),
|
||||||
|
|
||||||
// Unused Reserved Block Count (Total)
|
// Unused Reserved Block Count (Total)
|
||||||
new SmartAttribute(0xB4, SmartNames.RemainingLife, null, SensorType.Level, 0, SmartNames.RemainingLife),
|
new(0xB4, SmartNames.RemainingLife, null, SensorType.Level, 0, SmartNames.RemainingLife),
|
||||||
new SmartAttribute(0xB5, SmartNames.ProgramFailCountTotal, RawToInt),
|
new(0xB5, SmartNames.ProgramFailCountTotal, RawToInt),
|
||||||
new SmartAttribute(0xB6, SmartNames.EraseFailCountTotal, RawToInt),
|
new(0xB6, SmartNames.EraseFailCountTotal, RawToInt),
|
||||||
new SmartAttribute(0xB7, SmartNames.RuntimeBadBlockTotal, RawToInt),
|
new(0xB7, SmartNames.RuntimeBadBlockTotal, RawToInt),
|
||||||
new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
|
new(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xBE,
|
new(0xBE,
|
||||||
SmartNames.Temperature,
|
SmartNames.Temperature,
|
||||||
(r, v, p) => r[0] + (p?[0].Value ?? 0),
|
(r, _, p) => r[0] + (p?[0].Value ?? 0),
|
||||||
SensorType.Temperature,
|
SensorType.Temperature,
|
||||||
0,
|
0,
|
||||||
SmartNames.Temperature,
|
SmartNames.Temperature,
|
||||||
false,
|
false,
|
||||||
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\nTemperature = Value + Offset.", 0) }),
|
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\nTemperature = Value + Offset.", 0) }),
|
||||||
new SmartAttribute(0xC2, SmartNames.AirflowTemperature),
|
new(0xC2, SmartNames.AirflowTemperature),
|
||||||
new SmartAttribute(0xC3, SmartNames.EccRate),
|
new(0xC3, SmartNames.EccRate),
|
||||||
new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
|
new(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xC7, SmartNames.CrcErrorCount, RawToInt),
|
new(0xC7, SmartNames.CrcErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xC9, SmartNames.SupercapStatus),
|
new(0xC9, SmartNames.SupercapStatus),
|
||||||
new SmartAttribute(0xCA, SmartNames.ExceptionModeStatus),
|
new(0xCA, SmartNames.ExceptionModeStatus),
|
||||||
new SmartAttribute(0xEB, SmartNames.PowerRecoveryCount),
|
new(0xEB, SmartNames.PowerRecoveryCount),
|
||||||
new SmartAttribute(0xF1,
|
new(0xF1,
|
||||||
SmartNames.TotalLbasWritten,
|
SmartNames.TotalLbasWritten,
|
||||||
(r, v, p) => (((long)r[5] << 40) | ((long)r[4] << 32) | ((long)r[3] << 24) | ((long)r[2] << 16) | ((long)r[1] << 8) | r[0]) * (512.0f / 1024 / 1024 / 1024),
|
(r, _, _) => (((long)r[5] << 40) | ((long)r[4] << 32) | ((long)r[3] << 24) | ((long)r[2] << 16) | ((long)r[1] << 8) | r[0]) * (512.0f / 1024 / 1024 / 1024),
|
||||||
SensorType.Data,
|
SensorType.Data,
|
||||||
0,
|
0,
|
||||||
"Total Bytes Written")
|
"Total Bytes Written")
|
||||||
};
|
};
|
||||||
|
|
||||||
public SsdSamsung(StorageInfo storageInfo, ISmart smart, string name, string firmwareRevision, int index, ISettings settings)
|
public SsdSamsung(StorageInfo storageInfo, ISmart smart, string name, string firmwareRevision, int index, ISettings settings)
|
||||||
|
|||||||
@@ -14,32 +14,32 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
{
|
{
|
||||||
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
private static readonly IReadOnlyList<SmartAttribute> _smartAttributes = new List<SmartAttribute>
|
||||||
{
|
{
|
||||||
new SmartAttribute(0x01, SmartNames.RawReadErrorRate),
|
new(0x01, SmartNames.RawReadErrorRate),
|
||||||
new SmartAttribute(0x05, SmartNames.RetiredBlockCount, RawToInt),
|
new(0x05, SmartNames.RetiredBlockCount, RawToInt),
|
||||||
new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
|
new(0x09, SmartNames.PowerOnHours, RawToInt),
|
||||||
new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
new(0x0C, SmartNames.PowerCycleCount, RawToInt),
|
||||||
new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
|
new(0xAB, SmartNames.ProgramFailCount, RawToInt),
|
||||||
new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
|
new(0xAC, SmartNames.EraseFailCount, RawToInt),
|
||||||
new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
|
new(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
|
||||||
new SmartAttribute(0xB1, SmartNames.WearRangeDelta, RawToInt),
|
new(0xB1, SmartNames.WearRangeDelta, RawToInt),
|
||||||
new SmartAttribute(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt),
|
new(0xB5, SmartNames.AlternativeProgramFailCount, RawToInt),
|
||||||
new SmartAttribute(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt),
|
new(0xB6, SmartNames.AlternativeEraseFailCount, RawToInt),
|
||||||
new SmartAttribute(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
|
new(0xBB, SmartNames.UncorrectableErrorCount, RawToInt),
|
||||||
new SmartAttribute(0xC2,
|
new(0xC2,
|
||||||
SmartNames.Temperature,
|
SmartNames.Temperature,
|
||||||
(raw, value, p) => value + (p?[0].Value ?? 0),
|
(_, value, p) => value + (p?[0].Value ?? 0),
|
||||||
SensorType.Temperature,
|
SensorType.Temperature,
|
||||||
0,
|
0,
|
||||||
SmartNames.Temperature,
|
SmartNames.Temperature,
|
||||||
true,
|
true,
|
||||||
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\nTemperature = Value + Offset.", 0) }),
|
new[] { new ParameterDescription("Offset [°C]", "Temperature offset of the thermal sensor.\nTemperature = Value + Offset.", 0) }),
|
||||||
new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc),
|
new(0xC3, SmartNames.UnrecoverableEcc),
|
||||||
new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
|
new(0xC4, SmartNames.ReallocationEventCount, RawToInt),
|
||||||
new SmartAttribute(0xE7, SmartNames.RemainingLife, null, SensorType.Level, 0, SmartNames.RemainingLife),
|
new(0xE7, SmartNames.RemainingLife, null, SensorType.Level, 0, SmartNames.RemainingLife),
|
||||||
new SmartAttribute(0xE9, SmartNames.ControllerWritesToNand, RawToInt, SensorType.Data, 0, SmartNames.ControllerWritesToNand),
|
new(0xE9, SmartNames.ControllerWritesToNand, RawToInt, SensorType.Data, 0, SmartNames.ControllerWritesToNand),
|
||||||
new SmartAttribute(0xEA, SmartNames.HostWritesToController, RawToInt, SensorType.Data, 1, SmartNames.HostWritesToController),
|
new(0xEA, SmartNames.HostWritesToController, RawToInt, SensorType.Data, 1, SmartNames.HostWritesToController),
|
||||||
new SmartAttribute(0xF1, SmartNames.HostWrites, RawToInt, SensorType.Data, 1, SmartNames.HostWrites),
|
new(0xF1, SmartNames.HostWrites, RawToInt, SensorType.Data, 1, SmartNames.HostWrites),
|
||||||
new SmartAttribute(0xF2, SmartNames.HostReads, RawToInt, SensorType.Data, 2, SmartNames.HostReads)
|
new(0xF2, SmartNames.HostReads, RawToInt, SensorType.Data, 2, SmartNames.HostReads)
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly Sensor _writeAmplification;
|
private readonly Sensor _writeAmplification;
|
||||||
|
|||||||
@@ -153,16 +153,14 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
// high and mid registers are unchanged, which means that the drive is healthy
|
// high and mid registers are unchanged, which means that the drive is healthy
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (Kernel32.SMART_LBA_HI_EXCEEDED == result.irDriveRegs.bCylHighReg && Kernel32.SMART_LBA_MID_EXCEEDED == result.irDriveRegs.bCylLowReg)
|
|
||||||
|
if (Kernel32.SMART_LBA_HI_EXCEEDED == result.irDriveRegs.bCylHighReg && Kernel32.SMART_LBA_MID_EXCEEDED == result.irDriveRegs.bCylLowReg)
|
||||||
{
|
{
|
||||||
// high and mid registers are exceeded, which means that the drive is unhealthy
|
// high and mid registers are exceeded, which means that the drive is unhealthy
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
// response is not clear
|
||||||
{
|
return null;
|
||||||
// response is not clear
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Dispose(bool disposing)
|
protected void Dispose(bool disposing)
|
||||||
|
|||||||
@@ -15,39 +15,35 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
{
|
{
|
||||||
public static Storage.StorageInfo GetStorageInfo(string deviceId, uint driveIndex)
|
public static Storage.StorageInfo GetStorageInfo(string deviceId, uint driveIndex)
|
||||||
{
|
{
|
||||||
using (SafeHandle handle = Kernel32.OpenDevice(deviceId))
|
using SafeHandle handle = Kernel32.OpenDevice(deviceId);
|
||||||
|
if (handle?.IsInvalid != false)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var query = new Kernel32.STORAGE_PROPERTY_QUERY { PropertyId = Kernel32.STORAGE_PROPERTY_ID.StorageDeviceProperty, QueryType = Kernel32.STORAGE_QUERY_TYPE.PropertyStandardQuery };
|
||||||
|
|
||||||
|
if (!Kernel32.DeviceIoControl(handle,
|
||||||
|
Kernel32.IOCTL.IOCTL_STORAGE_QUERY_PROPERTY,
|
||||||
|
ref query,
|
||||||
|
Marshal.SizeOf(query),
|
||||||
|
out Kernel32.STORAGE_DEVICE_DESCRIPTOR_HEADER header,
|
||||||
|
Marshal.SizeOf<Kernel32.STORAGE_DEVICE_DESCRIPTOR_HEADER>(),
|
||||||
|
out _,
|
||||||
|
IntPtr.Zero))
|
||||||
{
|
{
|
||||||
if (handle == null || handle.IsInvalid)
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntPtr descriptorPtr = Marshal.AllocHGlobal((int)header.Size);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Kernel32.DeviceIoControl(handle, Kernel32.IOCTL.IOCTL_STORAGE_QUERY_PROPERTY, ref query, Marshal.SizeOf(query), descriptorPtr, header.Size, out _, IntPtr.Zero))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
return new StorageInfo((int)driveIndex, descriptorPtr);
|
||||||
var query = new Kernel32.STORAGE_PROPERTY_QUERY { PropertyId = Kernel32.STORAGE_PROPERTY_ID.StorageDeviceProperty, QueryType = Kernel32.STORAGE_QUERY_TYPE.PropertyStandardQuery };
|
}
|
||||||
|
finally
|
||||||
if (!Kernel32.DeviceIoControl(handle,
|
{
|
||||||
Kernel32.IOCTL.IOCTL_STORAGE_QUERY_PROPERTY,
|
Marshal.FreeHGlobal(descriptorPtr);
|
||||||
ref query,
|
|
||||||
Marshal.SizeOf(query),
|
|
||||||
out Kernel32.STORAGE_DEVICE_DESCRIPTOR_HEADER header,
|
|
||||||
Marshal.SizeOf<Kernel32.STORAGE_DEVICE_DESCRIPTOR_HEADER>(),
|
|
||||||
out _,
|
|
||||||
IntPtr.Zero))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IntPtr descriptorPtr = Marshal.AllocHGlobal((int)header.Size);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!Kernel32.DeviceIoControl(handle, Kernel32.IOCTL.IOCTL_STORAGE_QUERY_PROPERTY, ref query, Marshal.SizeOf(query), descriptorPtr, header.Size, out _, IntPtr.Zero))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
|
|
||||||
return new StorageInfo((int)driveIndex, descriptorPtr);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Marshal.FreeHGlobal(descriptorPtr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,22 +53,14 @@ namespace LibreHardwareMonitor.Hardware.Storage
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var s = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_DiskPartition " + "WHERE DiskIndex = " + driveIndex))
|
using var s = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_DiskPartition " + "WHERE DiskIndex = " + driveIndex);
|
||||||
|
foreach (ManagementBaseObject o in s.Get())
|
||||||
{
|
{
|
||||||
using (ManagementObjectCollection dpc = s.Get())
|
if (o is ManagementObject dp)
|
||||||
{
|
{
|
||||||
foreach (ManagementBaseObject o in dpc)
|
foreach (ManagementBaseObject ld in dp.GetRelated("Win32_LogicalDisk"))
|
||||||
{
|
{
|
||||||
if (o is ManagementObject dp)
|
list.Add(((string)ld["Name"]).TrimEnd(':'));
|
||||||
{
|
|
||||||
using (ManagementObjectCollection ldc = dp.GetRelated("Win32_LogicalDisk"))
|
|
||||||
{
|
|
||||||
foreach (ManagementBaseObject ld in ldc)
|
|
||||||
{
|
|
||||||
list.Add(((string)ld["Name"]).TrimEnd(':'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -329,8 +329,8 @@ namespace LibreHardwareMonitor.Interop
|
|||||||
{
|
{
|
||||||
public WinNt.LARGE_INTEGER RunningTime; // 100ns
|
public WinNt.LARGE_INTEGER RunningTime; // 100ns
|
||||||
public uint ContextSwitch;
|
public uint ContextSwitch;
|
||||||
readonly D3DKMT_QUERYSTATISTICS_PREEMPTION_INFORMATION PreemptionStatistics;
|
private readonly D3DKMT_QUERYSTATISTICS_PREEMPTION_INFORMATION PreemptionStatistics;
|
||||||
readonly D3DKMT_QUERYSTATISTICS_PACKET_INFORMATION PacketStatistics;
|
private readonly D3DKMT_QUERYSTATISTICS_PACKET_INFORMATION PacketStatistics;
|
||||||
private fixed ulong Reserved[8];
|
private fixed ulong Reserved[8];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,7 +557,7 @@ namespace LibreHardwareMonitor.Interop
|
|||||||
KMTQAITYPE_PARAVIRTUALIZATION_RENDER = 68,
|
KMTQAITYPE_PARAVIRTUALIZATION_RENDER = 68,
|
||||||
KMTQAITYPE_SERVICENAME = 69,
|
KMTQAITYPE_SERVICENAME = 69,
|
||||||
KMTQAITYPE_WDDM_2_7_CAPS = 70,
|
KMTQAITYPE_WDDM_2_7_CAPS = 70,
|
||||||
KMTQAITYPE_TRACKEDWORKLOAD_SUPPORT = 72,
|
KMTQAITYPE_TRACKEDWORKLOAD_SUPPORT = 72
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ namespace LibreHardwareMonitor.Interop
|
|||||||
CurrentFrequency,
|
CurrentFrequency,
|
||||||
BaseClock,
|
BaseClock,
|
||||||
BoostClock,
|
BoostClock,
|
||||||
ClockTypeNumber,
|
ClockTypeNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
internal enum NvCoolerTarget
|
internal enum NvCoolerTarget
|
||||||
|
|||||||
Reference in New Issue
Block a user