mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-03-18 18:50:54 +03:00
Add a workarround for some chinese drives
This commit is contained in:
@@ -216,7 +216,6 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
|
||||
{
|
||||
QJsonArray attributes = localObj["ata_smart_attributes"].toObject()["table"].toArray();
|
||||
QJsonObject nvmeLog = localObj["nvme_smart_health_information_log"].toObject();
|
||||
QString modelFamily = localObj["model_family"].toString();
|
||||
QString modelName = localObj["model_name"].toString();
|
||||
QString firmwareVersion = localObj["firmware_version"].toString();
|
||||
float userCapacityGB = localObj.value("user_capacity").toObject().value("bytes").toDouble() / 1e9;
|
||||
@@ -298,6 +297,10 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
|
||||
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
|
||||
unsigned long long totalGbWritten = (lbaWritten * logicalBlockSize) / oneGB;
|
||||
totalWrites = QString::number(static_cast<int>(totalGbWritten)) + " GB";
|
||||
if (totalWrites == "0 GB") {
|
||||
double gigabytes = (attrObj["raw"].toObject()["value"].toInt() * 32 * 1024.0 * 1024.0) / 1e9;
|
||||
totalWrites = QString::number(static_cast<int>(gigabytes)) + " GB";
|
||||
}
|
||||
} else if (attrObj["name"] == "Host_Writes_GiB" || attrObj["name"] == "Lifetime_Writes_GiB") {
|
||||
double gibibytes = attrObj["raw"].toObject()["value"].toDouble();
|
||||
double bytesPerGiB = static_cast<double>(1ULL << 30);
|
||||
@@ -318,6 +321,10 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
|
||||
unsigned long long oneGB = static_cast<unsigned long long>(std::pow(2, 30));
|
||||
unsigned long long totalGbRead = (lbaRead * logicalBlockSize) / oneGB;
|
||||
totalReads = QString::number(static_cast<int>(totalGbRead)) + " GB";
|
||||
if (totalReads == "0 GB") {
|
||||
double gigabytes = (attrObj["raw"].toObject()["value"].toInt() * 32 * 1024.0 * 1024.0) / 1e9;
|
||||
totalReads = QString::number(static_cast<int>(gigabytes)) + " GB";
|
||||
}
|
||||
} else if (attrObj["name"] == "Host_Reads_GiB" || attrObj["name"] == "Lifetime_Reads_GiB") {
|
||||
double gibibytes = attrObj["raw"].toObject()["value"].toDouble();
|
||||
double bytesPerGiB = static_cast<double>(1ULL << 30);
|
||||
|
||||
Reference in New Issue
Block a user