Skip to content

Commit 293cab4

Browse files
authored
Revert "Fix System.ArgumentException: Invalid identifier on Linux (#1434) (#1…" (#1454)
This reverts commit 635da0c.
1 parent b556856 commit 293cab4

9 files changed

Lines changed: 208 additions & 215 deletions

File tree

LibreHardwareMonitorLib/Hardware/Controller/AeroCool/P7-H1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal sealed class P7H1 : Hardware
1919
private readonly HidStream _stream;
2020
private bool _running;
2121

22-
public P7H1(HidDevice dev, ISettings settings) : base("AeroCool P7-H1", new Identifier("aerocool", "p7h1", dev.GetSerialNumber().Replace(" ", "")), settings)
22+
public P7H1(HidDevice dev, ISettings settings) : base("AeroCool P7-H1", new Identifier(dev.DevicePath), settings)
2323
{
2424
_device = dev;
2525
HubNumber = _device.ProductID - 0x1000;
@@ -93,4 +93,4 @@ public override void Update()
9393
_rpm[i].Value = _speeds[i];
9494
}
9595
}
96-
}
96+
}

LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/AquastreamUltimate.cs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// All Rights Reserved.
55

66
using System;
7-
using System.IO;
87
using HidSharp;
98

109
namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer;
@@ -21,20 +20,20 @@ internal sealed class AquastreamUltimate : Hardware
2120
private readonly Sensor[] _powers = new Sensor[2];
2221
private readonly Sensor[] _flows = new Sensor[2];
2322

