# HG changeset patch # User moel.mich # Date 1341761084 0 # Node ID 7962499f9cd64b17eb2a3cc7cc249c0ca3956d2b # Parent fb8dc26f65a44e30f9b72b1d8a219d96a579bc23 Added support for SSDs with a controller from Micron. diff -r fb8dc26f65a4 -r 7962499f9cd6 GUI/PortForm.cs --- a/GUI/PortForm.cs Mon Jul 02 21:14:40 2012 +0000 +++ b/GUI/PortForm.cs Sun Jul 08 15:24:44 2012 +0000 @@ -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 -r fb8dc26f65a4 -r 7962499f9cd6 Hardware/HDD/AbstractHarddrive.cs --- a/Hardware/HDD/AbstractHarddrive.cs Mon Jul 02 21:14:40 2012 +0000 +++ b/Hardware/HDD/AbstractHarddrive.cs Sun Jul 08 15:24:44 2012 +0000 @@ -28,6 +28,7 @@ typeof(SSDSandforce), typeof(SSDIndilinx), typeof(SSDSamsung), + typeof(SSDMicron), typeof(GenericHarddisk) }; diff -r fb8dc26f65a4 -r 7962499f9cd6 Hardware/HDD/DebugSmart.cs --- a/Hardware/HDD/DebugSmart.cs Mon Jul 02 21:14:40 2012 +0000 +++ b/Hardware/HDD/DebugSmart.cs Sun Jul 08 15:24:44 2012 +0000 @@ -263,8 +263,57 @@ 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 -r fb8dc26f65a4 -r 7962499f9cd6 Hardware/HDD/HDDGeneric.cs --- a/Hardware/HDD/HDDGeneric.cs Mon Jul 02 21:14:40 2012 +0000 +++ b/Hardware/HDD/HDDGeneric.cs Sun Jul 08 15:24:44 2012 +0000 @@ -37,12 +37,12 @@ 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 -r fb8dc26f65a4 -r 7962499f9cd6 Hardware/HDD/SSDMicron.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hardware/HDD/SSDMicron.cs Sun Jul 08 15:24:44 2012 +0000 @@ -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 -r fb8dc26f65a4 -r 7962499f9cd6 Hardware/HDD/SmartNames.cs --- a/Hardware/HDD/SmartNames.cs Mon Jul 02 21:14:40 2012 +0000 +++ b/Hardware/HDD/SmartNames.cs Sun Jul 08 15:24:44 2012 +0000 @@ -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 @@ 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 -r fb8dc26f65a4 -r 7962499f9cd6 Hardware/Sensor.cs --- a/Hardware/Sensor.cs Mon Jul 02 21:14:40 2012 +0000 +++ b/Hardware/Sensor.cs Sun Jul 08 15:24:44 2012 +0000 @@ -66,7 +66,7 @@ this.name = settings.GetValue( new Identifier(Identifier, "name").ToString(), name); - GetSensorValuesFromSettings(); + GetSensorValuesFromSettings(); hardware.Closing += delegate(IHardware h) { SetSensorValuesToSettings(); @@ -88,12 +88,12 @@ } 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 @@ } 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 -r fb8dc26f65a4 -r 7962499f9cd6 OpenHardwareMonitor.csproj --- a/OpenHardwareMonitor.csproj Mon Jul 02 21:14:40 2012 +0000 +++ b/OpenHardwareMonitor.csproj Sun Jul 08 15:24:44 2012 +0000 @@ -60,7 +60,6 @@ - diff -r fb8dc26f65a4 -r 7962499f9cd6 OpenHardwareMonitorLib.csproj --- a/OpenHardwareMonitorLib.csproj Mon Jul 02 21:14:40 2012 +0000 +++ b/OpenHardwareMonitorLib.csproj Sun Jul 08 15:24:44 2012 +0000 @@ -74,6 +74,7 @@ + diff -r fb8dc26f65a4 -r 7962499f9cd6 Properties/AssemblyVersion.cs --- a/Properties/AssemblyVersion.cs Mon Jul 02 21:14:40 2012 +0000 +++ b/Properties/AssemblyVersion.cs Sun Jul 08 15:24:44 2012 +0000 @@ -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