diff --git a/debian/changelog b/debian/changelog index 532d7fc..1f7a73e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +deepin-diskmanager (6.0.11) unstable; urgency=medium + + * fix: Fix incomplete retrieval of disk hardware information + * fix: Improve disk info retrieval logic + + -- wangrong Thu, 31 Jul 2025 15:02:18 +0800 + deepin-diskmanager (6.0.10) unstable; urgency=medium * fix: Fix fail to get device info diff --git a/service/diskoperation/DeviceStorage.cpp b/service/diskoperation/DeviceStorage.cpp index a8e13b8..e2b51a5 100755 --- a/service/diskoperation/DeviceStorage.cpp +++ b/service/diskoperation/DeviceStorage.cpp @@ -142,14 +142,17 @@ bool DeviceStorage::addInfoFromlshw(const QMap &mapInfo) qWarning() << "Invalid bus info format:" << mapInfo["bus info"]; return false; } - QString key = keys[1].trimmed(); - key.replace(".", ":"); - if (key != m_KeyToLshw) { - qDebug() << "lshw key does not match, returning false"; - return false; + if (keys[0].trimmed() == "nvme") { + qDebug() << "nvme device found, not check KeyToLshw"; + } else { + QString key = keys[1].trimmed(); + key.replace(".", ":"); + if (key != m_KeyToLshw) { + qDebug() << "lshw key does not match, returning false" << keys[0].trimmed() << key << m_KeyToLshw; + return false; + } } - // 获取唯一key QStringList words = mapInfo["bus info"].split(":"); if (words.size() == 2) { @@ -448,26 +451,25 @@ bool DeviceStorage::getDiskInfoFromLshw(const QString &devicePath) return false; } - QStringList list = outPut.split("*-disk\n"); - - outPut.clear(); - for (int i =0;i mapInfo; - - getMapInfoFromLshw(outPut, mapInfo); - + getMapInfoFromLshw(diskInfo, mapInfo); addInfoFromlshw(mapInfo); qDebug() << "DeviceStorage::getDiskInfoFromLshw END"; @@ -801,7 +803,7 @@ void DeviceStorage::getMapInfoFromSmartctl(QMap &mapInfo, cons int index = line.indexOf(ch); #if QT_VERSION_MAJOR > 5 QRegularExpressionMatch match = reg.match(line); - if (index > 0 && !match.hasMatch() && match.captured(0) == line && false == line.contains("Error") && false == line.contains("hh:mm:SS")) { + if (index > 0 && !match.hasMatch() && false == line.contains("Error") && false == line.contains("hh:mm:SS")) { #else if (index > 0 && reg.exactMatch(line) == false && false == line.contains("Error") && false == line.contains("hh:mm:SS")) { #endif