Skip to content
Merged
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
14 changes: 14 additions & 0 deletions service/diskoperation/DeviceStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,20 @@ void DeviceStorage::getDiskInfoModel(const QString &devicePath, QString &model)
}
}

cmd = "udevadm info " + devicePath + " | grep ID_MODEL=";
proc.start("bash", QStringList() << "-c" << cmd);
proc.waitForFinished(-1);
outPut = proc.readAllStandardOutput();
if (!outPut.isEmpty()) {
auto idModel = outPut.split("=", QString::SkipEmptyParts);
if (idModel.count() > 1)
model = idModel.at(1).trimmed();
if (!model.isEmpty())
return;
}

qWarning() << "tried a lot but got nothing about model for" << devicePath;

// 若未获取到型号名,返回未知
model = "UnKnow";
return;
Expand Down