Skip to content

Commit

Permalink
SuperIO backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Sep 9, 2023
1 parent 7520213 commit 9c7b36b
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 4 deletions.
57 changes: 54 additions & 3 deletions core/Classes/HardwareInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public void GetInfo() {

API.RAM.Load.Clear();

API.System.SuperIO.Voltage.Clear();
API.System.SuperIO.Temperature.Clear();
API.System.SuperIO.Fan.Clear();
API.System.SuperIO.FanControl.Clear();

var diskID = -1;

for (int i = 0; i < computerHardware.Count; i++) {
Expand All @@ -72,6 +77,7 @@ public void GetInfo() {

if (computerHardware[i].HardwareType == HardwareType.Motherboard) {
API.System.Motherboard.Name = computerHardware[i].Name;
API.System.SuperIO.Name = computerHardware[i].SubHardware[0].Name;
}
}

Expand Down Expand Up @@ -133,6 +139,51 @@ public void GetInfo() {
}
}

// Get superIO info
if (computerHardware[i].HardwareType == HardwareType.Motherboard) {
var sh = computerHardware[i].SubHardware[0];

for (int j = 0; j < sh.Sensors.Length; j++) {
if (sh.Sensors[j].SensorType == SensorType.Voltage) {
API.System.SuperIO.Voltage.Add(new Sensor {
Name = sh.Sensors[j].Name,
Value = (float)Math.Round((float)sh.Sensors[j].Value, 2),
Min = (float)Math.Round((float)sh.Sensors[j].Min, 2),
Max = (float)Math.Round((float)sh.Sensors[j].Max, 2),
});
}

if (sh.Sensors[j].SensorType == SensorType.Temperature) {
API.System.SuperIO.Temperature.Add(new Sensor {
Name = sh.Sensors[j].Name,
Value = (float)Math.Round((float)sh.Sensors[j].Value),
Min = (float)Math.Round((float)sh.Sensors[j].Min),
Max = (float)Math.Round((float)sh.Sensors[j].Max),
});
}

if (sh.Sensors[j].SensorType == SensorType.Fan) {
API.System.SuperIO.Fan.Add(new Sensor {
Name = sh.Sensors[j].Name,
Value = (float)Math.Round((float)sh.Sensors[j].Value),
Min = (float)Math.Round((float)sh.Sensors[j].Min),
Max = (float)Math.Round((float)sh.Sensors[j].Max),
});
}

if (sh.Sensors[j].SensorType == SensorType.Control) {
API.System.SuperIO.FanControl.Add(new Sensor {
Name = sh.Sensors[j].Name,
Value = (float)Math.Round((float)sh.Sensors[j].Value),
Min = (float)Math.Round((float)sh.Sensors[j].Min),
Max = (float)Math.Round((float)sh.Sensors[j].Max),
});
}
}


}

for (int j = 0; j < sensor.Length; j++) {
// CPU temperature
if (sensor[j].SensorType == SensorType.Temperature && computerHardware[i].HardwareType == HardwareType.Cpu && sensor[j].Name.StartsWith("CPU Core") && !sensor[j].Name.Contains("Tj")) {
Expand Down Expand Up @@ -204,9 +255,9 @@ public void GetInfo() {
if (sensor[j].SensorType == SensorType.Fan && computerHardware[i].HardwareType.ToString().Contains("Gpu")) {
API.GPU.Fan.Add(new Sensor {
Name = sensor[j].Name,
Value = (float)Math.Round((float)sensor[j].Value, 1),
Min = (float)Math.Round((float)sensor[j].Min, 1),
Max = (float)Math.Round((float)sensor[j].Max, 1),
Value = (float)Math.Round((float)sensor[j].Value),
Min = (float)Math.Round((float)sensor[j].Min),
Max = (float)Math.Round((float)sensor[j].Max),
});
}

Expand Down
28 changes: 27 additions & 1 deletion core/Classes/Interfaces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,28 @@ public List<Disk> Disks {
} = new();
}

public class SuperIOInfo {
public string Name {
get; set;
}

public List<Sensor> Voltage {
get; set;
} = new();

public List<Sensor> Temperature {
get; set;
} = new();

public List<Sensor> Fan {
get; set;
} = new();

public List<Sensor> FanControl {
get; set;
} = new();
}

public class MotherboardInfo {
public string Name {
get; set;
Expand Down Expand Up @@ -258,7 +280,11 @@ public NetworkInfo Network {

public BIOSInfo BIOS {
get; set;
}
} = new();

public SuperIOInfo SuperIO {
get; set;
} = new();
}

public class API {
Expand Down

0 comments on commit 9c7b36b

Please sign in to comment.