mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-31 14:25:16 +00:00
Added support for AMD 10h core temperature sensors and Asus ATK0110 devices on Linux.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Michael Möller <m.moeller@gmx.ch>.
|
||||
Portions created by the Initial Developer are Copyright (C) 2009-2010
|
||||
Portions created by the Initial Developer are Copyright (C) 2009-2011
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -42,6 +42,7 @@ using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
|
||||
@@ -64,6 +65,8 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
private readonly uint miscellaneousControlAddress;
|
||||
private readonly ushort miscellaneousControlDeviceId;
|
||||
|
||||
private readonly StreamReader temperatureReader;
|
||||
|
||||
private double timeStampCounterMultiplier;
|
||||
|
||||
public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
|
||||
@@ -114,6 +117,25 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
// restore the thread affinity.
|
||||
ThreadAffinity.Set(mask);
|
||||
|
||||
// the file reader for lm-sensors support on Linux
|
||||
temperatureReader = null;
|
||||
int p = (int)Environment.OSVersion.Platform;
|
||||
if ((p == 4) || (p == 128)) {
|
||||
string[] devicePaths = Directory.GetDirectories("/sys/class/hwmon/");
|
||||
foreach (string path in devicePaths) {
|
||||
string name = null;
|
||||
try {
|
||||
using (StreamReader reader = new StreamReader(path + "/device/name"))
|
||||
name = reader.ReadLine();
|
||||
} catch (IOException) { }
|
||||
switch (name) {
|
||||
case "k10temp":
|
||||
temperatureReader = new StreamReader(path + "/device/temp1_input");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
@@ -196,16 +218,28 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
public override void Update() {
|
||||
base.Update();
|
||||
|
||||
if (miscellaneousControlAddress != Ring0.InvalidPciAddress) {
|
||||
uint value;
|
||||
if (Ring0.ReadPciConfig(miscellaneousControlAddress,
|
||||
REPORTED_TEMPERATURE_CONTROL_REGISTER, out value)) {
|
||||
coreTemperature.Value = ((value >> 21) & 0x7FF) / 8.0f +
|
||||
coreTemperature.Parameters[0].Value;
|
||||
ActivateSensor(coreTemperature);
|
||||
} else {
|
||||
DeactivateSensor(coreTemperature);
|
||||
if (temperatureReader == null) {
|
||||
if (miscellaneousControlAddress != Ring0.InvalidPciAddress) {
|
||||
uint value;
|
||||
if (Ring0.ReadPciConfig(miscellaneousControlAddress,
|
||||
REPORTED_TEMPERATURE_CONTROL_REGISTER, out value)) {
|
||||
coreTemperature.Value = ((value >> 21) & 0x7FF) / 8.0f +
|
||||
coreTemperature.Parameters[0].Value;
|
||||
ActivateSensor(coreTemperature);
|
||||
} else {
|
||||
DeactivateSensor(coreTemperature);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
temperatureReader.BaseStream.Seek(0, SeekOrigin.Begin);
|
||||
string s = temperatureReader.ReadLine();
|
||||
try {
|
||||
coreTemperature.Value = 0.001f *
|
||||
long.Parse(s, CultureInfo.InvariantCulture);
|
||||
ActivateSensor(coreTemperature);
|
||||
} catch {
|
||||
DeactivateSensor(coreTemperature);
|
||||
}
|
||||
}
|
||||
|
||||
if (HasTimeStampCounter) {
|
||||
@@ -240,5 +274,11 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Close() {
|
||||
if (temperatureReader != null) {
|
||||
temperatureReader.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Michael Möller <m.moeller@gmx.ch>.
|
||||
Portions created by the Initial Developer are Copyright (C) 2009-2010
|
||||
Portions created by the Initial Developer are Copyright (C) 2009-2011
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -42,8 +42,8 @@ using System.Text;
|
||||
|
||||
namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
|
||||
internal class CPUGroup : IGroup {
|
||||
private readonly List<IHardware> hardware = new List<IHardware>();
|
||||
internal class CPUGroup : IGroup {
|
||||
private readonly List<GenericCPU> hardware = new List<GenericCPU>();
|
||||
|
||||
private readonly CPUID[][][] threads;
|
||||
|
||||
@@ -207,6 +207,10 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
return r.ToString();
|
||||
}
|
||||
|
||||
public void Close() { }
|
||||
public void Close() {
|
||||
foreach (GenericCPU cpu in hardware) {
|
||||
cpu.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Michael Möller <m.moeller@gmx.ch>.
|
||||
Portions created by the Initial Developer are Copyright (C) 2010
|
||||
Portions created by the Initial Developer are Copyright (C) 2010-2011
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -305,5 +305,9 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
totalLoad.Value = cpuLoad.GetTotalLoad();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Close() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -39,12 +39,26 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
|
||||
internal enum Chip : ushort {
|
||||
Unknown = 0,
|
||||
|
||||
ATK0110 = 0x0110,
|
||||
|
||||
F71858 = 0x0507,
|
||||
F71862 = 0x0601,
|
||||
F71869 = 0x0814,
|
||||
F71882 = 0x0541,
|
||||
F71889ED = 0x0909,
|
||||
F71889F = 0x0723,
|
||||
|
||||
IT8712F = 0x8712,
|
||||
IT8716F = 0x8716,
|
||||
IT8718F = 0x8718,
|
||||
IT8720F = 0x8720,
|
||||
IT8721F = 0x8721,
|
||||
IT8726F = 0x8726,
|
||||
|
||||
NCT6771F = 0xB470,
|
||||
NCT6776F = 0xC330,
|
||||
|
||||
W83627DHG = 0xA020,
|
||||
W83627DHGP = 0xB070,
|
||||
W83627EHF = 0x8800,
|
||||
@@ -52,15 +66,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
W83627THF = 0x8280,
|
||||
W83667HG = 0xA510,
|
||||
W83667HGB = 0xB350,
|
||||
W83687THF = 0x8541,
|
||||
NCT6771F = 0xB470,
|
||||
NCT6776F = 0xC330,
|
||||
F71858 = 0x0507,
|
||||
F71862 = 0x0601,
|
||||
F71869 = 0x0814,
|
||||
F71882 = 0x0541,
|
||||
F71889ED = 0x0909,
|
||||
F71889F = 0x0723
|
||||
W83687THF = 0x8541
|
||||
}
|
||||
|
||||
internal class ChipName {
|
||||
@@ -69,18 +75,25 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
|
||||
public static string GetName(Chip chip) {
|
||||
switch (chip) {
|
||||
case Chip.ATK0110: return "Asus ATK0110";
|
||||
|
||||
case Chip.F71858: return "Fintek F71858";
|
||||
case Chip.F71862: return "Fintek F71862";
|
||||
case Chip.F71869: return "Fintek F71869";
|
||||
case Chip.F71882: return "Fintek F71882";
|
||||
case Chip.F71889ED: return "Fintek F71889ED";
|
||||
case Chip.F71889F: return "Fintek F71889F";
|
||||
|
||||
case Chip.IT8712F: return "ITE IT8712F";
|
||||
case Chip.IT8716F: return "ITE IT8716F";
|
||||
case Chip.IT8718F: return "ITE IT8718F";
|
||||
case Chip.IT8721F: return "ITE IT8721F";
|
||||
case Chip.IT8720F: return "ITE IT8720F";
|
||||
case Chip.IT8726F: return "ITE IT8726F";
|
||||
|
||||
case Chip.NCT6771F: return "Nuvoton NCT6771F";
|
||||
case Chip.NCT6776F: return "Nuvoton NCT6776F";
|
||||
|
||||
case Chip.W83627DHG: return "Winbond W83627DHG";
|
||||
case Chip.W83627DHGP: return "Winbond W83627DHG-P";
|
||||
case Chip.W83627EHF: return "Winbond W83627EHF";
|
||||
@@ -89,8 +102,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
case Chip.W83667HG: return "Winbond W83667HG";
|
||||
case Chip.W83667HGB: return "Winbond W83667HG-B";
|
||||
case Chip.W83687THF: return "Winbond W83687THF";
|
||||
case Chip.NCT6771F: return "Nuvoton NCT6771F";
|
||||
case Chip.NCT6776F: return "Nuvoton NCT6776F";
|
||||
|
||||
case Chip.Unknown: return "Unkown";
|
||||
default: return "Unknown";
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Michael Möller <m.moeller@gmx.ch>.
|
||||
Portions created by the Initial Developer are Copyright (C) 2009-2010
|
||||
Portions created by the Initial Developer are Copyright (C) 2009-2011
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -46,44 +46,52 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
private readonly List<LMChip> lmChips = new List<LMChip>();
|
||||
|
||||
public LMSensors() {
|
||||
string[] devicePaths = Directory.GetDirectories("/sys/class/hwmon/");
|
||||
foreach (string path in devicePaths) {
|
||||
string name = null;
|
||||
try {
|
||||
using (StreamReader reader = new StreamReader(path + "/device/name"))
|
||||
name = reader.ReadLine();
|
||||
} catch (IOException) { }
|
||||
switch (name) {
|
||||
case "f71858fg":
|
||||
lmChips.Add(new LMChip(Chip.F71858, path + "/device")); break;
|
||||
case "f71862fg":
|
||||
lmChips.Add(new LMChip(Chip.F71862, path + "/device")); break;
|
||||
case "f71882fg":
|
||||
lmChips.Add(new LMChip(Chip.F71882, path + "/device")); break;
|
||||
case "f71889fg":
|
||||
lmChips.Add(new LMChip(Chip.F71889F, path + "/device")); break;
|
||||
string[] basePaths = Directory.GetDirectories("/sys/class/hwmon/");
|
||||
foreach (string basePath in basePaths) {
|
||||
foreach (string devicePath in new[] { "/device", "" }) {
|
||||
string path = basePath + devicePath;
|
||||
|
||||
case "it8712":
|
||||
lmChips.Add(new LMChip(Chip.IT8712F, path + "/device")); break;
|
||||
case "it8716":
|
||||
lmChips.Add(new LMChip(Chip.IT8716F, path + "/device")); break;
|
||||
case "it8718":
|
||||
lmChips.Add(new LMChip(Chip.IT8718F, path + "/device")); break;
|
||||
case "it8720":
|
||||
lmChips.Add(new LMChip(Chip.IT8720F, path + "/device")); break;
|
||||
string name = null;
|
||||
try {
|
||||
using (StreamReader reader = new StreamReader(path + "/name"))
|
||||
name = reader.ReadLine();
|
||||
} catch (IOException) { }
|
||||
|
||||
case "w83627ehf":
|
||||
lmChips.Add(new LMChip(Chip.W83627EHF, path + "/device")); break;
|
||||
case "w83627dhg":
|
||||
lmChips.Add(new LMChip(Chip.W83627DHG, path + "/device")); break;
|
||||
case "w83667hg":
|
||||
lmChips.Add(new LMChip(Chip.W83667HG, path + "/device")); break;
|
||||
case "w83627hf":
|
||||
lmChips.Add(new LMChip(Chip.W83627HF, path + "/device")); break;
|
||||
case "w83627thf":
|
||||
lmChips.Add(new LMChip(Chip.W83627THF, path + "/device")); break;
|
||||
case "w83687thf":
|
||||
lmChips.Add(new LMChip(Chip.W83687THF, path + "/device")); break;
|
||||
switch (name) {
|
||||
case "atk0110":
|
||||
lmChips.Add(new LMChip(Chip.ATK0110, path)); break;
|
||||
|
||||
case "f71858fg":
|
||||
lmChips.Add(new LMChip(Chip.F71858, path)); break;
|
||||
case "f71862fg":
|
||||
lmChips.Add(new LMChip(Chip.F71862, path)); break;
|
||||
case "f71882fg":
|
||||
lmChips.Add(new LMChip(Chip.F71882, path)); break;
|
||||
case "f71889fg":
|
||||
lmChips.Add(new LMChip(Chip.F71889F, path)); break;
|
||||
|
||||
case "it8712":
|
||||
lmChips.Add(new LMChip(Chip.IT8712F, path)); break;
|
||||
case "it8716":
|
||||
lmChips.Add(new LMChip(Chip.IT8716F, path)); break;
|
||||
case "it8718":
|
||||
lmChips.Add(new LMChip(Chip.IT8718F, path)); break;
|
||||
case "it8720":
|
||||
lmChips.Add(new LMChip(Chip.IT8720F, path)); break;
|
||||
|
||||
case "w83627ehf":
|
||||
lmChips.Add(new LMChip(Chip.W83627EHF, path)); break;
|
||||
case "w83627dhg":
|
||||
lmChips.Add(new LMChip(Chip.W83627DHG, path)); break;
|
||||
case "w83667hg":
|
||||
lmChips.Add(new LMChip(Chip.W83667HG, path)); break;
|
||||
case "w83627hf":
|
||||
lmChips.Add(new LMChip(Chip.W83627HF, path)); break;
|
||||
case "w83627thf":
|
||||
lmChips.Add(new LMChip(Chip.W83627THF, path)); break;
|
||||
case "w83687thf":
|
||||
lmChips.Add(new LMChip(Chip.W83687THF, path)); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -37,5 +37,5 @@
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("0.2.1.14")]
|
||||
[assembly: AssemblyInformationalVersion("0.2.1.14 Alpha")]
|
||||
[assembly: AssemblyVersion("0.2.1.16")]
|
||||
[assembly: AssemblyInformationalVersion("0.2.1.16 Alpha")]
|
Reference in New Issue
Block a user