Added a SensorName property to the SmartAttribute class in order to support sensor names that are different from the attribute name. Used the SensorName property to replace the "Temperature Difference From 100" sensor with a standard "Temperature" sensor. Closed issue #717.

This commit is contained in:
Michael Möller
2015-12-13 18:11:48 +01:00
parent f069e4c6e8
commit 7b6fc115d8
9 changed files with 42 additions and 32 deletions
+2 -2
View File
@@ -4,7 +4,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2009-2013 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2009-2015 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2010 Paul Werelds
Copyright (C) 2011 Roland Reinl <roland-reinl@gmx.de>
@@ -201,7 +201,7 @@ namespace OpenHardwareMonitor.Hardware.HDD {
attribute.SensorType.Value, attribute.SensorChannel);
if (!sensorTypeAndChannels.Contains(pair)) {
Sensor sensor = new Sensor(attribute.Name,
Sensor sensor = new Sensor(attribute.SensorName,
attribute.SensorChannel, attribute.DefaultHiddenSensor,
attribute.SensorType.Value, this, attribute.ParameterDescriptions,
settings);
+9 -4
View File
@@ -4,7 +4,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2011-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2011-2015 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2010 Paul Werelds
Copyright (C) 2011 Roland Reinl <roland-reinl@gmx.de>
@@ -85,19 +85,24 @@ namespace OpenHardwareMonitor.Hardware.HDD {
new SmartAttribute(0xC2, SmartNames.Temperature,
(byte[] r, byte v, IReadOnlyArray<IParameter> p)
=> { return r[0] + (p == null ? 0 : p[0].Value); },
SensorType.Temperature, 0, false,
SensorType.Temperature, 0, SmartNames.Temperature, false,
new[] { new ParameterDescription("Offset [°C]",
"Temperature offset of the thermal sensor.\n" +
"Temperature = Value + Offset.", 0) }),
new SmartAttribute(0xE7, SmartNames.Temperature,
(byte[] r, byte v, IReadOnlyArray<IParameter> p)
=> { return r[0] + (p == null ? 0 : p[0].Value); },
SensorType.Temperature, 0, false,
SensorType.Temperature, 0, SmartNames.Temperature, false,
new[] { new ParameterDescription("Offset [°C]",
"Temperature offset of the thermal sensor.\n" +
"Temperature = Value + Offset.", 0) }),
new SmartAttribute(0xBE, SmartNames.TemperatureDifferenceFrom100,
null, SensorType.Temperature, 0)
(byte[] r, byte v, IReadOnlyArray<IParameter> p)
=> { return r[0] + (p == null ? 0 : p[0].Value); },
SensorType.Temperature, 0, "Temperature", false,
new[] { new ParameterDescription("Offset [°C]",
"Temperature offset of the thermal sensor.\n" +
"Temperature = Value + Offset.", 0) })
};
public GenericHarddisk(ISmart smart, string name, string firmwareRevision,
+2 -2
View File
@@ -4,7 +4,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2009-2015 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2010 Paul Werelds
Copyright (C) 2011 Roland Reinl <roland-reinl@gmx.de>
@@ -38,7 +38,7 @@ namespace OpenHardwareMonitor.Hardware.HDD {
new SmartAttribute(0xCF, SmartNames.MaxErase),
new SmartAttribute(0xD0, SmartNames.AverageEraseCount),
new SmartAttribute(0xD1, SmartNames.RemainingLife,
null, SensorType.Level, 0),
null, SensorType.Level, 0, SmartNames.RemainingLife),
new SmartAttribute(0xD2, SmartNames.UnknownUnique),
new SmartAttribute(0xD3, SmartNames.SataErrorCountCrc),
new SmartAttribute(0xD4, SmartNames.SataErrorCountHandshake)
+5 -5
View File
@@ -4,7 +4,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2009-2015 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2010 Paul Werelds
Copyright (C) 2011 Roland Reinl <roland-reinl@gmx.de>
@@ -36,18 +36,18 @@ namespace OpenHardwareMonitor.Hardware.HDD {
new SmartAttribute(0xE1, SmartNames.HostWrites,
(byte[] r, byte v, IReadOnlyArray<IParameter> p)
=> { return RawToInt(r, v, p) / 0x20; },
SensorType.Data, 0),
SensorType.Data, 0, SmartNames.HostWrites),
new SmartAttribute(0xE8, SmartNames.RemainingLife,
null, SensorType.Level, 0),
null, SensorType.Level, 0, SmartNames.RemainingLife),
new SmartAttribute(0xE9, SmartNames.MediaWearOutIndicator),
new SmartAttribute(0xF1, SmartNames.HostWrites,
(byte[] r, byte v, IReadOnlyArray<IParameter> p)
=> { return RawToInt(r, v, p) / 0x20; },
SensorType.Data, 0),
SensorType.Data, 0, SmartNames.HostWrites),
new SmartAttribute(0xF2, SmartNames.HostReads,
(byte[] r, byte v, IReadOnlyArray<IParameter> p)
=> { return RawToInt(r, v, p) / 0x20; },
SensorType.Data, 1),
SensorType.Data, 1, SmartNames.HostReads),
};
public SSDIntel(ISmart smart, string name, string firmwareRevision,
+3 -3
View File
@@ -4,7 +4,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2012 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2012-2015 Michael Möller <mmoeller@openhardwaremonitor.org>
*/
@@ -43,8 +43,8 @@ namespace OpenHardwareMonitor.Hardware.HDD {
new SmartAttribute(0xCA, SmartNames.RemainingLife,
(byte[] raw, byte value, IReadOnlyArray<IParameter> p)
=> { return 100 - RawToInt(raw, value, p); },
SensorType.Level, 0),
new SmartAttribute(0xCE, SmartNames.WriteErrorRate,
SensorType.Level, 0, SmartNames.RemainingLife),
new SmartAttribute(0xCE, SmartNames.WriteErrorRate,
(byte[] raw, byte value, IReadOnlyArray<IParameter> p)
=> { return 6e4f * ((raw[1] << 8) | raw[0]); }),
};
+3 -3
View File
@@ -4,7 +4,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2012-2013 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2012-2015 Michael Möller <mmoeller@openhardwaremonitor.org>
*/
@@ -30,7 +30,7 @@ namespace OpenHardwareMonitor.Hardware.HDD {
// Unused Reserved Block Count (Total)
new SmartAttribute(0xB4, SmartNames.RemainingLife,
null, SensorType.Level, 0),
null, SensorType.Level, 0, SmartNames.RemainingLife),
new SmartAttribute(0xB5, SmartNames.ProgramFailCountTotal, RawToInt),
new SmartAttribute(0xB6, SmartNames.EraseFailCountTotal, RawToInt),
@@ -39,7 +39,7 @@ namespace OpenHardwareMonitor.Hardware.HDD {
new SmartAttribute(0xBE, SmartNames.Temperature,
(byte[] r, byte v, IReadOnlyArray<IParameter> p)
=> { return r[0] + (p == null ? 0 : p[0].Value); },
SensorType.Temperature, 0, false,
SensorType.Temperature, 0, SmartNames.Temperature, false,
new[] { new ParameterDescription("Offset [°C]",
"Temperature offset of the thermal sensor.\n" +
"Temperature = Value + Offset.", 0) }),
+7 -7
View File
@@ -4,7 +4,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2009-2015 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2010 Paul Werelds
*/
@@ -33,22 +33,22 @@ namespace OpenHardwareMonitor.Hardware.HDD {
new SmartAttribute(0xC2, SmartNames.Temperature,
(byte[] raw, byte value, IReadOnlyArray<IParameter> p)
=> { return value + (p == null ? 0 : p[0].Value); },
SensorType.Temperature, 0, true,
SensorType.Temperature, 0, SmartNames.Temperature, true,
new[] { new ParameterDescription("Offset [°C]",
"Temperature offset of the thermal sensor.\n" +
"Temperature = Value + Offset.", 0) }),
new SmartAttribute(0xC3, SmartNames.UnrecoverableEcc),
new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
new SmartAttribute(0xE7, SmartNames.RemainingLife, null,
SensorType.Level, 0),
SensorType.Level, 0, SmartNames.RemainingLife),
new SmartAttribute(0xE9, SmartNames.ControllerWritesToNAND, RawToInt,
SensorType.Data, 0),
SensorType.Data, 0, SmartNames.ControllerWritesToNAND),
new SmartAttribute(0xEA, SmartNames.HostWritesToController, RawToInt,
SensorType.Data, 1),
SensorType.Data, 1, SmartNames.HostWritesToController),
new SmartAttribute(0xF1, SmartNames.HostWrites, RawToInt,
SensorType.Data, 1),
SensorType.Data, 1, SmartNames.HostWrites),
new SmartAttribute(0xF2, SmartNames.HostReads, RawToInt,
SensorType.Data, 2)
SensorType.Data, 2, SmartNames.HostReads)
};
private Sensor writeAmplification;
+9 -4
View File
@@ -4,7 +4,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2011-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2011-2015 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2011 Roland Reinl <roland-reinl@gmx.de>
*/
@@ -24,7 +24,7 @@ namespace OpenHardwareMonitor.Hardware.HDD {
/// <param name="identifier">The SMART identifier of the attribute.</param>
/// <param name="name">The name of the attribute.</param>
public SmartAttribute(byte identifier, string name) :
this(identifier, name, null, null, 0) { }
this(identifier, name, null, null, 0, null) { }
/// <summary>
/// Initializes a new instance of the <see cref="SmartAttribute"/> class.
@@ -35,7 +35,7 @@ namespace OpenHardwareMonitor.Hardware.HDD {
/// array into a value (or null to use the attribute value).</param>
public SmartAttribute(byte identifier, string name,
RawValueConversion rawValueConversion) :
this(identifier, name, rawValueConversion, null, 0) { }
this(identifier, name, rawValueConversion, null, 0, null) { }
/// <summary>
/// Initializes a new instance of the <see cref="SmartAttribute"/> class.
@@ -49,12 +49,14 @@ namespace OpenHardwareMonitor.Hardware.HDD {
/// <param name="sensorChannel">If there exists more than one attribute with
/// the same sensor channel and type, then a sensor is created only for the
/// first attribute.</param>
/// <param name="sensorName">The name to be used for the sensor, or null if
/// no sensor is created.</param>
/// <param name="defaultHiddenSensor">True to hide the sensor initially.</param>
/// <param name="parameterDescriptions">Description for the parameters of the sensor
/// (or null).</param>
public SmartAttribute(byte identifier, string name,
RawValueConversion rawValueConversion, SensorType? sensorType,
int sensorChannel, bool defaultHiddenSensor = false,
int sensorChannel, string sensorName, bool defaultHiddenSensor = false,
ParameterDescription[] parameterDescriptions = null)
{
this.Identifier = identifier;
@@ -62,6 +64,7 @@ namespace OpenHardwareMonitor.Hardware.HDD {
this.rawValueConversion = rawValueConversion;
this.SensorType = sensorType;
this.SensorChannel = sensorChannel;
this.SensorName = sensorName;
this.DefaultHiddenSensor = defaultHiddenSensor;
this.ParameterDescriptions = parameterDescriptions;
}
@@ -77,6 +80,8 @@ namespace OpenHardwareMonitor.Hardware.HDD {
public int SensorChannel { get; private set; }
public string SensorName { get; private set; }
public bool DefaultHiddenSensor { get; private set; }
public ParameterDescription[] ParameterDescriptions { get; private set; }
+2 -2
View File
@@ -10,5 +10,5 @@
using System.Reflection;
[assembly: AssemblyVersion("0.7.1.2")]
[assembly: AssemblyInformationalVersion("0.7.1.2 Alpha")]
[assembly: AssemblyVersion("0.7.1.3")]
[assembly: AssemblyInformationalVersion("0.7.1.3 Alpha")]