24-
public AquastreamUltimate(HidDevice dev, ISettings settings) : base("AquastreamUltimate", new Identifier("aquacomputer", "asultimate", dev.GetSerialNumber().Replace(" ", "")), settings)
23+
public AquastreamUltimate(HidDevice dev, ISettings settings) : base("AquastreamUltimate", new Identifier(dev.DevicePath), settings)
2524
{
2625
if (dev.TryOpen(out _stream))
2726
{
2827
// Reading output report instead of feature report, as the measurements are in the output report.
2928
_stream.Read(_rawData);
30-
29+
3130
FirmwareVersion = GetConvertedValue(0xD).GetValueOrDefault(0);
32-
31+
3332
Name = "Aquastream ULTIMATE";
3433

3534
_temperatures[0] = new Sensor("Coolant", 0, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
3635
ActivateSensor(_temperatures[0]);
37-
36+
3837
_temperatures[1] = new Sensor("External Sensor", 1, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
3938
ActivateSensor(_temperatures[1]);
4039

@@ -87,29 +86,22 @@ public override void Close()
8786
public override void Update()
8887
{
8988
// Reading output report instead of feature report, as the measurements are in the output report
90-
try
91-
{
92-
_stream.Read(_rawData);
93-
}
94-
catch (IOException)
95-
{
96-
return;
97-
}
89+
_stream.Read(_rawData);
9890

99-
_rpmSensors[0].Value = GetConvertedValue(0x51); // Pump speed.
100-
_rpmSensors[1].Value = GetConvertedValue(0x41 + 0x06); // Fan speed.
91+
_rpmSensors[0].Value = GetConvertedValue(0x51) ; // Pump speed.
92+
_rpmSensors[1].Value = GetConvertedValue(0x41+0x06); // Fan speed.
10193

10294
_temperatures[0].Value = GetConvertedValue(0x2D) / 100f; // Water temp.
10395
_temperatures[1].Value = GetConvertedValue(0x2F) / 100f; // Ext sensor temp.
10496

10597
_voltages[0].Value = GetConvertedValue(0x3D) / 100f; // Pump input voltage.
106-
_voltages[1].Value = GetConvertedValue(0x41 + 0x02) / 100f; // Fan output voltage.
98+
_voltages[1].Value = GetConvertedValue(0x41+0x02) / 100f; // Fan output voltage.
10799

108100
_currents[0].Value = GetConvertedValue(0x53) / 1000f; // Pump current.
109-
_currents[1].Value = GetConvertedValue(0x41 + 0x00) / 1000f; // Fan current.
101+
_currents[1].Value = GetConvertedValue(0x41+0x00) / 1000f; // Fan current.
110102

111103
_powers[0].Value = GetConvertedValue(0x55) / 100f; // Pump power.
112-
_powers[1].Value = GetConvertedValue(0x41 + 0x04) / 100f; // Fan power.
104+
_powers[1].Value = GetConvertedValue(0x41+0x04) / 100f; // Fan power.
113105

114106
_flows[0].Value = GetConvertedValue(0x37); // Flow.
115107
_flows[1].Value = GetConvertedValue(0x57) / 1000f; // Pressure.
@@ -119,7 +111,7 @@ public override void Update()
119111
{
120112
if (_rawData[index] == sbyte.MaxValue)
121113
return null;
122-
114+
123115
return Convert.ToUInt16(_rawData[index + 1] | (_rawData[index] << 8));
124-
}
116+
}
125117
}

LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/AquastreamXT.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal sealed class AquastreamXT : Hardware
2626
private readonly Sensor[] _temperatures = new Sensor[3];
2727
private readonly Sensor[] _voltages = new Sensor[2];
2828

29-
public AquastreamXT(HidDevice dev, ISettings settings) : base("Aquastream XT", new Identifier("aquacomputer", "asxt", dev.GetSerialNumber().Replace(" ", "")), settings)
29+
public AquastreamXT(HidDevice dev, ISettings settings) : base("Aquastream XT", new Identifier(dev.DevicePath), settings)
3030
{
3131
if (dev.TryOpen(out _stream))
3232
{
@@ -129,6 +129,7 @@ public override void Update()
129129
{
130130
return;
131131
}
132+
132133

133134
if (_rawData[0] != 0x4)
134135
return;

LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/D5Next.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal sealed class D5Next : Hardware
2525
private readonly HidStream _stream;
2626
private readonly Sensor[] _temperatures = new Sensor[1];
2727

28-
public D5Next(HidDevice dev, ISettings settings) : base("D5Next", new Identifier("aquacomputer", "d5next", dev.GetSerialNumber().Replace(" ", "")), settings)
28+
public D5Next(HidDevice dev, ISettings settings) : base("D5Next", new Identifier(dev.DevicePath), settings)
2929
{
3030
if (dev.TryOpen(out _stream))
3131
{

LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/Farbwerk.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal sealed class Farbwerk : Hardware
2727
private readonly Sensor[] _temperatures = new Sensor[TEMPERATURE_COUNT];
2828
private readonly Sensor[] _colors = new Sensor[COLOR_VALUE_COUNT];
2929

30-
public Farbwerk(HidDevice dev, ISettings settings) : base("Farbwerk", new Identifier("aquacomputer", "farbwerk", dev.GetSerialNumber().Replace(" ", "")), settings)
30+
public Farbwerk(HidDevice dev, ISettings settings) : base("Farbwerk", new Identifier(dev.DevicePath), settings)
3131
{
3232
if (dev.TryOpen(out _stream))
3333
{

LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/MPS.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal sealed class MPS : Hardware
2323

2424
private ushort _externalTemperature;
2525

26-
public MPS(HidDevice dev, ISettings settings) : base("MPS", new Identifier("aquacomputer", "mps", dev.GetSerialNumber().Replace(" ", "")), settings)
26+
public MPS(HidDevice dev, ISettings settings) : base("MPS", new Identifier(dev.DevicePath), settings)
2727
{
2828
if (dev.TryOpen(out _stream))
2929
{

LibreHardwareMonitorLib/Hardware/Controller/AquaComputer/Octo.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,30 @@ internal sealed class Octo : Hardware
1818
private readonly Sensor[] _currents = new Sensor[8];
1919
private readonly Sensor[] _powers = new Sensor[8];
2020

21-
public Octo(HidDevice dev, ISettings settings) : base("Octo", new Identifier("aquacomputer", "octo", dev.GetSerialNumber().Replace(" ", "")), settings)
21+
public Octo(HidDevice dev, ISettings settings) : base("Octo", new Identifier(dev.DevicePath), settings)
2222
{
2323
if (dev.TryOpen(out _stream))
2424
{
2525
//Reading output report instead of feature report, as the measurements are in the output report
2626
_stream.Read(_rawData);
27-
27+
2828
Name = "OCTO";
2929
FirmwareVersion = GetConvertedValue(OctoDataIndexes.FIRMWARE_VERSION).GetValueOrDefault(0);
3030

3131
// Initialize the 4 temperature sensors
3232
for (int i = 0; i < 4; i++)
3333
{
34-
_temperatures[i] = new Sensor($"Temperature {i + 1}", i, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
34+
_temperatures[i] = new Sensor($"Temperature {i+1}", i, SensorType.Temperature, this, Array.Empty<ParameterDescription>(), settings);
3535
ActivateSensor(_temperatures[i]);
3636
}
3737

3838
// Initialize the 8 fan speed sensors
3939
for (int i = 0; i < 8; i++)
4040
{
41-
_rpmSensors[i] = new Sensor($"Fan {i + 1}", i, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
41+
_rpmSensors[i] = new Sensor($"Fan {i+1}", i, SensorType.Fan, this, Array.Empty<ParameterDescription>(), settings);
4242
ActivateSensor(_rpmSensors[i]);
4343
}
44-
44+
4545
// Initialize the input voltage sensor
4646
_voltages[0] = new Sensor("Input", 0, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
4747
ActivateSensor(_voltages[0]);
@@ -52,18 +52,18 @@ internal sealed class Octo : Hardware
5252
_voltages[i] = new Sensor($"Fan {i}", i, SensorType.Voltage, this, Array.Empty<ParameterDescription>(), settings);
5353
ActivateSensor(_voltages[i]);
5454
}
55-
55+
5656
// Initialize the 8 fan current sensors
5757
for (int i = 0; i < 8; i++)
5858
{
59-
_currents[i] = new Sensor($"Fan {i + 1}", i, SensorType.Current, this, Array.Empty<ParameterDescription>(), settings);
59+
_currents[i] = new Sensor($"Fan {i+1}", i, SensorType.Current, this, Array.Empty<ParameterDescription>(), settings);
6060
ActivateSensor(_currents[i]);
6161
}
62-
62+
6363
// Initialize the 8 fan power sensors
6464
for (int i = 0; i < 8; i++)
6565
{
66-
_powers[i] = new Sensor($"Fan {i + 1}", i, SensorType.Power, this, Array.Empty<ParameterDescription>(), settings);
66+
_powers[i] = new Sensor($"Fan {i+1}", i, SensorType.Power, this, Array.Empty<ParameterDescription>(), settings);
6767
ActivateSensor(_powers[i]);
6868
}
6969
}
@@ -86,7 +86,7 @@ public override void Update()
8686
{
8787
//Reading output report instead of feature report, as the measurements are in the output report
8888
_stream.Read(_rawData);
89-
89+
9090
_temperatures[0].Value = GetConvertedValue(OctoDataIndexes.TEMP_1) / 100f; // Temp 1
9191
_temperatures[1].Value = GetConvertedValue(OctoDataIndexes.TEMP_2) / 100f; // Temp 2
9292
_temperatures[2].Value = GetConvertedValue(OctoDataIndexes.TEMP_3) / 100f; // Temp 3
@@ -100,7 +100,7 @@ public override void Update()
100100
_rpmSensors[5].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_6); // Fan 6 speed
101101
_rpmSensors[6].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_7); // Fan 7 speed
102102
_rpmSensors[7].Value = GetConvertedValue(OctoDataIndexes.FAN_SPEED_8); // Fan 8 speed
103-
103+
104104
_voltages[0].Value = GetConvertedValue(OctoDataIndexes.VOLTAGE) / 100f; // Input voltage
105105
_voltages[1].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_1) / 100f; // Fan 1 voltage
106106
_voltages[2].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_2) / 100f; // Fan 2 voltage
@@ -110,7 +110,7 @@ public override void Update()
110110
_voltages[6].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_6) / 100f; // Fan 6 voltage
111111
_voltages[7].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_7) / 100f; // Fan 7 voltage
112112
_voltages[8].Value = GetConvertedValue(OctoDataIndexes.FAN_VOLTAGE_8) / 100f; // Fan 8 voltage
113-
113+
114114
_currents[0].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_1) / 1000f; // Fan 1 current
115115
_currents[1].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_2) / 1000f; // Fan 2 current
116116
_currents[2].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_3) / 1000f; // Fan 3 current
@@ -119,7 +119,7 @@ public override void Update()
119119
_currents[5].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_6) / 1000f; // Fan 6 current
120120
_currents[6].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_7) / 1000f; // Fan 7 current
121121
_currents[7].Value = GetConvertedValue(OctoDataIndexes.FAN_CURRENT_8) / 1000f; // Fan 8 current
122-
122+
123123
_powers[0].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_1) / 100f; // Fan 1 power
124124
_powers[1].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_2) / 100f; // Fan 2 power
125125
_powers[2].Value = GetConvertedValue(OctoDataIndexes.FAN_POWER_3) / 100f; // Fan 3 power
@@ -133,7 +133,7 @@ public override void Update()
133133
private sealed class OctoDataIndexes
134134
{
135135
public const int FIRMWARE_VERSION = 13;
136-
136+
137137
public const int TEMP_1 = 61;
138138
public const int TEMP_2 = 63;
139139
public const int TEMP_3 = 65;
@@ -147,7 +147,7 @@ private sealed class OctoDataIndexes
147147
public const int FAN_SPEED_6 = 198;
148148
public const int FAN_SPEED_7 = 211;
149149
public const int FAN_SPEED_8 = 224;
150-
150+
151151
public const int FAN_POWER_1 = 131;
152152
public const int FAN_POWER_2 = 144;
153153
public const int FAN_POWER_3 = 157;
@@ -166,7 +166,7 @@ private sealed class OctoDataIndexes
166166
public const int FAN_VOLTAGE_6 = 192;
167167
public const int FAN_VOLTAGE_7 = 205;
168168
public const int FAN_VOLTAGE_8 = 218;
169-
169+
170170
public const int FAN_CURRENT_1 = 129;
171171
public const int FAN_CURRENT_2 = 142;
172172
public const int FAN_CURRENT_3 = 155;
@@ -181,7 +181,7 @@ private sealed class OctoDataIndexes
181181
{
182182
if (_rawData[index] == sbyte.MaxValue)
183183
return null;
184-
184+
185185
return Convert.ToUInt16(_rawData[index + 1] | (_rawData[index] << 8));
186186
}
187-
}
187+
}

0 commit comments

Comments
 (0)