Added support for AMD 10h core temperature sensors and Asus ATK0110 devices on Linux.
1.1 --- a/Hardware/CPU/AMD10CPU.cs Sat Mar 19 22:55:05 2011 +0000
1.2 +++ b/Hardware/CPU/AMD10CPU.cs Sat Apr 09 20:16:42 2011 +0000
1.3 @@ -16,7 +16,7 @@
1.4
1.5 The Initial Developer of the Original Code is
1.6 Michael Möller <m.moeller@gmx.ch>.
1.7 - Portions created by the Initial Developer are Copyright (C) 2009-2010
1.8 + Portions created by the Initial Developer are Copyright (C) 2009-2011
1.9 the Initial Developer. All Rights Reserved.
1.10
1.11 Contributor(s):
1.12 @@ -42,6 +42,7 @@
1.13 using System.Runtime.InteropServices;
1.14 using System.Text;
1.15 using System.Threading;
1.16 +using System.IO;
1.17
1.18 namespace OpenHardwareMonitor.Hardware.CPU {
1.19
1.20 @@ -64,6 +65,8 @@
1.21 private readonly uint miscellaneousControlAddress;
1.22 private readonly ushort miscellaneousControlDeviceId;
1.23
1.24 + private readonly StreamReader temperatureReader;
1.25 +
1.26 private double timeStampCounterMultiplier;
1.27
1.28 public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
1.29 @@ -114,6 +117,25 @@
1.30 // restore the thread affinity.
1.31 ThreadAffinity.Set(mask);
1.32
1.33 + // the file reader for lm-sensors support on Linux
1.34 + temperatureReader = null;
1.35 + int p = (int)Environment.OSVersion.Platform;
1.36 + if ((p == 4) || (p == 128)) {
1.37 + string[] devicePaths = Directory.GetDirectories("/sys/class/hwmon/");
1.38 + foreach (string path in devicePaths) {
1.39 + string name = null;
1.40 + try {
1.41 + using (StreamReader reader = new StreamReader(path + "/device/name"))
1.42 + name = reader.ReadLine();
1.43 + } catch (IOException) { }
1.44 + switch (name) {
1.45 + case "k10temp":
1.46 + temperatureReader = new StreamReader(path + "/device/temp1_input");
1.47 + break;
1.48 + }
1.49 + }
1.50 + }
1.51 +
1.52 Update();
1.53 }
1.54
1.55 @@ -196,16 +218,28 @@
1.56 public override void Update() {
1.57 base.Update();
1.58
1.59 - if (miscellaneousControlAddress != Ring0.InvalidPciAddress) {
1.60 - uint value;
1.61 - if (Ring0.ReadPciConfig(miscellaneousControlAddress,
1.62 - REPORTED_TEMPERATURE_CONTROL_REGISTER, out value)) {
1.63 - coreTemperature.Value = ((value >> 21) & 0x7FF) / 8.0f +
1.64 - coreTemperature.Parameters[0].Value;
1.65 + if (temperatureReader == null) {
1.66 + if (miscellaneousControlAddress != Ring0.InvalidPciAddress) {
1.67 + uint value;
1.68 + if (Ring0.ReadPciConfig(miscellaneousControlAddress,
1.69 + REPORTED_TEMPERATURE_CONTROL_REGISTER, out value)) {
1.70 + coreTemperature.Value = ((value >> 21) & 0x7FF) / 8.0f +
1.71 + coreTemperature.Parameters[0].Value;
1.72 + ActivateSensor(coreTemperature);
1.73 + } else {
1.74 + DeactivateSensor(coreTemperature);
1.75 + }
1.76 + }
1.77 + } else {
1.78 + temperatureReader.BaseStream.Seek(0, SeekOrigin.Begin);
1.79 + string s = temperatureReader.ReadLine();
1.80 + try {
1.81 + coreTemperature.Value = 0.001f *
1.82 + long.Parse(s, CultureInfo.InvariantCulture);
1.83 ActivateSensor(coreTemperature);
1.84 - } else {
1.85 + } catch {
1.86 DeactivateSensor(coreTemperature);
1.87 - }
1.88 + }
1.89 }
1.90
1.91 if (HasTimeStampCounter) {
1.92 @@ -240,5 +274,11 @@
1.93 }
1.94 }
1.95 }
1.96 +
1.97 + public override void Close() {
1.98 + if (temperatureReader != null) {
1.99 + temperatureReader.Close();
1.100 + }
1.101 + }
1.102 }
1.103 }
2.1 --- a/Hardware/CPU/CPUGroup.cs Sat Mar 19 22:55:05 2011 +0000
2.2 +++ b/Hardware/CPU/CPUGroup.cs Sat Apr 09 20:16:42 2011 +0000
2.3 @@ -16,7 +16,7 @@
2.4
2.5 The Initial Developer of the Original Code is
2.6 Michael Möller <m.moeller@gmx.ch>.
2.7 - Portions created by the Initial Developer are Copyright (C) 2009-2010
2.8 + Portions created by the Initial Developer are Copyright (C) 2009-2011
2.9 the Initial Developer. All Rights Reserved.
2.10
2.11 Contributor(s):
2.12 @@ -42,8 +42,8 @@
2.13
2.14 namespace OpenHardwareMonitor.Hardware.CPU {
2.15
2.16 - internal class CPUGroup : IGroup {
2.17 - private readonly List<IHardware> hardware = new List<IHardware>();
2.18 + internal class CPUGroup : IGroup {
2.19 + private readonly List<GenericCPU> hardware = new List<GenericCPU>();
2.20
2.21 private readonly CPUID[][][] threads;
2.22
2.23 @@ -207,6 +207,10 @@
2.24 return r.ToString();
2.25 }
2.26
2.27 - public void Close() { }
2.28 + public void Close() {
2.29 + foreach (GenericCPU cpu in hardware) {
2.30 + cpu.Close();
2.31 + }
2.32 + }
2.33 }
2.34 }
3.1 --- a/Hardware/CPU/GenericCPU.cs Sat Mar 19 22:55:05 2011 +0000
3.2 +++ b/Hardware/CPU/GenericCPU.cs Sat Apr 09 20:16:42 2011 +0000
3.3 @@ -16,7 +16,7 @@
3.4
3.5 The Initial Developer of the Original Code is
3.6 Michael Möller <m.moeller@gmx.ch>.
3.7 - Portions created by the Initial Developer are Copyright (C) 2010
3.8 + Portions created by the Initial Developer are Copyright (C) 2010-2011
3.9 the Initial Developer. All Rights Reserved.
3.10
3.11 Contributor(s):
3.12 @@ -305,5 +305,9 @@
3.13 totalLoad.Value = cpuLoad.GetTotalLoad();
3.14 }
3.15 }
3.16 +
3.17 + public virtual void Close() {
3.18 +
3.19 + }
3.20 }
3.21 }
4.1 --- a/Hardware/LPC/Chip.cs Sat Mar 19 22:55:05 2011 +0000
4.2 +++ b/Hardware/LPC/Chip.cs Sat Apr 09 20:16:42 2011 +0000
4.3 @@ -39,12 +39,26 @@
4.4
4.5 internal enum Chip : ushort {
4.6 Unknown = 0,
4.7 +
4.8 + ATK0110 = 0x0110,
4.9 +
4.10 + F71858 = 0x0507,
4.11 + F71862 = 0x0601,
4.12 + F71869 = 0x0814,
4.13 + F71882 = 0x0541,
4.14 + F71889ED = 0x0909,
4.15 + F71889F = 0x0723,
4.16 +
4.17 IT8712F = 0x8712,
4.18 IT8716F = 0x8716,
4.19 IT8718F = 0x8718,
4.20 IT8720F = 0x8720,
4.21 IT8721F = 0x8721,
4.22 IT8726F = 0x8726,
4.23 +
4.24 + NCT6771F = 0xB470,
4.25 + NCT6776F = 0xC330,
4.26 +
4.27 W83627DHG = 0xA020,
4.28 W83627DHGP = 0xB070,
4.29 W83627EHF = 0x8800,
4.30 @@ -52,15 +66,7 @@
4.31 W83627THF = 0x8280,
4.32 W83667HG = 0xA510,
4.33 W83667HGB = 0xB350,
4.34 - W83687THF = 0x8541,
4.35 - NCT6771F = 0xB470,
4.36 - NCT6776F = 0xC330,
4.37 - F71858 = 0x0507,
4.38 - F71862 = 0x0601,
4.39 - F71869 = 0x0814,
4.40 - F71882 = 0x0541,
4.41 - F71889ED = 0x0909,
4.42 - F71889F = 0x0723
4.43 + W83687THF = 0x8541
4.44 }
4.45
4.46 internal class ChipName {
4.47 @@ -69,18 +75,25 @@
4.48
4.49 public static string GetName(Chip chip) {
4.50 switch (chip) {
4.51 + case Chip.ATK0110: return "Asus ATK0110";
4.52 +
4.53 case Chip.F71858: return "Fintek F71858";
4.54 case Chip.F71862: return "Fintek F71862";
4.55 case Chip.F71869: return "Fintek F71869";
4.56 case Chip.F71882: return "Fintek F71882";
4.57 case Chip.F71889ED: return "Fintek F71889ED";
4.58 case Chip.F71889F: return "Fintek F71889F";
4.59 +
4.60 case Chip.IT8712F: return "ITE IT8712F";
4.61 case Chip.IT8716F: return "ITE IT8716F";
4.62 case Chip.IT8718F: return "ITE IT8718F";
4.63 case Chip.IT8721F: return "ITE IT8721F";
4.64 case Chip.IT8720F: return "ITE IT8720F";
4.65 case Chip.IT8726F: return "ITE IT8726F";
4.66 +
4.67 + case Chip.NCT6771F: return "Nuvoton NCT6771F";
4.68 + case Chip.NCT6776F: return "Nuvoton NCT6776F";
4.69 +
4.70 case Chip.W83627DHG: return "Winbond W83627DHG";
4.71 case Chip.W83627DHGP: return "Winbond W83627DHG-P";
4.72 case Chip.W83627EHF: return "Winbond W83627EHF";
4.73 @@ -89,8 +102,7 @@
4.74 case Chip.W83667HG: return "Winbond W83667HG";
4.75 case Chip.W83667HGB: return "Winbond W83667HG-B";
4.76 case Chip.W83687THF: return "Winbond W83687THF";
4.77 - case Chip.NCT6771F: return "Nuvoton NCT6771F";
4.78 - case Chip.NCT6776F: return "Nuvoton NCT6776F";
4.79 +
4.80 case Chip.Unknown: return "Unkown";
4.81 default: return "Unknown";
4.82 }
5.1 --- a/Hardware/LPC/LMSensors.cs Sat Mar 19 22:55:05 2011 +0000
5.2 +++ b/Hardware/LPC/LMSensors.cs Sat Apr 09 20:16:42 2011 +0000
5.3 @@ -16,7 +16,7 @@
5.4
5.5 The Initial Developer of the Original Code is
5.6 Michael Möller <m.moeller@gmx.ch>.
5.7 - Portions created by the Initial Developer are Copyright (C) 2009-2010
5.8 + Portions created by the Initial Developer are Copyright (C) 2009-2011
5.9 the Initial Developer. All Rights Reserved.
5.10
5.11 Contributor(s):
5.12 @@ -46,44 +46,52 @@
5.13 private readonly List<LMChip> lmChips = new List<LMChip>();
5.14
5.15 public LMSensors() {
5.16 - string[] devicePaths = Directory.GetDirectories("/sys/class/hwmon/");
5.17 - foreach (string path in devicePaths) {
5.18 - string name = null;
5.19 - try {
5.20 - using (StreamReader reader = new StreamReader(path + "/device/name"))
5.21 - name = reader.ReadLine();
5.22 - } catch (IOException) { }
5.23 - switch (name) {
5.24 - case "f71858fg":
5.25 - lmChips.Add(new LMChip(Chip.F71858, path + "/device")); break;
5.26 - case "f71862fg":
5.27 - lmChips.Add(new LMChip(Chip.F71862, path + "/device")); break;
5.28 - case "f71882fg":
5.29 - lmChips.Add(new LMChip(Chip.F71882, path + "/device")); break;
5.30 - case "f71889fg":
5.31 - lmChips.Add(new LMChip(Chip.F71889F, path + "/device")); break;
5.32 + string[] basePaths = Directory.GetDirectories("/sys/class/hwmon/");
5.33 + foreach (string basePath in basePaths) {
5.34 + foreach (string devicePath in new[] { "/device", "" }) {
5.35 + string path = basePath + devicePath;
5.36
5.37 - case "it8712":
5.38 - lmChips.Add(new LMChip(Chip.IT8712F, path + "/device")); break;
5.39 - case "it8716":
5.40 - lmChips.Add(new LMChip(Chip.IT8716F, path + "/device")); break;
5.41 - case "it8718":
5.42 - lmChips.Add(new LMChip(Chip.IT8718F, path + "/device")); break;
5.43 - case "it8720":
5.44 - lmChips.Add(new LMChip(Chip.IT8720F, path + "/device")); break;
5.45 + string name = null;
5.46 + try {
5.47 + using (StreamReader reader = new StreamReader(path + "/name"))
5.48 + name = reader.ReadLine();
5.49 + } catch (IOException) { }
5.50
5.51 - case "w83627ehf":
5.52 - lmChips.Add(new LMChip(Chip.W83627EHF, path + "/device")); break;
5.53 - case "w83627dhg":
5.54 - lmChips.Add(new LMChip(Chip.W83627DHG, path + "/device")); break;
5.55 - case "w83667hg":
5.56 - lmChips.Add(new LMChip(Chip.W83667HG, path + "/device")); break;
5.57 - case "w83627hf":
5.58 - lmChips.Add(new LMChip(Chip.W83627HF, path + "/device")); break;
5.59 - case "w83627thf":
5.60 - lmChips.Add(new LMChip(Chip.W83627THF, path + "/device")); break;
5.61 - case "w83687thf":
5.62 - lmChips.Add(new LMChip(Chip.W83687THF, path + "/device")); break;
5.63 + switch (name) {
5.64 + case "atk0110":
5.65 + lmChips.Add(new LMChip(Chip.ATK0110, path)); break;
5.66 +
5.67 + case "f71858fg":
5.68 + lmChips.Add(new LMChip(Chip.F71858, path)); break;
5.69 + case "f71862fg":
5.70 + lmChips.Add(new LMChip(Chip.F71862, path)); break;
5.71 + case "f71882fg":
5.72 + lmChips.Add(new LMChip(Chip.F71882, path)); break;
5.73 + case "f71889fg":
5.74 + lmChips.Add(new LMChip(Chip.F71889F, path)); break;
5.75 +
5.76 + case "it8712":
5.77 + lmChips.Add(new LMChip(Chip.IT8712F, path)); break;
5.78 + case "it8716":
5.79 + lmChips.Add(new LMChip(Chip.IT8716F, path)); break;
5.80 + case "it8718":
5.81 + lmChips.Add(new LMChip(Chip.IT8718F, path)); break;
5.82 + case "it8720":
5.83 + lmChips.Add(new LMChip(Chip.IT8720F, path)); break;
5.84 +
5.85 + case "w83627ehf":
5.86 + lmChips.Add(new LMChip(Chip.W83627EHF, path)); break;
5.87 + case "w83627dhg":
5.88 + lmChips.Add(new LMChip(Chip.W83627DHG, path)); break;
5.89 + case "w83667hg":
5.90 + lmChips.Add(new LMChip(Chip.W83667HG, path)); break;
5.91 + case "w83627hf":
5.92 + lmChips.Add(new LMChip(Chip.W83627HF, path)); break;
5.93 + case "w83627thf":
5.94 + lmChips.Add(new LMChip(Chip.W83627THF, path)); break;
5.95 + case "w83687thf":
5.96 + lmChips.Add(new LMChip(Chip.W83687THF, path)); break;
5.97 + }
5.98 }
5.99 }
5.100 }
6.1 --- a/Properties/AssemblyVersion.cs Sat Mar 19 22:55:05 2011 +0000
6.2 +++ b/Properties/AssemblyVersion.cs Sat Apr 09 20:16:42 2011 +0000
6.3 @@ -37,5 +37,5 @@
6.4
6.5 using System.Reflection;
6.6
6.7 -[assembly: AssemblyVersion("0.2.1.14")]
6.8 -[assembly: AssemblyInformationalVersion("0.2.1.14 Alpha")]
6.9 \ No newline at end of file
6.10 +[assembly: AssemblyVersion("0.2.1.16")]
6.11 +[assembly: AssemblyInformationalVersion("0.2.1.16 Alpha")]
6.12 \ No newline at end of file