From af3aab7386d46122080059a8e2a76f832de593a8 Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Thu, 8 May 2025 06:41:15 -0400 Subject: [PATCH 1/3] temp fix: force usage of bundled smartctl --- qdiskinfo-appimage.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qdiskinfo-appimage.sh b/qdiskinfo-appimage.sh index fa6687e..8ac2ada 100644 --- a/qdiskinfo-appimage.sh +++ b/qdiskinfo-appimage.sh @@ -55,13 +55,13 @@ export QT_STYLE_OVERRIDE="${QT_STYLE_OVERRIDE:-Breeze}" [ -f "$APPIMAGE".stylesheet ] && APPIMAGE_QT_THEME="$APPIMAGE.stylesheet" [ -f "$APPIMAGE_QT_THEME" ] && set -- "$@" "-stylesheet" "$APPIMAGE_QT_THEME" -if ! command -v smartctl >/dev/null 2>&1; then - echo "smartctl is not on the system, using bundled binary..." - export PATH="$PATH:"$CACHEDIR"/qdiskinfo-appimage" +#if ! command -v smartctl >/dev/null 2>&1; then +# echo "smartctl is not on the system, using bundled binary..." + export PATH="$CACHEDIR/qdiskinfo-appimage:$PATH" mkdir -p "$CACHEDIR"/qdiskinfo-appimage cp -v "$CURRENTDIR"/smartctl "$CACHEDIR"/qdiskinfo-appimage chmod +x "$CACHEDIR"/qdiskinfo-appimage/smartctl -fi +#fi exec "$CURRENTDIR"/bin/QDiskInfo "$@"' > ./AppRun chmod +x ./AppRun From 3416cc7ac19b25bb78eab135cf5e0b281e506de0 Mon Sep 17 00:00:00 2001 From: Spiros Date: Thu, 8 May 2025 14:02:47 +0300 Subject: [PATCH 2/3] Fix 4 issues Fixes #48 Fixes CustomButton doesn't get highlighted when clicking a radio button Fixes issue where disksGroup actions were not being cleared Fixes some warnings --- src/jsonparser.cpp | 2 ++ src/mainwindow.cpp | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/jsonparser.cpp b/src/jsonparser.cpp index 05acd27..98e2317 100644 --- a/src/jsonparser.cpp +++ b/src/jsonparser.cpp @@ -29,6 +29,8 @@ QVector> JsonParser::parse(const QString &json) if (found) { if (trimmedLine.contains("}")) { break; + } else if (trimmedLine.contains("nsid")) { // smartctl now adds an nsid field, skip it for now + continue; } qsizetype colonPos = trimmedLine.indexOf(":"); if (colonPos != -1) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4d9fb71..9765168 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -176,6 +176,13 @@ void MainWindow::updateUI() bool firstTime = true; globalIsNvme = false; + QList oldActions = disksGroup->actions(); + for (QAction *action : std::as_const(oldActions)) { + disksGroup->removeAction(action); + menuDisk->removeAction(action); + delete action; + } + for (int i = 0; i < devices.size(); ++i) { QJsonObject device = devices[i].toObject(); QString deviceName = device["name"].toString(); @@ -244,7 +251,12 @@ void MainWindow::updateUI() } } else if (isScsi) { QJsonObject scsiErrorCounterLog = localObj.value("scsi_error_counter_log").toObject(); - for (const QString key : {"read", "write", "verify"}) { + static const QString keys[] = { + QStringLiteral("read"), + QStringLiteral("write"), + QStringLiteral("verify") + }; + for (const QString& key : keys) { if (scsiErrorCounterLog.value(key).toObject().value("total_uncorrected_errors").toInt() != 0) { caution = true; } @@ -329,6 +341,7 @@ void MainWindow::updateUI() connect(diskAction, &QAction::triggered, this, [=]() { updateWindow(); + button->setChecked(true); }); if (firstTime) { @@ -960,6 +973,9 @@ void MainWindow::addNvmeLogTable(const QVector>& nvmeLogOrde QString key = pair.first; QString name = key.replace("_", " "); + if (name == "nsid") { // smartctl now adds an nsid field, skip it for now + continue; + } name = Utils.toTitleCase(name); int rawInt = pair.second; @@ -1372,7 +1388,7 @@ void MainWindow::on_actionASCII_View_triggered() QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Close, asciiViewDialog); connect(buttonBox, &QDialogButtonBox::rejected, asciiViewDialog, &QDialog::close); - connect(buttonBox->button(QDialogButtonBox::Save), &QPushButton::clicked, [binaryData, this, deviceNodePath]() { + connect(buttonBox->button(QDialogButtonBox::Save), &QPushButton::clicked, this, [binaryData, this, deviceNodePath]() { QString filePath = QFileDialog::getSaveFileName(this, tr("Save Binary Data"), deviceNodePath.section('/', -1) + ".bin", tr("Binary Files (*.bin);;All Files (*)")); if (!filePath.isEmpty()) { QFile file(filePath); From 9b7f4fb44e888dde7c9d0e82300d275e8671769d Mon Sep 17 00:00:00 2001 From: Spiros Date: Thu, 22 May 2025 00:13:42 +0300 Subject: [PATCH 3/3] Parse Total LBAs for drives which seem to use Gigabytes --- src/mainwindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9765168..e935cc9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -554,7 +554,11 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal qlonglong lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong(); qlonglong oneGB = static_cast(std::pow(2, 30)); qlonglong gigabytes = (lbaWritten * logicalBlockSize) / oneGB; - totalWritesInt = static_cast(gigabytes); + int gigabytesInt = static_cast(gigabytes); + if (!gigabytesInt) { + gigabytesInt = static_cast(lbaWritten); + } + totalWritesInt = gigabytesInt; } else if (attrObj["name"] == "Host_Writes_GiB" || attrObj["name"] == "Lifetime_Writes_GiB") { double gibibytes = attrObj["raw"].toObject()["value"].toDouble(); double bytesPerGiB = static_cast(1ULL << 30); @@ -575,7 +579,11 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal qlonglong lbaRead = attrObj["raw"].toObject()["value"].toVariant().toLongLong(); qlonglong oneGB = static_cast(std::pow(2, 30)); qlonglong gigabytes = (lbaRead * logicalBlockSize) / oneGB; - totalReadsInt = static_cast(gigabytes); + int gigabytesInt = static_cast(gigabytes); + if (!gigabytesInt) { + gigabytesInt = static_cast(lbaRead); + } + totalReadsInt = gigabytesInt; } else if (attrObj["name"] == "Host_Reads_GiB" || attrObj["name"] == "Lifetime_Reads_GiB") { double gibibytes = attrObj["raw"].toObject()["value"].toDouble(); double bytesPerGiB = static_cast(1ULL << 30);