Wrap stream.getfeature in try/catch (#1113)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using HidSharp;
|
||||
|
||||
namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer;
|
||||
@@ -119,8 +120,16 @@ internal sealed class AquastreamXT : Hardware
|
||||
//TODO: Check tested and fix unknown variables
|
||||
public override void Update()
|
||||
{
|
||||
_rawData[0] = 0x4;
|
||||
_stream.GetFeature(_rawData);
|
||||
try
|
||||
{
|
||||
_rawData[0] = 0x4;
|
||||
_stream.GetFeature(_rawData);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (_rawData[0] != 0x4)
|
||||
return;
|
||||
@@ -156,4 +165,4 @@ internal sealed class AquastreamXT : Hardware
|
||||
MODE_FAN_AMP = 2,
|
||||
MODE_FAN_CONTROLLER = 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using HidSharp;
|
||||
|
||||
namespace LibreHardwareMonitor.Hardware.Controller.AquaComputer;
|
||||
@@ -76,8 +77,15 @@ internal sealed class MPS : Hardware
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
_rawData[0] = MPS_REPORT_ID;
|
||||
_stream.GetFeature(_rawData);
|
||||
try
|
||||
{
|
||||
_rawData[0] = MPS_REPORT_ID;
|
||||
_stream.GetFeature(_rawData);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_rawData[0] != MPS_REPORT_ID)
|
||||
return;
|
||||
@@ -96,6 +104,7 @@ internal sealed class MPS : Hardware
|
||||
}
|
||||
|
||||
_temperatures[1].Value = BitConverter.ToUInt16(_rawData, InternalWaterTemperature) / 100f;
|
||||
|
||||
}
|
||||
|
||||
private ushort ExtractFirmwareVersion()
|
||||
|
||||
Reference in New Issue
Block a user