Added support for SSDs with a controller from Micron.
authormoel.mich
Sun, 08 Jul 2012 15:24:44 +0000
changeset 3587962499f9cd6
parent 357 fb8dc26f65a4
child 359 30bb76a1da24
Added support for SSDs with a controller from Micron.
GUI/PortForm.cs
Hardware/HDD/AbstractHarddrive.cs
Hardware/HDD/DebugSmart.cs
Hardware/HDD/HDDGeneric.cs
Hardware/HDD/SSDMicron.cs
Hardware/HDD/SmartNames.cs
Hardware/Sensor.cs
OpenHardwareMonitor.csproj
OpenHardwareMonitorLib.csproj
Properties/AssemblyVersion.cs
     1.1 --- a/GUI/PortForm.cs	Mon Jul 02 21:14:40 2012 +0000
     1.2 +++ b/GUI/PortForm.cs	Sun Jul 08 15:24:44 2012 +0000
     1.3 @@ -11,7 +11,6 @@
     1.4  using System;
     1.5  using System.Collections.Generic;
     1.6  using System.ComponentModel;
     1.7 -using System.Data;
     1.8  using System.Drawing;
     1.9  using System.Text;
    1.10  using System.Windows.Forms;
     2.1 --- a/Hardware/HDD/AbstractHarddrive.cs	Mon Jul 02 21:14:40 2012 +0000
     2.2 +++ b/Hardware/HDD/AbstractHarddrive.cs	Sun Jul 08 15:24:44 2012 +0000
     2.3 @@ -28,6 +28,7 @@
     2.4        typeof(SSDSandforce),
     2.5        typeof(SSDIndilinx),
     2.6        typeof(SSDSamsung),
     2.7 +      typeof(SSDMicron),
     2.8        typeof(GenericHarddisk)
     2.9      };
    2.10  
     3.1 --- a/Hardware/HDD/DebugSmart.cs	Mon Jul 02 21:14:40 2012 +0000
     3.2 +++ b/Hardware/HDD/DebugSmart.cs	Sun Jul 08 15:24:44 2012 +0000
     3.3 @@ -263,8 +263,57 @@
     3.4              C6 000000000000 100 100 0  
     3.5              C7 000000000000 100 100 0  
     3.6              CA 000000000000 100 100 0  
     3.7 -            CE 000000000000 100 100 0")
     3.8 -      };
     3.9 +            CE 000000000000 100 100 0"),
    3.10 +
    3.11 +        new Drive("M4-CT064M4SSD2", "0009", 16, 
    3.12 +          @"01 000000000000 100 100 50
    3.13 +            05 000000000000 100 100 10
    3.14 +            09 260000000000 100 100 1 
    3.15 +            0C 5A0000000000 100 100 1 
    3.16 +            AA 000000000000 100 100 10
    3.17 +            AB 000000000000 100 100 1 
    3.18 +            AC 000000000000 100 100 1 
    3.19 +            AD 010000000000 100 100 10
    3.20 +            AE 000000000000 100 100 1 
    3.21 +            B5 2B000E003A00 100 100 1 
    3.22 +            B7 000000000000 100 100 1 
    3.23 +            B8 000000000000 100 100 50
    3.24 +            BB 000000000000 100 100 1 
    3.25 +            BC 000000000000 100 100 1 
    3.26 +            BD 310000000000 100 100 1 
    3.27 +            C2 000000000000 100 100 0 
    3.28 +            C3 000000000000 100 100 1 
    3.29 +            C4 000000000000 100 100 1 
    3.30 +            C5 000000000000 100 100 1 
    3.31 +            C6 000000000000 100 100 1 
    3.32 +            C7 000000000000 100 100 1 
    3.33 +            CA 000000000000 100 100 1 
    3.34 +            CE 000000000000 100 100 1"),
    3.35 +
    3.36 +        new Drive("M4-CT128M4SSD2", "000F", 16, 
    3.37 +          @"01 000000000000 100 100 50 
    3.38 +            05 000000000000 100 100 10 
    3.39 +            09 CA1400000000 100 100 1  
    3.40 +            0C A30200000000 100 100 1  
    3.41 +            AA 000000000000 100 100 10 
    3.42 +            AB 000000000000 100 100 1  
    3.43 +            AC 000000000000 100 100 1  
    3.44 +            AD 1F0000000000 99  99  10 
    3.45 +            AE 140000000000 100 100 1  
    3.46 +            B5 12037C028E05 100 100 1  
    3.47 +            B7 000000000000 100 100 1  
    3.48 +            B8 000000000000 100 100 50 
    3.49 +            BB 000000000000 100 100 1  
    3.50 +            BC 000000000000 100 100 1  
    3.51 +            BD 510000000000 100 100 1  
    3.52 +            C2 000000000000 100 100 0  
    3.53 +            C3 000000000000 100 100 1  
    3.54 +            C4 000000000000 100 100 1  
    3.55 +            C5 000000000000 100 100 1  
    3.56 +            C6 000000000000 100 100 1  
    3.57 +            C7 000000000000 100 100 1  
    3.58 +            CA 010000000000 99  99  1  
    3.59 +            CE 000000000000 100 100 1 ")};
    3.60  
    3.61      public IntPtr OpenDrive(int driveNumber) {
    3.62        if (driveNumber < drives.Length)
     4.1 --- a/Hardware/HDD/HDDGeneric.cs	Mon Jul 02 21:14:40 2012 +0000
     4.2 +++ b/Hardware/HDD/HDDGeneric.cs	Sun Jul 08 15:24:44 2012 +0000
     4.3 @@ -37,12 +37,12 @@
     4.4        new SmartAttribute(0xAA, SmartNames.Unknown), 
     4.5        new SmartAttribute(0xAB, SmartNames.Unknown), 
     4.6        new SmartAttribute(0xAC, SmartNames.Unknown),
     4.7 -      new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount),
     4.8 +      new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
     4.9        new SmartAttribute(0xB8, SmartNames.EndToEndError),
    4.10        new SmartAttribute(0xB9, SmartNames.HeadStability),
    4.11        new SmartAttribute(0xBA, SmartNames.InducedOpVibrationDetection),
    4.12 -      new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors),
    4.13 -      new SmartAttribute(0xBC, SmartNames.CommandTimeout),
    4.14 +      new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
    4.15 +      new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt),
    4.16        new SmartAttribute(0xBD, SmartNames.HighFlyWrites),
    4.17        new SmartAttribute(0xBF, SmartNames.GSenseErrorRate),
    4.18        new SmartAttribute(0xC0, SmartNames.EmergencyRetractCycleCount),
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/Hardware/HDD/SSDMicron.cs	Sun Jul 08 15:24:44 2012 +0000
     5.3 @@ -0,0 +1,51 @@
     5.4 +/*
     5.5 + 
     5.6 +  This Source Code Form is subject to the terms of the Mozilla Public
     5.7 +  License, v. 2.0. If a copy of the MPL was not distributed with this
     5.8 +  file, You can obtain one at http://mozilla.org/MPL/2.0/.
     5.9 + 
    5.10 +  Copyright (C) 2012 Michael Möller <mmoeller@openhardwaremonitor.org>
    5.11 +	
    5.12 +*/
    5.13 +
    5.14 +namespace OpenHardwareMonitor.Hardware.HDD {
    5.15 +  using System.Collections.Generic;
    5.16 +
    5.17 +  [NamePrefix(""), RequireSmart(0xAA), RequireSmart(0xAB), RequireSmart(0xAC), 
    5.18 +   RequireSmart(0xAD), RequireSmart(0xAE), RequireSmart(0xCA)]
    5.19 +  internal class SSDMicron : AbstractHarddrive {
    5.20 +
    5.21 +    private static readonly IEnumerable<SmartAttribute> smartAttributes =
    5.22 +      new List<SmartAttribute> {
    5.23 +      
    5.24 +      new SmartAttribute(0x01, SmartNames.ReadErrorRate, RawToInt),
    5.25 +      new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount, RawToInt),
    5.26 +      new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
    5.27 +      new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
    5.28 +      new SmartAttribute(0xAA, SmartNames.NewFailingBlockCount, RawToInt),
    5.29 +      new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
    5.30 +      new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
    5.31 +      new SmartAttribute(0xAD, SmartNames.WearLevelingCount, RawToInt),
    5.32 +      new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
    5.33 +      new SmartAttribute(0xB5, SmartNames.Non4kAlignedAccess, 
    5.34 +        (byte[] raw, byte value) => { return 6e4f * ((raw[5] << 8) | raw[4]); }),
    5.35 +      new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
    5.36 +      new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
    5.37 +      new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt),
    5.38 +      new SmartAttribute(0xBD, SmartNames.FactoryBadBlockCount, RawToInt),
    5.39 +      new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
    5.40 +      new SmartAttribute(0xC5, SmartNames.CurrentPendingSectorCount),
    5.41 +      new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
    5.42 +      new SmartAttribute(0xC7, SmartNames.UltraDmaCrcErrorCount, RawToInt),
    5.43 +      new SmartAttribute(0xCA, SmartNames.RemainingLife, 
    5.44 +        (byte[] raw, byte value) => { return 100 - RawToInt(raw, value); }, 
    5.45 +        SensorType.Level, 0),
    5.46 +      new SmartAttribute(0xCE, SmartNames.WriteErrorRate, 
    5.47 +         (byte[] raw, byte value) => { return 6e4f * ((raw[1] << 8) | raw[0]); }),
    5.48 +    };
    5.49 +
    5.50 +    public SSDMicron(ISmart smart, string name, string firmwareRevision, 
    5.51 +      int index, ISettings settings)
    5.52 +      : base(smart, name, firmwareRevision, index, smartAttributes, settings) {}
    5.53 +  }
    5.54 +}
     6.1 --- a/Hardware/HDD/SmartNames.cs	Mon Jul 02 21:14:40 2012 +0000
     6.2 +++ b/Hardware/HDD/SmartNames.cs	Sun Jul 08 15:24:44 2012 +0000
     6.3 @@ -4,7 +4,7 @@
     6.4    License, v. 2.0. If a copy of the MPL was not distributed with this
     6.5    file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6.6   
     6.7 -  Copyright (C) 2011 Michael Möller <mmoeller@openhardwaremonitor.org>
     6.8 +  Copyright (C) 2011-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
     6.9    Copyright (C) 2011 Roland Reinl <roland-reinl@gmx.de>
    6.10  	
    6.11  */
    6.12 @@ -478,5 +478,17 @@
    6.13      public static string RawReadErrorRate {
    6.14        get { return "Raw Read Error Rate"; }
    6.15      }
    6.16 +
    6.17 +    public static string NewFailingBlockCount {
    6.18 +      get { return "New Failing Block Count"; }
    6.19 +    }
    6.20 +
    6.21 +    public static string Non4kAlignedAccess {
    6.22 +      get { return "Non-4k Aligned Access"; }
    6.23 +    }
    6.24 +
    6.25 +    public static string FactoryBadBlockCount {
    6.26 +      get { return "Factory Bad Block Count"; }
    6.27 +    }
    6.28    }
    6.29  }
    6.30 \ No newline at end of file
     7.1 --- a/Hardware/Sensor.cs	Mon Jul 02 21:14:40 2012 +0000
     7.2 +++ b/Hardware/Sensor.cs	Sun Jul 08 15:24:44 2012 +0000
     7.3 @@ -66,7 +66,7 @@
     7.4        this.name = settings.GetValue(
     7.5          new Identifier(Identifier, "name").ToString(), name);
     7.6  
     7.7 -      GetSensorValuesFromSettings();
     7.8 +      GetSensorValuesFromSettings();      
     7.9  
    7.10        hardware.Closing += delegate(IHardware h) {
    7.11          SetSensorValuesToSettings();
    7.12 @@ -88,12 +88,12 @@
    7.13      }
    7.14  
    7.15      private void GetSensorValuesFromSettings() {
    7.16 -      string s = settings.GetValue(
    7.17 -        new Identifier(Identifier, "values").ToString(), null);
    7.18 +      string name = new Identifier(Identifier, "values").ToString();
    7.19 +      string s = settings.GetValue(name, null);
    7.20  
    7.21 -      byte[] array = null;
    7.22        try {
    7.23 -        array = Convert.FromBase64String(s);
    7.24 +        byte[] array = Convert.FromBase64String(s);
    7.25 +        s = null;
    7.26          using (MemoryStream m = new MemoryStream(array))
    7.27          using (GZipStream c = new GZipStream(m, CompressionMode.Decompress))
    7.28          using (BinaryReader reader = new BinaryReader(c)) {
    7.29 @@ -108,6 +108,9 @@
    7.30        } catch { }
    7.31        if (values.Count > 0)
    7.32          AppendValue(float.NaN, DateTime.UtcNow);
    7.33 +
    7.34 +      // remove the value string from the settings to reduce memory usage
    7.35 +      settings.Remove(name);
    7.36      }
    7.37  
    7.38      private void AppendValue(float value, DateTime time) {
     8.1 --- a/OpenHardwareMonitor.csproj	Mon Jul 02 21:14:40 2012 +0000
     8.2 +++ b/OpenHardwareMonitor.csproj	Sun Jul 08 15:24:44 2012 +0000
     8.3 @@ -60,7 +60,6 @@
     8.4    <ItemGroup>
     8.5      <Reference Include="System" />
     8.6      <Reference Include="System.Configuration.Install" />
     8.7 -    <Reference Include="System.Data" />
     8.8      <Reference Include="System.Drawing" />
     8.9      <Reference Include="System.Management" />
    8.10      <Reference Include="System.Windows.Forms" />
     9.1 --- a/OpenHardwareMonitorLib.csproj	Mon Jul 02 21:14:40 2012 +0000
     9.2 +++ b/OpenHardwareMonitorLib.csproj	Sun Jul 08 15:24:44 2012 +0000
     9.3 @@ -74,6 +74,7 @@
     9.4      <Compile Include="Hardware\HDD\NamePrefixAttribute.cs" />
     9.5      <Compile Include="Hardware\HDD\SSDIndilinx.cs" />
     9.6      <Compile Include="Hardware\HDD\SSDIntel.cs" />
     9.7 +    <Compile Include="Hardware\HDD\SSDMicron.cs" />
     9.8      <Compile Include="Hardware\HDD\SSDPlextor.cs" />
     9.9      <Compile Include="Hardware\HDD\SSDSamsung.cs" />
    9.10      <Compile Include="Hardware\HDD\SSDSandforce.cs" />
    10.1 --- a/Properties/AssemblyVersion.cs	Mon Jul 02 21:14:40 2012 +0000
    10.2 +++ b/Properties/AssemblyVersion.cs	Sun Jul 08 15:24:44 2012 +0000
    10.3 @@ -10,5 +10,5 @@
    10.4  
    10.5  using System.Reflection;
    10.6  
    10.7 -[assembly: AssemblyVersion("0.4.0.12")]
    10.8 -[assembly: AssemblyInformationalVersion("0.4.0.12 Alpha")]
    10.9 \ No newline at end of file
   10.10 +[assembly: AssemblyVersion("0.4.0.13")]
   10.11 +[assembly: AssemblyInformationalVersion("0.4.0.13 Alpha")]
   10.12 \ No newline at end of file