Update for DIT 2.0.1. (#2304)

Move force wakeup to proper place.
Check power state of disk and update depending on that.
This commit is contained in:
Blacktempel
2026-04-14 16:23:46 +02:00
committed by GitHub
parent d11d35bb2e
commit 9fce235e15
2 changed files with 20 additions and 10 deletions
@@ -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();
@@ -81,7 +81,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DiskInfoToolkit" Version="2.0.0" />
<PackageReference Include="DiskInfoToolkit" Version="2.0.1" />
<PackageReference Include="HidSharp" Version="2.6.4" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.269">
<PrivateAssets>all</PrivateAssets>