From 3ee7128ee33c7df5cd0f00a4d5aa3ef781145fef Mon Sep 17 00:00:00 2001 From: Spiros Date: Mon, 19 Aug 2024 13:07:54 +0300 Subject: [PATCH] Fix an SK Hynix drive --- src/mainwindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 10f8916..56bc33f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -573,11 +573,14 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal int percentageUsed = attrObj["raw"].toObject()["value"].toInt(); percentage = QString::number(percentageUsed) + " %"; } else if (attrObj["name"] == "Percent_Lifetime_Remain") { - int percentageUsed = attrObj["raw"].toObject()["value"].toInt(); + int percentageUsed = attrObj["value"].toInt(); percentage = QString::number(percentageUsed) + " %"; } else if (attrObj["name"] == "Media_Wearout_Indicator" || attrObj["name"] == "SSD_Life_Left") { int percentageUsed = attrObj["value"].toInt(); - percentage = QString::number(percentageUsed) + " %"; + int percentageUsedWorst = attrObj["worst"].toInt(); + if (percentageUsedWorst <= 100) { + percentage = QString::number(percentageUsed) + " %"; + } } } if (percentage.isEmpty() && rotationRate == "---- (SSD)") { // Workaround for some drives which have this and another attribute