diff --git a/GUI/PortForm.cs b/GUI/PortForm.cs index 1dc2b5f..9357408 100644 --- a/GUI/PortForm.cs +++ b/GUI/PortForm.cs @@ -11,7 +11,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; diff --git a/Hardware/HDD/AbstractHarddrive.cs b/Hardware/HDD/AbstractHarddrive.cs index f2a205f..6e0efe4 100644 --- a/Hardware/HDD/AbstractHarddrive.cs +++ b/Hardware/HDD/AbstractHarddrive.cs @@ -28,6 +28,7 @@ namespace OpenHardwareMonitor.Hardware.HDD { typeof(SSDSandforce), typeof(SSDIndilinx), typeof(SSDSamsung), + typeof(SSDMicron), typeof(GenericHarddisk) }; diff --git a/Hardware/HDD/DebugSmart.cs b/Hardware/HDD/DebugSmart.cs index e3da34b..5977dac 100644 --- a/Hardware/HDD/DebugSmart.cs +++ b/Hardware/HDD/DebugSmart.cs @@ -263,8 +263,57 @@ namespace OpenHardwareMonitor.Hardware.HDD { C6 000000000000 100 100 0 C7 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, + @"01 000000000000 100 100 50 + 05 000000000000 100 100 10 + 09 260000000000 100 100 1 + 0C 5A0000000000 100 100 1 + AA 000000000000 100 100 10 + AB 000000000000 100 100 1 + AC 000000000000 100 100 1 + AD 010000000000 100 100 10 + AE 000000000000 100 100 1 + B5 2B000E003A00 100 100 1 + B7 000000000000 100 100 1 + B8 000000000000 100 100 50 + BB 000000000000 100 100 1 + BC 000000000000 100 100 1 + BD 310000000000 100 100 1 + C2 000000000000 100 100 0 + C3 000000000000 100 100 1 + C4 000000000000 100 100 1 + C5 000000000000 100 100 1 + C6 000000000000 100 100 1 + C7 000000000000 100 100 1 + CA 000000000000 100 100 1 + CE 000000000000 100 100 1"), + + new Drive("M4-CT128M4SSD2", "000F", 16, + @"01 000000000000 100 100 50 + 05 000000000000 100 100 10 + 09 CA1400000000 100 100 1 + 0C A30200000000 100 100 1 + AA 000000000000 100 100 10 + AB 000000000000 100 100 1 + AC 000000000000 100 100 1 + AD 1F0000000000 99 99 10 + AE 140000000000 100 100 1 + B5 12037C028E05 100 100 1 + B7 000000000000 100 100 1 + B8 000000000000 100 100 50 + BB 000000000000 100 100 1 + BC 000000000000 100 100 1 + BD 510000000000 100 100 1 + C2 000000000000 100 100 0 + C3 000000000000 100 100 1 + C4 000000000000 100 100 1 + C5 000000000000 100 100 1 + C6 000000000000 100 100 1 + C7 000000000000 100 100 1 + CA 010000000000 99 99 1 + CE 000000000000 100 100 1 ")}; public IntPtr OpenDrive(int driveNumber) { if (driveNumber < drives.Length) diff --git a/Hardware/HDD/HDDGeneric.cs b/Hardware/HDD/HDDGeneric.cs index 10ca30c..c61fc41 100644 --- a/Hardware/HDD/HDDGeneric.cs +++ b/Hardware/HDD/HDDGeneric.cs @@ -37,12 +37,12 @@ namespace OpenHardwareMonitor.Hardware.HDD { new SmartAttribute(0xAA, SmartNames.Unknown), new SmartAttribute(0xAB, SmartNames.Unknown), new SmartAttribute(0xAC, SmartNames.Unknown), - new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount), + new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt), new SmartAttribute(0xB8, SmartNames.EndToEndError), new SmartAttribute(0xB9, SmartNames.HeadStability), new SmartAttribute(0xBA, SmartNames.InducedOpVibrationDetection), - new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors), - new SmartAttribute(0xBC, SmartNames.CommandTimeout), + new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt), + new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt), new SmartAttribute(0xBD, SmartNames.HighFlyWrites), new SmartAttribute(0xBF, SmartNames.GSenseErrorRate), new SmartAttribute(0xC0, SmartNames.EmergencyRetractCycleCount), diff --git a/Hardware/HDD/SSDMicron.cs b/Hardware/HDD/SSDMicron.cs new file mode 100644 index 0000000..0bcb199 --- /dev/null +++ b/Hardware/HDD/SSDMicron.cs @@ -0,0 +1,51 @@ +/* + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + Copyright (C) 2012 Michael Möller + +*/ + +namespace OpenHardwareMonitor.Hardware.HDD { + using System.Collections.Generic; + + [NamePrefix(""), RequireSmart(0xAA), RequireSmart(0xAB), RequireSmart(0xAC), + RequireSmart(0xAD), RequireSmart(0xAE), RequireSmart(0xCA)] + internal class SSDMicron : AbstractHarddrive { + + private static readonly IEnumerable smartAttributes = + new List { + + new SmartAttribute(0x01, SmartNames.ReadErrorRate, RawToInt), + new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount, RawToInt), + new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt), + new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt), + new SmartAttribute(0xAA, SmartNames.NewFailingBlockCount, RawToInt), + new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt), + new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt), + new SmartAttribute(0xAD, SmartNames.WearLevelingCount, RawToInt), + new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt), + new SmartAttribute(0xB5, SmartNames.Non4kAlignedAccess, + (byte[] raw, byte value) => { return 6e4f * ((raw[5] << 8) | raw[4]); }), + new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt), + new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt), + new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt), + new SmartAttribute(0xBD, SmartNames.FactoryBadBlockCount, RawToInt), + new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt), + new SmartAttribute(0xC5, SmartNames.CurrentPendingSectorCount), + new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt), + new SmartAttribute(0xC7, SmartNames.UltraDmaCrcErrorCount, RawToInt), + new SmartAttribute(0xCA, SmartNames.RemainingLife, + (byte[] raw, byte value) => { return 100 - RawToInt(raw, value); }, + SensorType.Level, 0), + new SmartAttribute(0xCE, SmartNames.WriteErrorRate, + (byte[] raw, byte value) => { return 6e4f * ((raw[1] << 8) | raw[0]); }), + }; + + public SSDMicron(ISmart smart, string name, string firmwareRevision, + int index, ISettings settings) + : base(smart, name, firmwareRevision, index, smartAttributes, settings) {} + } +} diff --git a/Hardware/HDD/SmartNames.cs b/Hardware/HDD/SmartNames.cs index 661d5fe..d934f54 100644 --- a/Hardware/HDD/SmartNames.cs +++ b/Hardware/HDD/SmartNames.cs @@ -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 Michael Möller + Copyright (C) 2011-2012 Michael Möller Copyright (C) 2011 Roland Reinl */ @@ -478,5 +478,17 @@ namespace OpenHardwareMonitor.Hardware.HDD { public static string RawReadErrorRate { get { return "Raw Read Error Rate"; } } + + public static string NewFailingBlockCount { + get { return "New Failing Block Count"; } + } + + public static string Non4kAlignedAccess { + get { return "Non-4k Aligned Access"; } + } + + public static string FactoryBadBlockCount { + get { return "Factory Bad Block Count"; } + } } } \ No newline at end of file diff --git a/Hardware/Sensor.cs b/Hardware/Sensor.cs index 2fd1eca..5be88b8 100644 --- a/Hardware/Sensor.cs +++ b/Hardware/Sensor.cs @@ -66,7 +66,7 @@ namespace OpenHardwareMonitor.Hardware { this.name = settings.GetValue( new Identifier(Identifier, "name").ToString(), name); - GetSensorValuesFromSettings(); + GetSensorValuesFromSettings(); hardware.Closing += delegate(IHardware h) { SetSensorValuesToSettings(); @@ -88,12 +88,12 @@ namespace OpenHardwareMonitor.Hardware { } private void GetSensorValuesFromSettings() { - string s = settings.GetValue( - new Identifier(Identifier, "values").ToString(), null); + string name = new Identifier(Identifier, "values").ToString(); + string s = settings.GetValue(name, null); - byte[] array = null; try { - array = Convert.FromBase64String(s); + byte[] array = Convert.FromBase64String(s); + s = null; using (MemoryStream m = new MemoryStream(array)) using (GZipStream c = new GZipStream(m, CompressionMode.Decompress)) using (BinaryReader reader = new BinaryReader(c)) { @@ -108,6 +108,9 @@ namespace OpenHardwareMonitor.Hardware { } catch { } if (values.Count > 0) AppendValue(float.NaN, DateTime.UtcNow); + + // remove the value string from the settings to reduce memory usage + settings.Remove(name); } private void AppendValue(float value, DateTime time) { diff --git a/OpenHardwareMonitor.csproj b/OpenHardwareMonitor.csproj index deff3b8..c7f5596 100644 --- a/OpenHardwareMonitor.csproj +++ b/OpenHardwareMonitor.csproj @@ -60,7 +60,6 @@ - diff --git a/OpenHardwareMonitorLib.csproj b/OpenHardwareMonitorLib.csproj index dbf37af..5e46a02 100644 --- a/OpenHardwareMonitorLib.csproj +++ b/OpenHardwareMonitorLib.csproj @@ -74,6 +74,7 @@ + diff --git a/Properties/AssemblyVersion.cs b/Properties/AssemblyVersion.cs index 6c7b320..ecafe2a 100644 --- a/Properties/AssemblyVersion.cs +++ b/Properties/AssemblyVersion.cs @@ -10,5 +10,5 @@ using System.Reflection; -[assembly: AssemblyVersion("0.4.0.12")] -[assembly: AssemblyInformationalVersion("0.4.0.12 Alpha")] \ No newline at end of file +[assembly: AssemblyVersion("0.4.0.13")] +[assembly: AssemblyInformationalVersion("0.4.0.13 Alpha")] \ No newline at end of file