Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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 <wangrong@uniontech.com> Thu, 31 Jul 2025 15:02:18 +0800

deepin-diskmanager (6.0.10) unstable; urgency=medium

* fix: Fix fail to get device info
Expand Down
42 changes: 22 additions & 20 deletions service/diskoperation/DeviceStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,17 @@
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") {
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
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) {
Expand Down Expand Up @@ -448,26 +451,25 @@
return false;
}

QStringList list = outPut.split("*-disk\n");

outPut.clear();
for (int i =0;i<list.count();i++) {
if(list.at(i).contains(devicePath)) {
qDebug() << "devicePath found in lshw output";
outPut = list.at(i);
break;
QString diskInfo;
QStringList list = outPut.split("*-disk");
foreach (const QString &item, list) {
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
QStringList list2 = item.split("*-namespace");
foreach (const QString &item2, list2) {
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
if (item2.contains(devicePath)) {

Check warning on line 459 in service/diskoperation/DeviceStorage.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Consider using std::find_if algorithm instead of a raw loop.
qDebug() << "devicePath found in lshw output";
diskInfo = item2;
break;
}
}
}

if (outPut.isEmpty()) {
if (diskInfo.isEmpty()) {
qDebug() << "devicePath not found in lshw output, return false";
return false;
}

QMap<QString, QString> mapInfo;

getMapInfoFromLshw(outPut, mapInfo);

getMapInfoFromLshw(diskInfo, mapInfo);
addInfoFromlshw(mapInfo);

qDebug() << "DeviceStorage::getDiskInfoFromLshw END";
Expand Down Expand Up @@ -801,7 +803,7 @@
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")) {
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
#endif
Expand Down
Loading