From 9fce235e153f58fc7819cd1074e0c28c7a026f4b Mon Sep 17 00:00:00 2001 From: Blacktempel <6657796+Blacktempel@users.noreply.github.com> Date: Tue, 14 Apr 2026 16:23:46 +0200 Subject: [PATCH] Update for DIT 2.0.1. (#2304) Move force wakeup to proper place. Check power state of disk and update depending on that. --- .../Hardware/Storage/StorageDevice.cs | 28 +++++++++++++------ .../LibreHardwareMonitorLib.csproj | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/LibreHardwareMonitorLib/Hardware/Storage/StorageDevice.cs b/LibreHardwareMonitorLib/Hardware/Storage/StorageDevice.cs index 6c89594..d0d7239 100644 --- a/LibreHardwareMonitorLib/Hardware/Storage/StorageDevice.cs +++ b/LibreHardwareMonitorLib/Hardware/Storage/StorageDevice.cs @@ -80,8 +80,23 @@ public sealed class StorageDevice : Hardware, ISmart return; } - // If storage device has no changes, still update performance sensors to avoid stale throughput data. - bool hasChanges = StorageDIT.Refresh(_storage); + bool isDevicePoweredOn = _storage.IsDevicePowerOn.GetValueOrDefault(true); + + // Try waking up storage device if it is asleep and ForceWakeup is enabled + if (ForceWakeup && !isDevicePoweredOn) + { + StorageDIT.TryWakeUp(_storage); + isDevicePoweredOn = _storage.IsDevicePowerOn.GetValueOrDefault(true); + } + + bool hasChanges = false; + + //No updates for sleeping devices if we should not wake it up + if (isDevicePoweredOn) + { + hasChanges = StorageDIT.Refresh(_storage); + } + if (!hasChanges) { if (!_initialized) @@ -90,18 +105,13 @@ public sealed class StorageDevice : Hardware, ISmart } else { - _lastUpdate = DateTime.UtcNow; + // If storage device has no changes, still update performance sensors to avoid stale throughput data UpdatePerformanceSensors(); + _lastUpdate = DateTime.UtcNow; return; } } - // Try waking up storage device if it is asleep and ForceWakeup is enabled - if (ForceWakeup && !_storage.IsDevicePowerOn.GetValueOrDefault(true)) - { - StorageDIT.TryWakeUp(_storage); - } - _lastUpdate = DateTime.UtcNow; ToggleSpaceSensors(); diff --git a/LibreHardwareMonitorLib/LibreHardwareMonitorLib.csproj b/LibreHardwareMonitorLib/LibreHardwareMonitorLib.csproj index 2e39254..6f2c4c4 100644 --- a/LibreHardwareMonitorLib/LibreHardwareMonitorLib.csproj +++ b/LibreHardwareMonitorLib/LibreHardwareMonitorLib.csproj @@ -81,7 +81,7 @@ - + all